diff --git a/src/Library/Sucrose.Manager/Manage/Manager.cs b/src/Library/Sucrose.Manager/Manage/Manager.cs index c37965bb8..57d23db38 100644 --- a/src/Library/Sucrose.Manager/Manage/Manager.cs +++ b/src/Library/Sucrose.Manager/Manage/Manager.cs @@ -79,6 +79,8 @@ public static class Manager public static bool LibraryDelete => SMMI.LibrarySettingManager.GetSetting(SMC.LibraryDelete, false); + public static bool DeveloperMode => SMMI.EngineSettingManager.GetSetting(SMC.DeveloperMode, false); + public static bool VolumeDesktop => SMMI.EngineSettingManager.GetSetting(SMC.VolumeDesktop, false); public static List Themes => SMMI.ThemesManager.GetSetting(SMC.Themes, new List()); diff --git a/src/Library/Sucrose.Memory/Constant.cs b/src/Library/Sucrose.Memory/Constant.cs index 8123f9835..f4136d35b 100644 --- a/src/Library/Sucrose.Memory/Constant.cs +++ b/src/Library/Sucrose.Memory/Constant.cs @@ -100,6 +100,8 @@ public static class Constant public const string StoreDuration = "StoreDuration"; + public const string DeveloperMode = "DeveloperMode"; + public const string LibraryConfirm = "LibraryConfirm"; public const string AdaptiveLayout = "AdaptiveLayout"; diff --git a/src/Portal/Sucrose.Portal/ViewModels/Pages/Setting/OtherSettingViewModel.cs b/src/Portal/Sucrose.Portal/ViewModels/Pages/Setting/OtherSettingViewModel.cs index 35e356037..aef8917d2 100644 --- a/src/Portal/Sucrose.Portal/ViewModels/Pages/Setting/OtherSettingViewModel.cs +++ b/src/Portal/Sucrose.Portal/ViewModels/Pages/Setting/OtherSettingViewModel.cs @@ -201,6 +201,38 @@ private void InitializeViewModel() Contents.Add(Key); + TextBlock DeveloperArea = new() + { + Foreground = SSRER.GetResource("TextFillColorPrimaryBrush"), + Margin = new Thickness(0, 10, 0, 0), + FontWeight = FontWeights.Bold, + Text = "Geliştirici" + }; + + Contents.Add(DeveloperArea); + + SPVCEC Developer = new() + { + Margin = new Thickness(0, 10, 0, 0), + Expandable = false + }; + + Developer.Title.Text = "Geliştirici Araçları"; + Developer.LeftIcon.Symbol = SymbolRegular.WindowDevTools24; + Developer.Description.Text = "WebView ve CefSharp motoru için geliştirici araçlarının gösterilip gösterilmeyeceği."; + + ToggleSwitch DeveloperState = new() + { + IsChecked = SMMM.DeveloperMode + }; + + DeveloperState.Checked += (s, e) => DeveloperStateChecked(true); + DeveloperState.Unchecked += (s, e) => DeveloperStateChecked(false); + + Developer.HeaderFrame = DeveloperState; + + Contents.Add(Developer); + _isInitialized = true; } @@ -234,6 +266,11 @@ private void UserAgentChanged(TextBox TextBox) SMMI.GeneralSettingManager.SetSetting(SMC.UserAgent, TextBox.Text); } + private void DeveloperStateChecked(bool State) + { + SMMI.EngineSettingManager.SetSetting(SMC.DeveloperMode, State); + } + private void DiscordDelayChanged(double? Value) { int NewValue = Convert.ToInt32(Value); diff --git a/src/Portal/Sucrose.Portal/ViewModels/Pages/Setting/PerformanceSettingViewModel.cs b/src/Portal/Sucrose.Portal/ViewModels/Pages/Setting/PerformanceSettingViewModel.cs index 4823811fe..f9505bb2f 100644 --- a/src/Portal/Sucrose.Portal/ViewModels/Pages/Setting/PerformanceSettingViewModel.cs +++ b/src/Portal/Sucrose.Portal/ViewModels/Pages/Setting/PerformanceSettingViewModel.cs @@ -249,15 +249,26 @@ private void InitializeViewModel() MaxWidth = 700 }; - NetworkAdapter.SelectionChanged += (s, e) => NetworkAdapterSelected($"{NetworkAdapter.SelectedValue}"); + if (SMMM.NetworkInterfaces.Any()) + { + NetworkAdapter.SelectionChanged += (s, e) => NetworkAdapterSelected($"{NetworkAdapter.SelectedValue}"); + + foreach (string Interface in SMMM.NetworkInterfaces) + { + NetworkAdapter.Items.Add(Interface); + } - foreach (string Interface in SMMM.NetworkInterfaces) + NetworkAdapter.SelectedValue = SMMM.NetworkAdapter; + } + else { - NetworkAdapter.Items.Add(Interface); + NetworkAdapter.Items.Add(new ComboBoxItem() + { + Content = "Ağ adaptörleri listesi henüz oluşturulmadı", + IsSelected = true + }); } - NetworkAdapter.SelectedValue = SMMM.NetworkAdapter; - StackPanel NetworkUploadContent = new() { Orientation = Orientation.Horizontal, diff --git a/src/Shared/Engine/Sucrose.Shared.Engine.CefSharp/Event/Url.cs b/src/Shared/Engine/Sucrose.Shared.Engine.CefSharp/Event/Url.cs index bec220350..a02281eec 100644 --- a/src/Shared/Engine/Sucrose.Shared.Engine.CefSharp/Event/Url.cs +++ b/src/Shared/Engine/Sucrose.Shared.Engine.CefSharp/Event/Url.cs @@ -1,5 +1,6 @@ using CefSharp; using System.Windows; +using SMMM = Sucrose.Manager.Manage.Manager; using SSECSHM = Sucrose.Shared.Engine.CefSharp.Helper.Management; using SSECSMI = Sucrose.Shared.Engine.CefSharp.Manage.Internal; using SSEMI = Sucrose.Shared.Engine.Manage.Internal; @@ -27,7 +28,10 @@ public static void CefEngineLoaded(object sender, RoutedEventArgs e) { SSECSMI.CefEngine.Address = SSECSMI.Url; - //SSECSMI.CefEngine.ShowDevTools(); + if (SMMM.DeveloperMode) + { + SSECSMI.CefEngine.ShowDevTools(); + } } } } \ No newline at end of file diff --git a/src/Shared/Engine/Sucrose.Shared.Engine.CefSharp/Event/Video.cs b/src/Shared/Engine/Sucrose.Shared.Engine.CefSharp/Event/Video.cs index b3a353112..44baaf857 100644 --- a/src/Shared/Engine/Sucrose.Shared.Engine.CefSharp/Event/Video.cs +++ b/src/Shared/Engine/Sucrose.Shared.Engine.CefSharp/Event/Video.cs @@ -1,5 +1,6 @@ using CefSharp; using System.Windows; +using SMMM = Sucrose.Manager.Manage.Manager; using SSECSHV = Sucrose.Shared.Engine.CefSharp.Helper.Video; using SSECSMI = Sucrose.Shared.Engine.CefSharp.Manage.Internal; using SSEHD = Sucrose.Shared.Engine.Helper.Data; @@ -29,7 +30,10 @@ public static void CefEngineFrameLoadEnd(object sender, FrameLoadEndEventArgs e) public static void CefEngineLoaded(object sender, RoutedEventArgs e) { - //SSECSMI.CefEngine.ShowDevTools(); + if (SMMM.DeveloperMode) + { + SSECSMI.CefEngine.ShowDevTools(); + } } } } \ No newline at end of file diff --git a/src/Shared/Engine/Sucrose.Shared.Engine.CefSharp/Event/Web.cs b/src/Shared/Engine/Sucrose.Shared.Engine.CefSharp/Event/Web.cs index 7b8c5ea13..e153aeb05 100644 --- a/src/Shared/Engine/Sucrose.Shared.Engine.CefSharp/Event/Web.cs +++ b/src/Shared/Engine/Sucrose.Shared.Engine.CefSharp/Event/Web.cs @@ -1,5 +1,6 @@ using CefSharp; using System.Windows; +using SMMM = Sucrose.Manager.Manage.Manager; using SSECSHW = Sucrose.Shared.Engine.CefSharp.Helper.Web; using SSECSMI = Sucrose.Shared.Engine.CefSharp.Manage.Internal; using SSEHP = Sucrose.Shared.Engine.Helper.Properties; @@ -28,7 +29,10 @@ public static void CefEngineLoaded(object sender, RoutedEventArgs e) { SSECSMI.CefEngine.Address = SSEHS.GetSource(SSECSMI.Web).ToString(); - //SSECSMI.CefEngine.ShowDevTools(); + if (SMMM.DeveloperMode) + { + SSECSMI.CefEngine.ShowDevTools(); + } } } } \ No newline at end of file diff --git a/src/Shared/Engine/Sucrose.Shared.Engine.CefSharp/Event/YouTube.cs b/src/Shared/Engine/Sucrose.Shared.Engine.CefSharp/Event/YouTube.cs index c9bf9654c..359fc1a60 100644 --- a/src/Shared/Engine/Sucrose.Shared.Engine.CefSharp/Event/YouTube.cs +++ b/src/Shared/Engine/Sucrose.Shared.Engine.CefSharp/Event/YouTube.cs @@ -1,5 +1,6 @@ using CefSharp; using System.Windows; +using SMMM = Sucrose.Manager.Manage.Manager; using SSECSMI = Sucrose.Shared.Engine.CefSharp.Manage.Internal; using SSEHD = Sucrose.Shared.Engine.Helper.Data; using SSEHS = Sucrose.Shared.Engine.Helper.Source; @@ -32,7 +33,10 @@ public static void CefEngineLoaded(object sender, RoutedEventArgs e) SSECSMI.CefEngine.Address = SSEHS.GetSource(Path).ToString(); - //SSECSMI.CefEngine.ShowDevTools(); + if (SMMM.DeveloperMode) + { + SSECSMI.CefEngine.ShowDevTools(); + } } } } \ No newline at end of file diff --git a/src/Shared/Engine/Sucrose.Shared.Engine.WebView/Event/Url.cs b/src/Shared/Engine/Sucrose.Shared.Engine.WebView/Event/Url.cs index 54bb8c6e0..55f595ebd 100644 --- a/src/Shared/Engine/Sucrose.Shared.Engine.WebView/Event/Url.cs +++ b/src/Shared/Engine/Sucrose.Shared.Engine.WebView/Event/Url.cs @@ -29,7 +29,10 @@ public static void WebEngineInitializationCompleted(object sender, CoreWebView2I SSEWVMI.WebEngine.CoreWebView2.ContentLoading += WebEngineContentLoading; SSEWVMI.WebEngine.CoreWebView2.DOMContentLoaded += WebEngineDOMContentLoaded; - //SSEWVMI.WebEngine.CoreWebView2.OpenDevToolsWindow(); + if (SMMM.DeveloperMode) + { + SSEWVMI.WebEngine.CoreWebView2.OpenDevToolsWindow(); + } } } } \ No newline at end of file diff --git a/src/Shared/Engine/Sucrose.Shared.Engine.WebView/Event/Video.cs b/src/Shared/Engine/Sucrose.Shared.Engine.WebView/Event/Video.cs index 314ddb483..a2312bc31 100644 --- a/src/Shared/Engine/Sucrose.Shared.Engine.WebView/Event/Video.cs +++ b/src/Shared/Engine/Sucrose.Shared.Engine.WebView/Event/Video.cs @@ -43,7 +43,10 @@ public static void WebEngineInitializationCompleted(object sender, CoreWebView2I SSEWVMI.WebEngine.CoreWebView2.DOMContentLoaded += WebEngineDOMContentLoaded; - //SSEWVMI.WebEngine.CoreWebView2.OpenDevToolsWindow(); + if (SMMM.DeveloperMode) + { + SSEWVMI.WebEngine.CoreWebView2.OpenDevToolsWindow(); + } } } } \ No newline at end of file diff --git a/src/Shared/Engine/Sucrose.Shared.Engine.WebView/Event/Web.cs b/src/Shared/Engine/Sucrose.Shared.Engine.WebView/Event/Web.cs index 9ab00e451..8289dce92 100644 --- a/src/Shared/Engine/Sucrose.Shared.Engine.WebView/Event/Web.cs +++ b/src/Shared/Engine/Sucrose.Shared.Engine.WebView/Event/Web.cs @@ -30,7 +30,10 @@ public static void WebEngineInitializationCompleted(object sender, CoreWebView2I SSEWVMI.WebEngine.CoreWebView2.DOMContentLoaded += WebEngineDOMContentLoaded; - //SSEWVMI.WebEngine.CoreWebView2.OpenDevToolsWindow(); + if (SMMM.DeveloperMode) + { + SSEWVMI.WebEngine.CoreWebView2.OpenDevToolsWindow(); + } } } } \ No newline at end of file diff --git a/src/Shared/Engine/Sucrose.Shared.Engine.WebView/Event/YouTube.cs b/src/Shared/Engine/Sucrose.Shared.Engine.WebView/Event/YouTube.cs index 62a0eaebc..7ca9782fe 100644 --- a/src/Shared/Engine/Sucrose.Shared.Engine.WebView/Event/YouTube.cs +++ b/src/Shared/Engine/Sucrose.Shared.Engine.WebView/Event/YouTube.cs @@ -33,7 +33,10 @@ public static void WebEngineInitializationCompleted(object sender, CoreWebView2I SSEWVMI.WebEngine.CoreWebView2.DOMContentLoaded += WebEngineDOMContentLoaded; - //SSEWVMI.WebEngine.CoreWebView2.OpenDevToolsWindow(); + if (SMMM.DeveloperMode) + { + SSEWVMI.WebEngine.CoreWebView2.OpenDevToolsWindow(); + } } } } \ No newline at end of file