WIP: main form ui
This commit is contained in:
parent
f58608fc23
commit
d575c66ed9
@ -49,6 +49,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Remove="Models\BookmarkItemModel.cs" />
|
||||
<Compile Remove="Models\TileGroupModel.cs" />
|
||||
<Compile Remove="Models\TileModel.cs" />
|
||||
<Compile Remove="NewForm.cs" />
|
||||
|
@ -62,7 +62,7 @@ namespace BookmarkManager
|
||||
}
|
||||
}
|
||||
|
||||
treeview.SetNoChanges();
|
||||
//treeview.SetNoChanges();
|
||||
|
||||
return Result.Create(true);
|
||||
}
|
||||
|
194
MainForm.cs
194
MainForm.cs
@ -1,5 +1,6 @@
|
||||
using BookmarkManager;
|
||||
using FizzyLauncher.Models;
|
||||
using Newtonsoft.Json;
|
||||
using RyzStudio.Windows.Forms;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -29,6 +30,8 @@ namespace FizzyLauncher
|
||||
protected string sessionPassword = null;
|
||||
protected bool isBusy = false;
|
||||
|
||||
protected readonly string jsonfigFilename;
|
||||
|
||||
|
||||
public MainForm()
|
||||
{
|
||||
@ -39,35 +42,34 @@ namespace FizzyLauncher
|
||||
this.ClientSize = new System.Drawing.Size(300, 580);
|
||||
//this.Visible = false;
|
||||
|
||||
ApplicationMode = AppMode.Clear;
|
||||
jsonfigFilename = Path.ChangeExtension(Application.ExecutablePath, "jsonfig");
|
||||
|
||||
treeView1.OnNodeChanged += treeView1_OnNodeChanged;
|
||||
treeView1.NodeMouseClick += treeView1_NodeMouseClick;
|
||||
}
|
||||
|
||||
|
||||
protected override void OnLoad(EventArgs e)
|
||||
{
|
||||
base.OnLoad(e);
|
||||
|
||||
//ThreadControl.SetVisible(this, false);
|
||||
ThreadControl.SetSize(this, 300, 580);
|
||||
|
||||
ApplicationMode = AppMode.Clear;
|
||||
}
|
||||
|
||||
//protected async override void OnShown(EventArgs e)
|
||||
//{
|
||||
// base.OnShown(e);
|
||||
protected async override void OnShown(EventArgs e)
|
||||
{
|
||||
base.OnShown(e);
|
||||
|
||||
//ThreadControl.SetVisible(this, false);
|
||||
|
||||
//string jsonfigFilename = Path.ChangeExtension(Application.ExecutablePath, "jsonfig");
|
||||
//if (File.Exists(jsonfigFilename))
|
||||
//{
|
||||
// await loadFile(jsonfigFilename);
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// this.CurrentSession = new LauncherSession();
|
||||
await LoadAppSession(jsonfigFilename);
|
||||
|
||||
// ThreadControl.SetVisible(this, true);
|
||||
//}
|
||||
//}
|
||||
InvalidateAppSession();
|
||||
|
||||
}
|
||||
|
||||
protected async override void OnClosing(CancelEventArgs e)
|
||||
{
|
||||
@ -83,7 +85,11 @@ namespace FizzyLauncher
|
||||
Result result = await CloseFile();
|
||||
if (!result.IsSuccess)
|
||||
{
|
||||
MessageBox.Show(result.Message, "Close", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
if (!string.IsNullOrWhiteSpace(result.Message))
|
||||
{
|
||||
MessageBox.Show(result.Message, "Close", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
this.IsBusy = false;
|
||||
|
||||
e.Cancel = true;
|
||||
@ -103,7 +109,7 @@ namespace FizzyLauncher
|
||||
Application.Exit();
|
||||
}
|
||||
|
||||
public LauncherSession CurrentSession { get; set; } = null;
|
||||
public AppSession CurrentSession { get; set; } = null;
|
||||
|
||||
public bool IsBusy
|
||||
{
|
||||
@ -188,7 +194,11 @@ namespace FizzyLauncher
|
||||
Result result = await CloseFile();
|
||||
if (!result.IsSuccess)
|
||||
{
|
||||
MessageBox.Show(result.Message, "New Session", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
if (!string.IsNullOrWhiteSpace(result.Message))
|
||||
{
|
||||
MessageBox.Show(result.Message, "New Session", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
this.IsBusy = false;
|
||||
return;
|
||||
}
|
||||
@ -220,7 +230,11 @@ namespace FizzyLauncher
|
||||
Result result = await CloseFile();
|
||||
if (!result.IsSuccess)
|
||||
{
|
||||
MessageBox.Show(result.Message, "Open File", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
if (!string.IsNullOrWhiteSpace(result.Message))
|
||||
{
|
||||
MessageBox.Show(result.Message, "Open File", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
this.IsBusy = false;
|
||||
return;
|
||||
}
|
||||
@ -258,7 +272,11 @@ namespace FizzyLauncher
|
||||
Result result = await CloseFile();
|
||||
if (!result.IsSuccess)
|
||||
{
|
||||
MessageBox.Show(result.Message, "Close File", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
if (!string.IsNullOrWhiteSpace(result.Message))
|
||||
{
|
||||
MessageBox.Show(result.Message, "Close File", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
this.IsBusy = false;
|
||||
return;
|
||||
}
|
||||
@ -425,7 +443,7 @@ namespace FizzyLauncher
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void optionsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
private async void optionsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (this.IsBusy)
|
||||
{
|
||||
@ -433,9 +451,12 @@ namespace FizzyLauncher
|
||||
}
|
||||
|
||||
if (optionsForm == null) optionsForm = new OptionsForm(this);
|
||||
optionsForm.ShowDialog();
|
||||
if (optionsForm.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
await SaveAppSession(jsonfigFilename);
|
||||
}
|
||||
|
||||
//invalidateHotKey();
|
||||
InvalidateAppSession();
|
||||
}
|
||||
|
||||
|
||||
@ -469,6 +490,122 @@ namespace FizzyLauncher
|
||||
#endregion
|
||||
|
||||
|
||||
private void treeView1_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
|
||||
{
|
||||
if (e.Button != MouseButtons.Right)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
switch (treeView1.GetNodeType())
|
||||
{
|
||||
case BookmarkTreeView.NodeType.Root:
|
||||
//rootTreeNodeMenu.Show(e.Node.TreeView, e.X, e.Y);
|
||||
break;
|
||||
case BookmarkTreeView.NodeType.Folder:
|
||||
//folderTreeNodeMenu.Show(e.Node.TreeView, e.X, e.Y);
|
||||
break;
|
||||
case BookmarkTreeView.NodeType.Page:
|
||||
//pageTreeNodeMenu.Show(e.Node.TreeView, e.X, e.Y);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void treeView1_OnNodeChanged(object sender, EventArgs e)
|
||||
{
|
||||
ThreadControl.SetEnable(saveToolStripMenuItem, (treeView1.HasChanged && ApplicationMode == AppMode.Open));
|
||||
}
|
||||
|
||||
protected void InvalidateAppSession()
|
||||
{
|
||||
if (CurrentSession == null) CurrentSession = new AppSession();
|
||||
|
||||
if (CurrentSession.EnableAutoPosition)
|
||||
{
|
||||
this.Height = Screen.PrimaryScreen.WorkingArea.Height;
|
||||
this.Location = Screen.PrimaryScreen.WorkingArea.Location;
|
||||
}
|
||||
|
||||
this.TopMost = CurrentSession.AlwaysOnTop;
|
||||
}
|
||||
|
||||
protected async Task<bool> LoadAppSession(string filename)
|
||||
{
|
||||
return await Task.Run(() =>
|
||||
{
|
||||
if (File.Exists(filename))
|
||||
{
|
||||
string sourceCode = null;
|
||||
|
||||
try
|
||||
{
|
||||
sourceCode = File.ReadAllText(filename);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(sourceCode))
|
||||
{
|
||||
this.CurrentSession = new AppSession();
|
||||
return false;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
this.CurrentSession = JsonConvert.DeserializeObject<AppSession>(sourceCode);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
this.CurrentSession = null;
|
||||
}
|
||||
|
||||
if (this.CurrentSession == null)
|
||||
{
|
||||
this.CurrentSession = new AppSession();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.CurrentSession = new AppSession();
|
||||
|
||||
try
|
||||
{
|
||||
File.WriteAllText(filename, JsonConvert.SerializeObject(this.CurrentSession));
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
protected async Task<bool> SaveAppSession(string filename)
|
||||
{
|
||||
return await Task.Run(() =>
|
||||
{
|
||||
if (this.CurrentSession == null) this.CurrentSession = new AppSession();
|
||||
|
||||
try
|
||||
{
|
||||
File.WriteAllText(filename, JsonConvert.SerializeObject(this.CurrentSession));
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
protected async Task<Result> CloseFile()
|
||||
{
|
||||
return await Task.Run<Result>(async () =>
|
||||
@ -496,7 +633,7 @@ namespace FizzyLauncher
|
||||
}
|
||||
else if (response == DialogResult.Cancel)
|
||||
{
|
||||
return Result.Create(false, "User cancelled");
|
||||
return Result.Create(false, "");
|
||||
}
|
||||
}
|
||||
else if (this.ApplicationMode == AppMode.Open)
|
||||
@ -512,7 +649,7 @@ namespace FizzyLauncher
|
||||
}
|
||||
else if (response == DialogResult.Cancel)
|
||||
{
|
||||
return Result.Create(false, "User cancelled");
|
||||
return Result.Create(false, "");
|
||||
}
|
||||
}
|
||||
|
||||
@ -594,6 +731,13 @@ namespace FizzyLauncher
|
||||
|
||||
ApplicationMode = AppMode.Open;
|
||||
|
||||
if (result.IsSuccess)
|
||||
{
|
||||
treeView1.SetNoChanges();
|
||||
}
|
||||
|
||||
ThreadControl.SetFocus(treeView1);
|
||||
|
||||
return result;
|
||||
});
|
||||
}
|
||||
|
22
Models/AppSession.cs
Normal file
22
Models/AppSession.cs
Normal file
@ -0,0 +1,22 @@
|
||||
namespace FizzyLauncher.Models
|
||||
{
|
||||
public class AppSession
|
||||
{
|
||||
public enum AutoSaveOption
|
||||
{
|
||||
Prompt = 0,
|
||||
Yes,
|
||||
No
|
||||
}
|
||||
|
||||
|
||||
public bool EnableAutoPosition { get; set; } = true;
|
||||
|
||||
public bool AlwaysOnTop { get; set; } = false;
|
||||
|
||||
public AutoSaveOption AutoSave { get; set; } = AutoSaveOption.Prompt;
|
||||
|
||||
public string RunCommand { get; set; } = "{0}";
|
||||
|
||||
}
|
||||
}
|
@ -11,17 +11,17 @@ namespace bzit.bomg.Models
|
||||
public string FaviconAddress { get; set; }
|
||||
public string TreeviewPath { get; set; }
|
||||
|
||||
public BookmarkItemModel ToModel()
|
||||
{
|
||||
return new BookmarkItemModel()
|
||||
{
|
||||
SiteName = this.SiteName,
|
||||
SiteAddress = this.SiteAddress,
|
||||
SiteDescription = this.SiteDescription,
|
||||
FaviconAddress = this.FaviconAddress,
|
||||
TreeviewPath = this.TreeviewPath
|
||||
};
|
||||
}
|
||||
//public BookmarkItemModel ToModel()
|
||||
//{
|
||||
// return new BookmarkItemModel()
|
||||
// {
|
||||
// SiteName = this.SiteName,
|
||||
// SiteAddress = this.SiteAddress,
|
||||
// SiteDescription = this.SiteDescription,
|
||||
// FaviconAddress = this.FaviconAddress,
|
||||
// TreeviewPath = this.TreeviewPath
|
||||
// };
|
||||
//}
|
||||
|
||||
public new string ToString()
|
||||
{
|
||||
|
@ -1,42 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
|
||||
namespace FizzyLauncher.Models
|
||||
{
|
||||
public class LauncherSession
|
||||
{
|
||||
public class HotKeyOptions
|
||||
{
|
||||
public bool IsCtrl { get; set; } = false;
|
||||
public bool IsAlt { get; set; } = false;
|
||||
public bool IsShift { get; set; } = false;
|
||||
public int Key { get; set; } = (int)System.Windows.Forms.Keys.None;
|
||||
|
||||
public int ModifierCode => ((this.IsAlt ? 1 : 0) + (this.IsCtrl ? 2 : 0) + (this.IsShift ? 4 : 0));
|
||||
|
||||
public System.Windows.Forms.Keys KeyCode => (System.Windows.Forms.Keys)this.Key;
|
||||
}
|
||||
|
||||
public enum AutoSaveOption
|
||||
{
|
||||
Prompt = 0,
|
||||
Yes,
|
||||
No
|
||||
}
|
||||
|
||||
public int DefaultHeight { get; set; } = 280;
|
||||
public HotKeyOptions HotKey { get; set; } = null;
|
||||
|
||||
public bool AlwaysOnTop { get; set; } = false;
|
||||
public bool EnableAnimation { get; set; } = false;
|
||||
public bool EnableBigIconInFolder { get; set; } = false;
|
||||
|
||||
public bool HideOnClose { get; set; } = false;
|
||||
public bool HideOnClick { get; set; } = false;
|
||||
public AutoSaveOption AutoSave { get; set; } = AutoSaveOption.Prompt;
|
||||
//public List<TileGroupModel> Groups { get; set; } = new List<TileGroupModel>();
|
||||
|
||||
public Point StartPosition { get; set; } = Point.Empty;
|
||||
|
||||
}
|
||||
}
|
211
OptionsForm.cs
211
OptionsForm.cs
@ -1,4 +1,5 @@
|
||||
using FizzyLauncher.Models;
|
||||
using System.Windows.Forms;
|
||||
using RyzStudio.Windows.ThemedForms;
|
||||
using System;
|
||||
|
||||
@ -8,14 +9,19 @@ namespace FizzyLauncher
|
||||
{
|
||||
private System.Windows.Forms.Label label1;
|
||||
private TButton button1;
|
||||
private TYesNoPickerBox pickerBox2;
|
||||
private TYesNoPickerBox pickerBox1;
|
||||
private System.Windows.Forms.Label label6;
|
||||
private TYesNoPickerBox pickerBox3;
|
||||
private TYesNoPickerBox pickerBox2;
|
||||
private System.Windows.Forms.Label label7;
|
||||
private System.Windows.Forms.Label label8;
|
||||
private TPickerBox pickerBox1;
|
||||
private TPickerBox pickerBox3;
|
||||
private RyzStudio.Windows.Forms.THorizontalSeparator tHorizontalSeparator1;
|
||||
private TKeyCodeTextBox textBox1;
|
||||
private RyzStudio.Windows.Forms.THorizontalSeparator tHorizontalSeparator3;
|
||||
private TTextBox textBox1;
|
||||
private RyzStudio.Windows.Forms.THorizontalSeparator tHorizontalSeparator2;
|
||||
|
||||
|
||||
protected MainForm parentForm = null;
|
||||
|
||||
|
||||
public OptionsForm(MainForm parent) : base()
|
||||
@ -24,30 +30,30 @@ namespace FizzyLauncher
|
||||
|
||||
parentForm = parent;
|
||||
|
||||
pickerBox1.ComboBox.Items.Clear();
|
||||
foreach (string item in Enum.GetNames(typeof(LauncherSession.AutoSaveOption)))
|
||||
pickerBox3.ComboBox.Items.Clear();
|
||||
foreach (string item in Enum.GetNames(typeof(AppSession.AutoSaveOption)))
|
||||
{
|
||||
pickerBox1.ComboBox.Items.Add(item);
|
||||
pickerBox3.ComboBox.Items.Add(item);
|
||||
}
|
||||
|
||||
if (pickerBox1.ComboBox.Items.Count > 0) pickerBox1.ComboBox.SelectedIndex = 0;
|
||||
if (pickerBox3.ComboBox.Items.Count > 0) pickerBox3.ComboBox.SelectedIndex = 0;
|
||||
|
||||
}
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(OptionsForm));
|
||||
RyzStudio.Windows.ThemedForms.TKeyCodeTextBox.Results results1 = new RyzStudio.Windows.ThemedForms.TKeyCodeTextBox.Results();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.button1 = new RyzStudio.Windows.ThemedForms.TButton();
|
||||
this.pickerBox2 = new RyzStudio.Windows.ThemedForms.TYesNoPickerBox();
|
||||
this.pickerBox1 = new RyzStudio.Windows.ThemedForms.TYesNoPickerBox();
|
||||
this.label6 = new System.Windows.Forms.Label();
|
||||
this.pickerBox3 = new RyzStudio.Windows.ThemedForms.TYesNoPickerBox();
|
||||
this.pickerBox2 = new RyzStudio.Windows.ThemedForms.TYesNoPickerBox();
|
||||
this.label7 = new System.Windows.Forms.Label();
|
||||
this.label8 = new System.Windows.Forms.Label();
|
||||
this.pickerBox1 = new RyzStudio.Windows.ThemedForms.TPickerBox();
|
||||
this.pickerBox3 = new RyzStudio.Windows.ThemedForms.TPickerBox();
|
||||
this.tHorizontalSeparator1 = new RyzStudio.Windows.Forms.THorizontalSeparator();
|
||||
this.textBox1 = new RyzStudio.Windows.ThemedForms.TKeyCodeTextBox();
|
||||
this.tHorizontalSeparator2 = new RyzStudio.Windows.Forms.THorizontalSeparator();
|
||||
this.tHorizontalSeparator3 = new RyzStudio.Windows.Forms.THorizontalSeparator();
|
||||
this.textBox1 = new RyzStudio.Windows.ThemedForms.TTextBox();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// label1
|
||||
@ -55,13 +61,13 @@ namespace FizzyLauncher
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.BackColor = System.Drawing.Color.Transparent;
|
||||
this.label1.ForeColor = System.Drawing.SystemColors.ControlText;
|
||||
this.label1.Location = new System.Drawing.Point(10, 21);
|
||||
this.label1.Location = new System.Drawing.Point(10, 193);
|
||||
this.label1.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Padding = new System.Windows.Forms.Padding(0, 9, 0, 10);
|
||||
this.label1.Size = new System.Drawing.Size(107, 34);
|
||||
this.label1.Size = new System.Drawing.Size(109, 34);
|
||||
this.label1.TabIndex = 153;
|
||||
this.label1.Text = "Show/Hide Hotkey";
|
||||
this.label1.Text = "Custom Command";
|
||||
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// button1
|
||||
@ -81,60 +87,60 @@ namespace FizzyLauncher
|
||||
this.button1.TabIndex = 173;
|
||||
this.button1.Click += new System.EventHandler(this.button1_Click);
|
||||
//
|
||||
// pickerBox2
|
||||
// pickerBox1
|
||||
//
|
||||
this.pickerBox2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.pickerBox2.BackColor = System.Drawing.Color.Transparent;
|
||||
this.pickerBox2.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||
this.pickerBox2.Location = new System.Drawing.Point(285, 103);
|
||||
this.pickerBox2.Margin = new System.Windows.Forms.Padding(10, 4, 10, 4);
|
||||
this.pickerBox2.Name = "pickerBox2";
|
||||
this.pickerBox2.Padding = new System.Windows.Forms.Padding(10, 6, 7, 5);
|
||||
this.pickerBox2.Size = new System.Drawing.Size(84, 34);
|
||||
this.pickerBox2.SubmitButton = null;
|
||||
this.pickerBox2.TabIndex = 183;
|
||||
this.pickerBox2.Value = true;
|
||||
this.pickerBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.pickerBox1.BackColor = System.Drawing.Color.Transparent;
|
||||
this.pickerBox1.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||
this.pickerBox1.Location = new System.Drawing.Point(285, 85);
|
||||
this.pickerBox1.Margin = new System.Windows.Forms.Padding(10, 4, 10, 4);
|
||||
this.pickerBox1.Name = "pickerBox1";
|
||||
this.pickerBox1.Padding = new System.Windows.Forms.Padding(10, 6, 7, 5);
|
||||
this.pickerBox1.Size = new System.Drawing.Size(84, 34);
|
||||
this.pickerBox1.SubmitButton = null;
|
||||
this.pickerBox1.TabIndex = 183;
|
||||
this.pickerBox1.Value = true;
|
||||
//
|
||||
// label6
|
||||
//
|
||||
this.label6.AutoSize = true;
|
||||
this.label6.BackColor = System.Drawing.Color.Transparent;
|
||||
this.label6.ForeColor = System.Drawing.SystemColors.ControlText;
|
||||
this.label6.Location = new System.Drawing.Point(10, 103);
|
||||
this.label6.Location = new System.Drawing.Point(10, 85);
|
||||
this.label6.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.label6.Name = "label6";
|
||||
this.label6.Padding = new System.Windows.Forms.Padding(0, 9, 0, 10);
|
||||
this.label6.Size = new System.Drawing.Size(83, 34);
|
||||
this.label6.Size = new System.Drawing.Size(145, 34);
|
||||
this.label6.TabIndex = 182;
|
||||
this.label6.Text = "Hide On Close";
|
||||
this.label6.Text = "Auto Position On Start-Up";
|
||||
this.label6.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// pickerBox3
|
||||
// pickerBox2
|
||||
//
|
||||
this.pickerBox3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.pickerBox3.BackColor = System.Drawing.Color.Transparent;
|
||||
this.pickerBox3.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||
this.pickerBox3.Location = new System.Drawing.Point(285, 144);
|
||||
this.pickerBox3.Margin = new System.Windows.Forms.Padding(10, 4, 10, 4);
|
||||
this.pickerBox3.Name = "pickerBox3";
|
||||
this.pickerBox3.Padding = new System.Windows.Forms.Padding(10, 6, 7, 5);
|
||||
this.pickerBox3.Size = new System.Drawing.Size(84, 34);
|
||||
this.pickerBox3.SubmitButton = null;
|
||||
this.pickerBox3.TabIndex = 185;
|
||||
this.pickerBox3.Value = true;
|
||||
this.pickerBox2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.pickerBox2.BackColor = System.Drawing.Color.Transparent;
|
||||
this.pickerBox2.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||
this.pickerBox2.Location = new System.Drawing.Point(285, 126);
|
||||
this.pickerBox2.Margin = new System.Windows.Forms.Padding(10, 4, 10, 4);
|
||||
this.pickerBox2.Name = "pickerBox2";
|
||||
this.pickerBox2.Padding = new System.Windows.Forms.Padding(10, 6, 7, 5);
|
||||
this.pickerBox2.Size = new System.Drawing.Size(84, 34);
|
||||
this.pickerBox2.SubmitButton = null;
|
||||
this.pickerBox2.TabIndex = 185;
|
||||
this.pickerBox2.Value = true;
|
||||
//
|
||||
// label7
|
||||
//
|
||||
this.label7.AutoSize = true;
|
||||
this.label7.BackColor = System.Drawing.Color.Transparent;
|
||||
this.label7.ForeColor = System.Drawing.SystemColors.ControlText;
|
||||
this.label7.Location = new System.Drawing.Point(10, 144);
|
||||
this.label7.Location = new System.Drawing.Point(10, 126);
|
||||
this.label7.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.label7.Name = "label7";
|
||||
this.label7.Padding = new System.Windows.Forms.Padding(0, 9, 0, 10);
|
||||
this.label7.Size = new System.Drawing.Size(95, 34);
|
||||
this.label7.Size = new System.Drawing.Size(89, 34);
|
||||
this.label7.TabIndex = 184;
|
||||
this.label7.Text = "Hide On Execute";
|
||||
this.label7.Text = "Always-On-Top";
|
||||
this.label7.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// label8
|
||||
@ -142,7 +148,7 @@ namespace FizzyLauncher
|
||||
this.label8.AutoSize = true;
|
||||
this.label8.BackColor = System.Drawing.Color.Transparent;
|
||||
this.label8.ForeColor = System.Drawing.SystemColors.ControlText;
|
||||
this.label8.Location = new System.Drawing.Point(10, 62);
|
||||
this.label8.Location = new System.Drawing.Point(10, 21);
|
||||
this.label8.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.label8.Name = "label8";
|
||||
this.label8.Padding = new System.Windows.Forms.Padding(0, 9, 0, 10);
|
||||
@ -151,18 +157,18 @@ namespace FizzyLauncher
|
||||
this.label8.Text = "Auto Save";
|
||||
this.label8.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// pickerBox1
|
||||
// pickerBox3
|
||||
//
|
||||
this.pickerBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.pickerBox1.BackColor = System.Drawing.Color.Transparent;
|
||||
this.pickerBox1.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||
this.pickerBox1.Location = new System.Drawing.Point(285, 62);
|
||||
this.pickerBox1.Margin = new System.Windows.Forms.Padding(10, 4, 10, 4);
|
||||
this.pickerBox1.Name = "pickerBox1";
|
||||
this.pickerBox1.Padding = new System.Windows.Forms.Padding(10, 6, 7, 5);
|
||||
this.pickerBox1.Size = new System.Drawing.Size(84, 34);
|
||||
this.pickerBox1.SubmitButton = null;
|
||||
this.pickerBox1.TabIndex = 187;
|
||||
this.pickerBox3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.pickerBox3.BackColor = System.Drawing.Color.Transparent;
|
||||
this.pickerBox3.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||
this.pickerBox3.Location = new System.Drawing.Point(285, 21);
|
||||
this.pickerBox3.Margin = new System.Windows.Forms.Padding(10, 4, 10, 4);
|
||||
this.pickerBox3.Name = "pickerBox3";
|
||||
this.pickerBox3.Padding = new System.Windows.Forms.Padding(10, 6, 7, 5);
|
||||
this.pickerBox3.Size = new System.Drawing.Size(84, 34);
|
||||
this.pickerBox3.SubmitButton = null;
|
||||
this.pickerBox3.TabIndex = 187;
|
||||
//
|
||||
// tHorizontalSeparator1
|
||||
//
|
||||
@ -180,26 +186,51 @@ namespace FizzyLauncher
|
||||
this.tHorizontalSeparator1.Size = new System.Drawing.Size(364, 22);
|
||||
this.tHorizontalSeparator1.TabIndex = 188;
|
||||
//
|
||||
// tHorizontalSeparator2
|
||||
//
|
||||
this.tHorizontalSeparator2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.tHorizontalSeparator2.AutoScrollMargin = new System.Drawing.Size(0, 0);
|
||||
this.tHorizontalSeparator2.AutoScrollMinSize = new System.Drawing.Size(0, 0);
|
||||
this.tHorizontalSeparator2.BackColor = System.Drawing.Color.Transparent;
|
||||
this.tHorizontalSeparator2.Location = new System.Drawing.Point(10, 59);
|
||||
this.tHorizontalSeparator2.Margin = new System.Windows.Forms.Padding(10, 0, 10, 0);
|
||||
this.tHorizontalSeparator2.MaximumSize = new System.Drawing.Size(4920, 2);
|
||||
this.tHorizontalSeparator2.MinimumSize = new System.Drawing.Size(0, 22);
|
||||
this.tHorizontalSeparator2.Name = "tHorizontalSeparator2";
|
||||
this.tHorizontalSeparator2.Padding = new System.Windows.Forms.Padding(0, 10, 0, 10);
|
||||
this.tHorizontalSeparator2.Size = new System.Drawing.Size(364, 22);
|
||||
this.tHorizontalSeparator2.TabIndex = 190;
|
||||
//
|
||||
// tHorizontalSeparator3
|
||||
//
|
||||
this.tHorizontalSeparator3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.tHorizontalSeparator3.AutoScrollMargin = new System.Drawing.Size(0, 0);
|
||||
this.tHorizontalSeparator3.AutoScrollMinSize = new System.Drawing.Size(0, 0);
|
||||
this.tHorizontalSeparator3.BackColor = System.Drawing.Color.Transparent;
|
||||
this.tHorizontalSeparator3.Location = new System.Drawing.Point(10, 164);
|
||||
this.tHorizontalSeparator3.Margin = new System.Windows.Forms.Padding(10, 0, 10, 0);
|
||||
this.tHorizontalSeparator3.MaximumSize = new System.Drawing.Size(4920, 2);
|
||||
this.tHorizontalSeparator3.MinimumSize = new System.Drawing.Size(0, 22);
|
||||
this.tHorizontalSeparator3.Name = "tHorizontalSeparator3";
|
||||
this.tHorizontalSeparator3.Padding = new System.Windows.Forms.Padding(0, 10, 0, 10);
|
||||
this.tHorizontalSeparator3.Size = new System.Drawing.Size(364, 22);
|
||||
this.tHorizontalSeparator3.TabIndex = 191;
|
||||
//
|
||||
// textBox1
|
||||
//
|
||||
this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.textBox1.BackColor = System.Drawing.Color.Transparent;
|
||||
this.textBox1.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||
this.textBox1.HighlightImage = ((System.Drawing.Image)(resources.GetObject("textBox1.HighlightImage")));
|
||||
results1.IsAlt = false;
|
||||
results1.IsCtrl = false;
|
||||
results1.IsShift = false;
|
||||
results1.Key = System.Windows.Forms.Keys.None;
|
||||
this.textBox1.KeyCodeResults = results1;
|
||||
this.textBox1.Location = new System.Drawing.Point(192, 20);
|
||||
this.textBox1.Margin = new System.Windows.Forms.Padding(10, 3, 3, 3);
|
||||
this.textBox1.Location = new System.Drawing.Point(192, 192);
|
||||
this.textBox1.Margin = new System.Windows.Forms.Padding(10, 6, 10, 6);
|
||||
this.textBox1.Name = "textBox1";
|
||||
this.textBox1.NormalImage = ((System.Drawing.Image)(resources.GetObject("textBox1.NormalImage")));
|
||||
this.textBox1.Padding = new System.Windows.Forms.Padding(10, 10, 9, 9);
|
||||
this.textBox1.Size = new System.Drawing.Size(177, 35);
|
||||
this.textBox1.SubmitButton = null;
|
||||
this.textBox1.TabIndex = 189;
|
||||
this.textBox1.TabIndex = 192;
|
||||
this.textBox1.UseSystemPasswordChar = false;
|
||||
//
|
||||
// OptionsForm
|
||||
@ -208,12 +239,14 @@ namespace FizzyLauncher
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(384, 521);
|
||||
this.Controls.Add(this.textBox1);
|
||||
this.Controls.Add(this.tHorizontalSeparator3);
|
||||
this.Controls.Add(this.tHorizontalSeparator2);
|
||||
this.Controls.Add(this.tHorizontalSeparator1);
|
||||
this.Controls.Add(this.pickerBox1);
|
||||
this.Controls.Add(this.label8);
|
||||
this.Controls.Add(this.pickerBox3);
|
||||
this.Controls.Add(this.label7);
|
||||
this.Controls.Add(this.label8);
|
||||
this.Controls.Add(this.pickerBox2);
|
||||
this.Controls.Add(this.label7);
|
||||
this.Controls.Add(this.pickerBox1);
|
||||
this.Controls.Add(this.label6);
|
||||
this.Controls.Add(this.button1);
|
||||
this.Controls.Add(this.label1);
|
||||
@ -229,6 +262,8 @@ namespace FizzyLauncher
|
||||
{
|
||||
base.OnShown(e);
|
||||
|
||||
this.DialogResult = System.Windows.Forms.DialogResult.None;
|
||||
|
||||
if (parentForm == null)
|
||||
{
|
||||
return;
|
||||
@ -239,39 +274,27 @@ namespace FizzyLauncher
|
||||
return;
|
||||
}
|
||||
|
||||
// hotkey
|
||||
if (parentForm.CurrentSession.HotKey != null)
|
||||
{
|
||||
textBox1.UpdateKeyCode(parentForm.CurrentSession.HotKey.IsCtrl, parentForm.CurrentSession.HotKey.IsAlt, parentForm.CurrentSession.HotKey.IsShift, parentForm.CurrentSession.HotKey.KeyCode);
|
||||
}
|
||||
|
||||
pickerBox1.ComboBox.SelectedIndex = (int)parentForm.CurrentSession.AutoSave;
|
||||
pickerBox2.Value = parentForm.CurrentSession.HideOnClose;
|
||||
pickerBox3.Value = parentForm.CurrentSession.HideOnClick;
|
||||
pickerBox3.ComboBox.SelectedIndex = (int)parentForm.CurrentSession.AutoSave;
|
||||
pickerBox1.Value = parentForm.CurrentSession.EnableAutoPosition;
|
||||
pickerBox2.Value = parentForm.CurrentSession.AlwaysOnTop;
|
||||
textBox1.Text = parentForm.CurrentSession.RunCommand ?? string.Empty;
|
||||
}
|
||||
|
||||
|
||||
public MainForm parentForm { get; set; } = null;
|
||||
|
||||
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (parentForm != null)
|
||||
{
|
||||
if (parentForm.CurrentSession == null) parentForm.CurrentSession = new LauncherSession();
|
||||
if (parentForm.CurrentSession.HotKey == null) parentForm.CurrentSession.HotKey = new LauncherSession.HotKeyOptions();
|
||||
|
||||
parentForm.CurrentSession.HotKey.IsCtrl = textBox1.KeyCodeResults.IsCtrl;
|
||||
parentForm.CurrentSession.HotKey.IsAlt = textBox1.KeyCodeResults.IsAlt;
|
||||
parentForm.CurrentSession.HotKey.IsShift = textBox1.KeyCodeResults.IsShift;
|
||||
parentForm.CurrentSession.HotKey.Key = textBox1.KeyCodeResults.KeyCode;
|
||||
|
||||
parentForm.CurrentSession.AutoSave = (LauncherSession.AutoSaveOption)pickerBox1.ComboBox.SelectedIndex;
|
||||
parentForm.CurrentSession.HideOnClose = pickerBox2.Value;
|
||||
parentForm.CurrentSession.HideOnClick = pickerBox3.Value;
|
||||
if (parentForm.CurrentSession == null) parentForm.CurrentSession = new AppSession();
|
||||
|
||||
parentForm.CurrentSession.AutoSave = (AppSession.AutoSaveOption)pickerBox3.ComboBox.SelectedIndex;
|
||||
parentForm.CurrentSession.EnableAutoPosition = pickerBox1.Value;
|
||||
parentForm.CurrentSession.AlwaysOnTop = pickerBox2.Value;
|
||||
parentForm.CurrentSession.RunCommand = textBox1.Text?.Trim();
|
||||
}
|
||||
|
||||
this.DialogResult = DialogResult.OK;
|
||||
this.Close();
|
||||
}
|
||||
|
||||
|
@ -57,24 +57,4 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="textBox1.HighlightImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAAA4AAAAQCAYAAAAmlE46AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
|
||||
vAAADrwBlbxySQAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAClSURBVDhP7dI/
|
||||
DgFBGIbxSVTKjcRx3MLqXYCOjkocQcMF3MAZOIKaE5AthOexf2QnbJQKb/JLJvO9XzLFhCgtbHDBveB5
|
||||
DWcfM8ANC0wKnr1LUUsbHXSxxBlJxDtnduy6E04on/Utd0IPOxwxxBT9iHfO7Nh155kV9vmxMXbsVvkv
|
||||
vvIji4f82Bg7tcUxrpih/NyxOeyMUMVPu0WGd39TzuzQDeEB5/ZKvTSyulEAAAAASUVORK5CYII=
|
||||
</value>
|
||||
</data>
|
||||
<data name="textBox1.NormalImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAAA4AAAAQCAYAAAAmlE46AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
|
||||
vAAADrwBlbxySQAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAADTSURBVDhP7ZI7
|
||||
CsJQEEUfWFmK4HLchdpnA9ppp5W4BBtdQNyBC0ilRf6VdVyBwUL03JdXxC/YWThwmDcz94YJjKmH7/uN
|
||||
OI7XaZqekiS5Cr1hpZmTPQemAeILeU4eC/dWr+9kVQRB0MzzvB2GYQfBAsExiqJWHfU0k0ZaeQyNAuxa
|
||||
X1CYLMu6/MOW4kD2YAK9B9TznGYrj12XVZY0drb4ENJI68q/sR4/YoS9K9+GNHdGLmIEJV+cku1xP4Jh
|
||||
Ri7JQ2erDp3mBs7w6jaFZht74MaYGwmLbkeRGexGAAAAAElFTkSuQmCC
|
||||
</value>
|
||||
</data>
|
||||
</root>
|
@ -143,7 +143,7 @@ namespace FizzyLauncher
|
||||
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.DialogResult = System.Windows.Forms.DialogResult.OK;
|
||||
this.DialogResult = DialogResult.OK;
|
||||
this.Close();
|
||||
}
|
||||
|
||||
|
@ -273,7 +273,6 @@ namespace RyzStudio.Windows.Forms
|
||||
[Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public bool AllowBeginEdit { get; set; } = false;
|
||||
|
||||
|
||||
[Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public bool HasChanged
|
||||
{
|
||||
@ -607,7 +606,7 @@ namespace RyzStudio.Windows.Forms
|
||||
|
||||
public void SetNoChanges()
|
||||
{
|
||||
hasChanged = false;
|
||||
this.HasChanged = false;
|
||||
}
|
||||
|
||||
public void Sort() => Sort(this.SelectedNode);
|
||||
@ -631,7 +630,7 @@ namespace RyzStudio.Windows.Forms
|
||||
}
|
||||
|
||||
|
||||
#region integrated behaviour
|
||||
#region integrated behaviour
|
||||
|
||||
protected override void OnItemDrag(ItemDragEventArgs e)
|
||||
{
|
||||
@ -836,50 +835,55 @@ namespace RyzStudio.Windows.Forms
|
||||
base.OnPreviewKeyDown(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
|
||||
protected int addIcon(BookmarkItemViewModel viewModel) => addIcon(viewModel.ToModel());
|
||||
|
||||
protected int addIcon(BookmarkItemModel model)
|
||||
protected int addIcon(BookmarkItemViewModel viewModel)
|
||||
{
|
||||
return (int)IconSet.Default;
|
||||
|
||||
|
||||
if (this.ImageList.Images.ContainsKey(model.SiteAddress))
|
||||
{
|
||||
return this.ImageList.Images.IndexOfKey(model.SiteAddress);
|
||||
}
|
||||
|
||||
//if (iconDatabase.HasIcon(model.SiteAddress))
|
||||
//{
|
||||
// Image rs = iconDatabase.GetIcon(model.SiteAddress);
|
||||
// if (rs == null)
|
||||
// {
|
||||
// return (int)IconSet.Default;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// this.Add(this.ImageList, model.SiteAddress, rs);
|
||||
|
||||
// return this.ImageList.Images.IndexOfKey(model.SiteAddress);
|
||||
// }
|
||||
//}
|
||||
|
||||
byte[] rawData;
|
||||
Bitmap bmp = model.RetrieveFavicon(out rawData);
|
||||
if (bmp == null)
|
||||
{
|
||||
return (int)IconSet.Default;
|
||||
}
|
||||
|
||||
ThreadControl.Add(this, this.ImageList, model.SiteAddress, bmp);
|
||||
|
||||
//iconDatabase.AddIcon(model.SiteAddress, rawData);
|
||||
|
||||
return this.ImageList.Images.IndexOfKey(model.SiteAddress);
|
||||
}
|
||||
|
||||
//protected int addIcon(BookmarkItemViewModel viewModel) => addIcon(viewModel.ToModel());
|
||||
|
||||
//protected int addIcon(BookmarkItemModel model)
|
||||
//{
|
||||
// return (int)IconSet.Default;
|
||||
|
||||
|
||||
// if (this.ImageList.Images.ContainsKey(model.SiteAddress))
|
||||
// {
|
||||
// return this.ImageList.Images.IndexOfKey(model.SiteAddress);
|
||||
// }
|
||||
|
||||
// //if (iconDatabase.HasIcon(model.SiteAddress))
|
||||
// //{
|
||||
// // Image rs = iconDatabase.GetIcon(model.SiteAddress);
|
||||
// // if (rs == null)
|
||||
// // {
|
||||
// // return (int)IconSet.Default;
|
||||
// // }
|
||||
// // else
|
||||
// // {
|
||||
// // this.Add(this.ImageList, model.SiteAddress, rs);
|
||||
|
||||
// // return this.ImageList.Images.IndexOfKey(model.SiteAddress);
|
||||
// // }
|
||||
// //}
|
||||
|
||||
// byte[] rawData;
|
||||
// Bitmap bmp = model.RetrieveFavicon(out rawData);
|
||||
// if (bmp == null)
|
||||
// {
|
||||
// return (int)IconSet.Default;
|
||||
// }
|
||||
|
||||
// ThreadControl.Add(this, this.ImageList, model.SiteAddress, bmp);
|
||||
|
||||
// //iconDatabase.AddIcon(model.SiteAddress, rawData);
|
||||
|
||||
// return this.ImageList.Images.IndexOfKey(model.SiteAddress);
|
||||
//}
|
||||
|
||||
protected TreeNode AddFolderPath(string path)
|
||||
{
|
||||
TreeNode tn = null;
|
||||
|
Loading…
Reference in New Issue
Block a user