From 136b6680a156c38895f5ea6d05ea0c84cac9c7d0 Mon Sep 17 00:00:00 2001 From: Mahdi Date: Fri, 10 Apr 2020 17:53:04 +0430 Subject: [PATCH] Fix Search in SnippetHistory, Remove LeftModernMenu, Separate LocalSnippet and OnlineSnippet --- CodeHubDesktop/App.xaml | 8 +- CodeHubDesktop/App.xaml.cs | 27 +--- CodeHubDesktop/CodeHubDesktop.csproj | 3 +- CodeHubDesktop/Controls/MyHamburgerMenu.cs | 61 --------- CodeHubDesktop/Data/AppConfig.cs | 1 - .../Data/Services/GenericDataService.cs | 1 - .../MultiLanguage/Language/Lang.Designer.cs | 38 ++---- .../MultiLanguage/Language/Lang.fa-IR.resx | 14 +- .../MultiLanguage/Language/Lang.resx | 14 +- .../{ => Resources}/gitbanner_6jm_icon.ico | Bin .../ViewModels/LeftMainContent2ViewModel.cs | 38 ------ .../ViewModels/LeftMainContentViewModel.cs | 39 +++--- .../ViewModels/SnippetHistoryViewModel.cs | 119 +---------------- .../ViewModels/SnippetOnlineViewModel.cs | 124 ++++++++++++++++++ CodeHubDesktop/Views/LeftMainContent.xaml | 86 +++++------- CodeHubDesktop/Views/LeftMainContent.xaml.cs | 6 +- CodeHubDesktop/Views/LeftMainContent2.xaml | 30 ----- CodeHubDesktop/Views/LeftMainContent2.xaml.cs | 13 -- CodeHubDesktop/Views/MainWindow.xaml | 49 ++++--- CodeHubDesktop/Views/MainWindow.xaml.cs | 32 ----- CodeHubDesktop/Views/Settings.xaml | 2 +- CodeHubDesktop/Views/Settings.xaml.cs | 9 -- CodeHubDesktop/Views/SnippetHistory.xaml | 93 +++++-------- CodeHubDesktop/Views/SnippetOnline.xaml | 40 ++++++ CodeHubDesktop/Views/SnippetOnline.xaml.cs | 15 +++ 25 files changed, 315 insertions(+), 547 deletions(-) delete mode 100644 CodeHubDesktop/Controls/MyHamburgerMenu.cs rename CodeHubDesktop/{ => Resources}/gitbanner_6jm_icon.ico (100%) delete mode 100644 CodeHubDesktop/ViewModels/LeftMainContent2ViewModel.cs create mode 100644 CodeHubDesktop/ViewModels/SnippetOnlineViewModel.cs delete mode 100644 CodeHubDesktop/Views/LeftMainContent2.xaml delete mode 100644 CodeHubDesktop/Views/LeftMainContent2.xaml.cs create mode 100644 CodeHubDesktop/Views/SnippetOnline.xaml create mode 100644 CodeHubDesktop/Views/SnippetOnline.xaml.cs diff --git a/CodeHubDesktop/App.xaml b/CodeHubDesktop/App.xaml index 33dc2da..4b039dc 100644 --- a/CodeHubDesktop/App.xaml +++ b/CodeHubDesktop/App.xaml @@ -2,12 +2,10 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:hc="https://handyorg.github.io/handycontrol" - xmlns:prism="http://prismlibrary.com/" xmlns:ui="http://schemas.modernwpf.com/2019"> + xmlns:prism="http://prismlibrary.com/"> - - @@ -24,11 +22,11 @@ - - diff --git a/CodeHubDesktop/App.xaml.cs b/CodeHubDesktop/App.xaml.cs index a2e3296..c86a296 100644 --- a/CodeHubDesktop/App.xaml.cs +++ b/CodeHubDesktop/App.xaml.cs @@ -2,12 +2,10 @@ using CodeHubDesktop.Views; using HandyControl.Data; using HandyControl.Tools; -using ModernWpf; using Prism.Ioc; using Prism.Regions; using System; using System.Windows; -using System.Windows.Media; namespace CodeHubDesktop { @@ -17,6 +15,10 @@ public App() { GlobalData.Init(); ConfigHelper.Instance.SetLang(GlobalData.Config.Lang); + if (GlobalData.Config.Skin != SkinType.Default) + { + UpdateSkin(GlobalData.Config.Skin); + } } protected override void OnStartup(StartupEventArgs e) @@ -27,10 +29,6 @@ protected override void OnStartup(StartupEventArgs e) protected override Window CreateShell() { - if (GlobalData.Config.Skin != SkinType.Default) - { - UpdateSkin(GlobalData.Config.Skin); - } return Container.Resolve(); } @@ -43,6 +41,7 @@ protected override void RegisterTypes(IContainerRegistry containerRegistry) containerRegistry.RegisterForNavigation(); containerRegistry.RegisterForNavigation(); containerRegistry.RegisterForNavigation(); + containerRegistry.RegisterForNavigation(); containerRegistry.RegisterForNavigation(); } internal void UpdateSkin(SkinType skin) @@ -55,22 +54,6 @@ internal void UpdateSkin(SkinType skin) { Source = new Uri("pack://application:,,,/HandyControl;component/Themes/Theme.xaml") }); - - if (skin.Equals(SkinType.Dark)) - { - ThemeManager.Current.ApplicationTheme = ApplicationTheme.Dark; - } - else if (skin.Equals(SkinType.Default)) - { - ThemeManager.Current.ApplicationTheme = ApplicationTheme.Light; - } - else - { - ThemeManager.Current.ApplicationTheme = ApplicationTheme.Light; - ThemeManager.Current.AccentColor = ResourceHelper.GetResource(ResourceToken.VioletColor); - - } - } } } diff --git a/CodeHubDesktop/CodeHubDesktop.csproj b/CodeHubDesktop/CodeHubDesktop.csproj index 9e8b19c..8de2993 100644 --- a/CodeHubDesktop/CodeHubDesktop.csproj +++ b/CodeHubDesktop/CodeHubDesktop.csproj @@ -12,7 +12,7 @@ 1.0.1.0 latest en;fa;en-US;fa-IR - gitbanner_6jm_icon.ico + Resources\gitbanner_6jm_icon.ico Mahdi Hosseini @@ -31,7 +31,6 @@ - diff --git a/CodeHubDesktop/Controls/MyHamburgerMenu.cs b/CodeHubDesktop/Controls/MyHamburgerMenu.cs deleted file mode 100644 index 081c3fa..0000000 --- a/CodeHubDesktop/Controls/MyHamburgerMenu.cs +++ /dev/null @@ -1,61 +0,0 @@ -using ModernWpf.MahApps.Controls; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Media; - -namespace CodeHubDesktop.Controls -{ - public class MyHamburgerMenu : HamburgerMenuEx - { - #region PaneFontFamily - - public static readonly DependencyProperty PaneFontFamilyProperty = - DependencyProperty.Register( - nameof(PaneFontFamily), - typeof(FontFamily), - typeof(MyHamburgerMenu), - new PropertyMetadata(OnPaneFontFamilyChanged)); - - public FontFamily PaneFontFamily - { - get => (FontFamily)GetValue(PaneFontFamilyProperty); - set => SetValue(PaneFontFamilyProperty, value); - } - - private static void OnPaneFontFamilyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) - { - ((MyHamburgerMenu)d).ApplyPaneFontFamily(); - } - - private void ApplyPaneFontFamily() - { - if (PaneGrid != null) - { - FontFamily paneFontFamily = PaneFontFamily; - if (paneFontFamily != null) - { - PaneGrid.Resources[SystemFonts.MenuFontFamilyKey] = paneFontFamily; - PaneGrid.Resources["ContentControlThemeFontFamily"] = paneFontFamily; - } - else - { - PaneGrid.Resources.Remove(SystemFonts.MenuFontFamilyKey); - PaneGrid.Resources.Remove("ContentControlThemeFontFamily"); - } - } - } - - #endregion - - private Grid PaneGrid { get; set; } - - public override void OnApplyTemplate() - { - base.OnApplyTemplate(); - - PaneGrid = GetTemplateChild(nameof(PaneGrid)) as Grid; - - ApplyPaneFontFamily(); - } - } -} diff --git a/CodeHubDesktop/Data/AppConfig.cs b/CodeHubDesktop/Data/AppConfig.cs index 8d19f3e..386534f 100644 --- a/CodeHubDesktop/Data/AppConfig.cs +++ b/CodeHubDesktop/Data/AppConfig.cs @@ -9,7 +9,6 @@ internal class AppConfig public string Lang { get; set; } = "fa-IR"; public string APIBaseAddress { get; set; } = "http://codehub.pythonanywhere.com/api/v1/snippet/"; - public bool IsModernStyle { get; set; } = false; public bool StoreSnippet { get; set; } = false; public SkinType Skin { get; set; } = SkinType.Default; } diff --git a/CodeHubDesktop/Data/Services/GenericDataService.cs b/CodeHubDesktop/Data/Services/GenericDataService.cs index 5da8d71..92c5e59 100644 --- a/CodeHubDesktop/Data/Services/GenericDataService.cs +++ b/CodeHubDesktop/Data/Services/GenericDataService.cs @@ -1,7 +1,6 @@ using CodeHubDesktop.Models; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.ChangeTracking; -using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; diff --git a/CodeHubDesktop/MultiLanguage/Language/Lang.Designer.cs b/CodeHubDesktop/MultiLanguage/Language/Lang.Designer.cs index 3d09c5d..862258c 100644 --- a/CodeHubDesktop/MultiLanguage/Language/Lang.Designer.cs +++ b/CodeHubDesktop/MultiLanguage/Language/Lang.Designer.cs @@ -358,15 +358,6 @@ public static string GithubOrg { } } - /// - /// Looks up a localized string similar to Menu. - /// - public static string HamburgerMenuHeaderItem { - get { - return ResourceManager.GetString("HamburgerMenuHeaderItem", resourceCulture); - } - } - /// /// Looks up a localized string similar to Publish Date. /// @@ -530,7 +521,7 @@ public static string ShieldSubject { } /// - /// Looks up a localized string similar to Snippet History. + /// Looks up a localized string similar to Stored Snippet. /// public static string SnippetHistory { get { @@ -539,38 +530,29 @@ public static string SnippetHistory { } /// - /// Looks up a localized string similar to Subject.... - /// - public static string Subject { - get { - return ResourceManager.GetString("Subject", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Snippet Title. + /// Looks up a localized string similar to Read Online Snippet. /// - public static string SubjectTitle { + public static string SnippetOnline { get { - return ResourceManager.GetString("SubjectTitle", resourceCulture); + return ResourceManager.GetString("SnippetOnline", resourceCulture); } } /// - /// Looks up a localized string similar to Your Snippets. + /// Looks up a localized string similar to Subject.... /// - public static string TabLocal { + public static string Subject { get { - return ResourceManager.GetString("TabLocal", resourceCulture); + return ResourceManager.GetString("Subject", resourceCulture); } } /// - /// Looks up a localized string similar to Others Snippets. + /// Looks up a localized string similar to Snippet Title. /// - public static string TabOther { + public static string SubjectTitle { get { - return ResourceManager.GetString("TabOther", resourceCulture); + return ResourceManager.GetString("SubjectTitle", resourceCulture); } } diff --git a/CodeHubDesktop/MultiLanguage/Language/Lang.fa-IR.resx b/CodeHubDesktop/MultiLanguage/Language/Lang.fa-IR.resx index 4fa6ce2..acc5da0 100644 --- a/CodeHubDesktop/MultiLanguage/Language/Lang.fa-IR.resx +++ b/CodeHubDesktop/MultiLanguage/Language/Lang.fa-IR.resx @@ -216,9 +216,6 @@ کدهاب - - منو - تاریخ انتشار @@ -274,7 +271,10 @@ لینک به حافظه کپی شد - اسنیپت های قبلی + اسنیپت های ذخیره شده + + + خواندن اسنیپت های انلاین عنوان... @@ -282,12 +282,6 @@ عنوان اسنیپت - - اسنیپت های شما - - - اسنیپت های دیگران - بروزرسانی diff --git a/CodeHubDesktop/MultiLanguage/Language/Lang.resx b/CodeHubDesktop/MultiLanguage/Language/Lang.resx index b6729b0..898567f 100644 --- a/CodeHubDesktop/MultiLanguage/Language/Lang.resx +++ b/CodeHubDesktop/MultiLanguage/Language/Lang.resx @@ -217,9 +217,6 @@ Desktop Version Work with CodeHub API. CodeHub - - Menu - Publish Date @@ -275,7 +272,10 @@ Desktop Version Work with CodeHub API. Link Copied to Clipborad - Snippet History + Stored Snippet + + + Read Online Snippet Subject... @@ -283,12 +283,6 @@ Desktop Version Work with CodeHub API. Snippet Title - - Your Snippets - - - Others Snippets - Update diff --git a/CodeHubDesktop/gitbanner_6jm_icon.ico b/CodeHubDesktop/Resources/gitbanner_6jm_icon.ico similarity index 100% rename from CodeHubDesktop/gitbanner_6jm_icon.ico rename to CodeHubDesktop/Resources/gitbanner_6jm_icon.ico diff --git a/CodeHubDesktop/ViewModels/LeftMainContent2ViewModel.cs b/CodeHubDesktop/ViewModels/LeftMainContent2ViewModel.cs deleted file mode 100644 index c3f2a4d..0000000 --- a/CodeHubDesktop/ViewModels/LeftMainContent2ViewModel.cs +++ /dev/null @@ -1,38 +0,0 @@ -using Prism.Commands; -using Prism.Mvvm; -using Prism.Regions; -using System.Windows.Controls; - -namespace CodeHubDesktop.ViewModels -{ - public class LeftMainContent2ViewModel : BindableBase - { - private readonly IRegionManager _regionManager; - - #region Command - public DelegateCommand SwitchItemCmd { get; private set; } - #endregion - - public LeftMainContent2ViewModel(IRegionManager regionManager) - { - _regionManager = regionManager; - SwitchItemCmd = new DelegateCommand(Switch); - } - - private void Switch(SelectionChangedEventArgs e) - { - if (e.AddedItems.Count == 0) - { - return; - } - if (e.AddedItems[0] is ListBoxItem item) - { - if (item.Tag != null) - { - _regionManager.RequestNavigate("ContentRegion", item.Tag.ToString()); - } - } - - } - } -} diff --git a/CodeHubDesktop/ViewModels/LeftMainContentViewModel.cs b/CodeHubDesktop/ViewModels/LeftMainContentViewModel.cs index 132d7a7..eab5be1 100644 --- a/CodeHubDesktop/ViewModels/LeftMainContentViewModel.cs +++ b/CodeHubDesktop/ViewModels/LeftMainContentViewModel.cs @@ -1,45 +1,38 @@ -using MahApps.Metro.Controls; -using ModernWpf.MahApps.Controls; -using Prism.Commands; +using Prism.Commands; using Prism.Mvvm; using Prism.Regions; +using System.Windows.Controls; namespace CodeHubDesktop.ViewModels { public class LeftMainContentViewModel : BindableBase { private readonly IRegionManager _regionManager; - public DelegateCommand SwitchItemCmd { get; private set; } - public DelegateCommand SwitchItemOptionCmd { get; private set; } + + #region Command + public DelegateCommand SwitchItemCmd { get; private set; } + #endregion + public LeftMainContentViewModel(IRegionManager regionManager) { _regionManager = regionManager; - SwitchItemCmd = new DelegateCommand(Switch); - SwitchItemOptionCmd = new DelegateCommand(SwitchOption); + SwitchItemCmd = new DelegateCommand(Switch); } - private void SwitchOption(HamburgerMenuEx e) + private void Switch(SelectionChangedEventArgs e) { - if (e.SelectedOptionsItem is HamburgerMenuIconItem item) + if (e.AddedItems.Count == 0) { - NavigateToRegion(item.Tag.ToString()); + return; } - } - - private void Switch(HamburgerMenuEx e) - { - if (e.SelectedItem is HamburgerMenuIconItem item) + if (e.AddedItems[0] is ListBoxItem item) { - NavigateToRegion(item.Tag.ToString()); + if (item.Tag != null) + { + _regionManager.RequestNavigate("ContentRegion", item.Tag.ToString()); + } } - } - internal void NavigateToRegion(string tag) - { - if (tag != null) - { - _regionManager.RequestNavigate("ContentRegion", tag); - } } } } diff --git a/CodeHubDesktop/ViewModels/SnippetHistoryViewModel.cs b/CodeHubDesktop/ViewModels/SnippetHistoryViewModel.cs index 1a692eb..86889be 100644 --- a/CodeHubDesktop/ViewModels/SnippetHistoryViewModel.cs +++ b/CodeHubDesktop/ViewModels/SnippetHistoryViewModel.cs @@ -1,16 +1,11 @@ using CodeHubDesktop.Data.Services; using CodeHubDesktop.Models; -using HandyControl.Controls; -using HandyControl.Data; -using Newtonsoft.Json; using Prism.Commands; using Prism.Mvvm; using Prism.Services.Dialogs; using System; using System.Collections.ObjectModel; using System.ComponentModel; -using System.Net.Http; -using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Input; @@ -19,71 +14,6 @@ namespace CodeHubDesktop.ViewModels { public class SnippetHistoryViewModel : BindableBase { - #region OnlineSnipet - - private string _Error; - public string Error - { - get => _Error; - set => SetProperty(ref _Error, value); - } - private string _SearchText; - public string SearchText - { - get => _SearchText; - set => SetProperty(ref _SearchText, value); - } - - private string _SnippetLanguage; - public string SnippetLanguage - { - get => _SnippetLanguage; - set => SetProperty(ref _SnippetLanguage, value); - } - - private string _SnippetDate; - public string SnippetDate - { - get => _SnippetDate; - set => SetProperty(ref _SnippetDate, value); - } - - private string _SnippetUrl; - public string SnippetUrl - { - get => _SnippetUrl; - set => SetProperty(ref _SnippetUrl, value); - } - - private string _SnippetTitle; - public string SnippetTitle - { - get => _SnippetTitle; - set => SetProperty(ref _SnippetTitle, value); - } - private string _SnippetDetail; - public string SnippetDetail - { - get => _SnippetDetail; - set => SetProperty(ref _SnippetDetail, value); - } - - private string _SnippetScript; - public string SnippetScript - { - get => _SnippetScript; - set => SetProperty(ref _SnippetScript, value); - } - - private Visibility _PanelVisibility = Visibility.Hidden; - public Visibility PanelVisibility - { - get => _PanelVisibility; - set => SetProperty(ref _PanelVisibility, value); - } - public DelegateCommand> OnSearchStartedCommand { get; private set; } - - #endregion #region LocalSnippet private readonly IDialogService _dialogService; @@ -97,7 +27,6 @@ public bool IsEnabled get => _IsEnabled; set => SetProperty(ref _IsEnabled, value); } - public ICollectionView ItemsView => CollectionViewSource.GetDefaultView(Data); private ObservableCollection _data = new ObservableCollection(); public ObservableCollection Data @@ -109,9 +38,15 @@ public ObservableCollection Data public string LocalSearchText { get => _LocalSearchText; - set => SetProperty(ref _LocalSearchText, value); + set + { + SetProperty(ref _LocalSearchText, value); + ItemsView.Refresh(); + } } + public ICollectionView ItemsView => CollectionViewSource.GetDefaultView(Data); + public DelegateCommand DeleteCommand { get; set; } public DelegateCommand SelectionChangedCommand { get; set; } public DelegateCommand MouseDoubleClickCommand { get; set; } @@ -121,7 +56,6 @@ public SnippetHistoryViewModel(IDialogService dialogService) { _dialogService = dialogService; DeleteCommand = new DelegateCommand(OnDelete); - OnSearchStartedCommand = new DelegateCommand>(OnSearchStarted); SelectionChangedCommand = new DelegateCommand(OnSelectionChanged); MouseDoubleClickCommand = new DelegateCommand(OnMouseDoubleClick); initData(); @@ -168,44 +102,5 @@ private async void OnDelete() await dataService.DeleteSnippet(id); initData(); } - - private async void OnSearchStarted(FunctionEventArgs e) - { - try - { - PanelVisibility = Visibility.Hidden; - if (string.IsNullOrEmpty(SearchText)) - { - return; - } - string url = string.Empty; - if (SearchText.StartsWith("http")) - { - url = SearchText.Replace("snippet", "api/v1/snippet"); - } - else - { - url = GlobalData.Config.APIBaseAddress + SearchText; - } - using HttpClient client = new HttpClient(); - HttpResponseMessage response = await client.GetAsync(url); - response.EnsureSuccessStatusCode(); - string resp = await response.Content.ReadAsStringAsync(); - GetSnippetModel parse = JsonConvert.DeserializeObject(resp); - SnippetTitle = parse.title; - SnippetDetail = parse.detail; - SnippetDate = parse.pub_date; - SnippetScript = parse.script; - SnippetUrl = parse.link; - SnippetLanguage = parse.language; - Error = parse.error; - PanelVisibility = Visibility.Visible; - } - catch (Exception ex) - { - Growl.Error(ex.Message); - } - - } } } diff --git a/CodeHubDesktop/ViewModels/SnippetOnlineViewModel.cs b/CodeHubDesktop/ViewModels/SnippetOnlineViewModel.cs new file mode 100644 index 0000000..4d10078 --- /dev/null +++ b/CodeHubDesktop/ViewModels/SnippetOnlineViewModel.cs @@ -0,0 +1,124 @@ +using CodeHubDesktop.Models; +using HandyControl.Controls; +using HandyControl.Data; +using Newtonsoft.Json; +using Prism.Commands; +using Prism.Mvvm; +using System; +using System.Net.Http; +using System.Windows; + +namespace CodeHubDesktop.ViewModels +{ + public class SnippetOnlineViewModel : BindableBase + { + #region OnlineSnipet + + private string _Error; + public string Error + { + get => _Error; + set => SetProperty(ref _Error, value); + } + private string _SearchText; + public string SearchText + { + get => _SearchText; + set => SetProperty(ref _SearchText, value); + } + + private string _SnippetLanguage; + public string SnippetLanguage + { + get => _SnippetLanguage; + set => SetProperty(ref _SnippetLanguage, value); + } + + private string _SnippetDate; + public string SnippetDate + { + get => _SnippetDate; + set => SetProperty(ref _SnippetDate, value); + } + + private string _SnippetUrl; + public string SnippetUrl + { + get => _SnippetUrl; + set => SetProperty(ref _SnippetUrl, value); + } + + private string _SnippetTitle; + public string SnippetTitle + { + get => _SnippetTitle; + set => SetProperty(ref _SnippetTitle, value); + } + private string _SnippetDetail; + public string SnippetDetail + { + get => _SnippetDetail; + set => SetProperty(ref _SnippetDetail, value); + } + + private string _SnippetScript; + public string SnippetScript + { + get => _SnippetScript; + set => SetProperty(ref _SnippetScript, value); + } + + private Visibility _PanelVisibility = Visibility.Hidden; + public Visibility PanelVisibility + { + get => _PanelVisibility; + set => SetProperty(ref _PanelVisibility, value); + } + public DelegateCommand> OnSearchStartedCommand { get; private set; } + + #endregion + + public SnippetOnlineViewModel() + { + OnSearchStartedCommand = new DelegateCommand>(OnSearchStarted); + } + private async void OnSearchStarted(FunctionEventArgs e) + { + try + { + PanelVisibility = Visibility.Hidden; + if (string.IsNullOrEmpty(SearchText)) + { + return; + } + string url = string.Empty; + if (SearchText.StartsWith("http")) + { + url = SearchText.Replace("snippet", "api/v1/snippet"); + } + else + { + url = GlobalData.Config.APIBaseAddress + SearchText; + } + using HttpClient client = new HttpClient(); + HttpResponseMessage response = await client.GetAsync(url); + response.EnsureSuccessStatusCode(); + string resp = await response.Content.ReadAsStringAsync(); + GetSnippetModel parse = JsonConvert.DeserializeObject(resp); + SnippetTitle = parse.title; + SnippetDetail = parse.detail; + SnippetDate = parse.pub_date; + SnippetScript = parse.script; + SnippetUrl = parse.link; + SnippetLanguage = parse.language; + Error = parse.error; + PanelVisibility = Visibility.Visible; + } + catch (Exception ex) + { + Growl.Error(ex.Message); + } + + } + } +} diff --git a/CodeHubDesktop/Views/LeftMainContent.xaml b/CodeHubDesktop/Views/LeftMainContent.xaml index 56b6779..84b3331 100644 --- a/CodeHubDesktop/Views/LeftMainContent.xaml +++ b/CodeHubDesktop/Views/LeftMainContent.xaml @@ -1,56 +1,30 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/CodeHubDesktop/Views/LeftMainContent.xaml.cs b/CodeHubDesktop/Views/LeftMainContent.xaml.cs index be6b5f9..5ff7e06 100644 --- a/CodeHubDesktop/Views/LeftMainContent.xaml.cs +++ b/CodeHubDesktop/Views/LeftMainContent.xaml.cs @@ -1,11 +1,9 @@ -using System.Windows.Controls; - -namespace CodeHubDesktop.Views +namespace CodeHubDesktop.Views { /// /// Interaction logic for LeftMainContent /// - public partial class LeftMainContent : UserControl + public partial class LeftMainContent { public LeftMainContent() { diff --git a/CodeHubDesktop/Views/LeftMainContent2.xaml b/CodeHubDesktop/Views/LeftMainContent2.xaml deleted file mode 100644 index cc59606..0000000 --- a/CodeHubDesktop/Views/LeftMainContent2.xaml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/CodeHubDesktop/Views/LeftMainContent2.xaml.cs b/CodeHubDesktop/Views/LeftMainContent2.xaml.cs deleted file mode 100644 index c02ea92..0000000 --- a/CodeHubDesktop/Views/LeftMainContent2.xaml.cs +++ /dev/null @@ -1,13 +0,0 @@ -namespace CodeHubDesktop.Views -{ - /// - /// Interaction logic for LeftMainContent2 - /// - public partial class LeftMainContent2 - { - public LeftMainContent2() - { - InitializeComponent(); - } - } -} diff --git a/CodeHubDesktop/Views/MainWindow.xaml b/CodeHubDesktop/Views/MainWindow.xaml index 2d16949..b0ce082 100644 --- a/CodeHubDesktop/Views/MainWindow.xaml +++ b/CodeHubDesktop/Views/MainWindow.xaml @@ -5,8 +5,6 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:hc="https://handyorg.github.io/handycontrol" xmlns:prism="http://prismlibrary.com/" - xmlns:ui="http://schemas.modernwpf.com/2019" - xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls" prism:ViewModelLocator.AutoWireViewModel="True" xmlns:lang="clr-namespace:CodeHubDesktop.MultiLanguage.Language" xmlns:ext="clr-namespace:CodeHubDesktop.DynamicLanguage" @@ -28,30 +26,28 @@ - - - - - - - + + + + + + + + + - + @@ -59,11 +55,10 @@ - + - - + diff --git a/CodeHubDesktop/Views/MainWindow.xaml.cs b/CodeHubDesktop/Views/MainWindow.xaml.cs index 9b93c4f..c28a81a 100644 --- a/CodeHubDesktop/Views/MainWindow.xaml.cs +++ b/CodeHubDesktop/Views/MainWindow.xaml.cs @@ -13,7 +13,6 @@ public partial class MainWindow public MainWindow() { InitializeComponent(); - setLeftMain(); } #region Change Skin and Language @@ -63,36 +62,5 @@ private void ButtonLangs_OnClick(object sender, RoutedEventArgs e) } } #endregion - - private void ToggleButton_Checked(object sender, RoutedEventArgs e) - { - if (tg.IsChecked.Value) - { - left.Visibility = Visibility.Visible; - left2.Visibility = Visibility.Collapsed; - } - else - { - left.Visibility = Visibility.Collapsed; - left2.Visibility = Visibility.Visible; - } - GlobalData.Config.IsModernStyle = tg.IsChecked.Value; - GlobalData.Save(); - } - - internal void setLeftMain() - { - tg.IsChecked = GlobalData.Config.IsModernStyle; - if (GlobalData.Config.IsModernStyle) - { - left.Visibility = Visibility.Visible; - left2.Visibility = Visibility.Collapsed; - } - else - { - left.Visibility = Visibility.Collapsed; - left2.Visibility = Visibility.Visible; - } - } } } diff --git a/CodeHubDesktop/Views/Settings.xaml b/CodeHubDesktop/Views/Settings.xaml index 2d8029e..a4f5cf3 100644 --- a/CodeHubDesktop/Views/Settings.xaml +++ b/CodeHubDesktop/Views/Settings.xaml @@ -10,7 +10,7 @@ - + diff --git a/CodeHubDesktop/Views/Settings.xaml.cs b/CodeHubDesktop/Views/Settings.xaml.cs index cbc1d6b..a99422d 100644 --- a/CodeHubDesktop/Views/Settings.xaml.cs +++ b/CodeHubDesktop/Views/Settings.xaml.cs @@ -10,15 +10,6 @@ public partial class Settings : UserControl public Settings() { InitializeComponent(); - - if (GlobalData.Config.Lang.Equals("fa-IR")) - { - tg.HorizontalAlignment = System.Windows.HorizontalAlignment.Right; - } - else - { - tg.HorizontalAlignment = System.Windows.HorizontalAlignment.Left; - } } } } diff --git a/CodeHubDesktop/Views/SnippetHistory.xaml b/CodeHubDesktop/Views/SnippetHistory.xaml index 21f3e5f..bde9b5c 100644 --- a/CodeHubDesktop/Views/SnippetHistory.xaml +++ b/CodeHubDesktop/Views/SnippetHistory.xaml @@ -10,70 +10,39 @@ prism:ViewModelLocator.AutoWireViewModel="True"> - - - - - - - - - - - - - - - + + + + + + + + +