Skip to content

Commit

Permalink
Preparing Other Setting Page
Browse files Browse the repository at this point in the history
  • Loading branch information
Taiizor committed Sep 23, 2023
1 parent a956465 commit aaf0004
Show file tree
Hide file tree
Showing 12 changed files with 93 additions and 13 deletions.
2 changes: 2 additions & 0 deletions src/Library/Sucrose.Manager/Manage/Manager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<string> Themes => SMMI.ThemesManager.GetSetting(SMC.Themes, new List<string>());
Expand Down
2 changes: 2 additions & 0 deletions src/Library/Sucrose.Memory/Constant.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,38 @@ private void InitializeViewModel()

Contents.Add(Key);

TextBlock DeveloperArea = new()
{
Foreground = SSRER.GetResource<Brush>("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;
}

Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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();
}
}
}
}
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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();
}
}
}
}
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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();
}
}
}
}
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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();
}
}
}
}
5 changes: 4 additions & 1 deletion src/Shared/Engine/Sucrose.Shared.Engine.WebView/Event/Url.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
}
}
5 changes: 4 additions & 1 deletion src/Shared/Engine/Sucrose.Shared.Engine.WebView/Event/Web.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
}
}

0 comments on commit aaf0004

Please sign in to comment.