1
0
mirror of https://github.com/chylex/TweetDuck.git synced 2025-08-14 21:16:58 +02:00
Files
.github
.idea
Application
Browser
Configuration
Controls
Dialogs
Settings
DialogSettingsCSS.Designer.cs
DialogSettingsCSS.cs
DialogSettingsCefArgs.Designer.cs
DialogSettingsCefArgs.cs
DialogSettingsExternalProgram.Designer.cs
DialogSettingsExternalProgram.cs
DialogSettingsManage.Designer.cs
DialogSettingsManage.cs
DialogSettingsRestart.Designer.cs
DialogSettingsRestart.cs
DialogSettingsSearchEngine.Designer.cs
DialogSettingsSearchEngine.cs
TabSettingsAdvanced.Designer.cs
TabSettingsAdvanced.cs
TabSettingsFeedback.Designer.cs
TabSettingsFeedback.cs
TabSettingsGeneral.Designer.cs
TabSettingsGeneral.cs
TabSettingsNotifications.Designer.cs
TabSettingsNotifications.cs
TabSettingsSounds.Designer.cs
TabSettingsSounds.cs
TabSettingsTray.Designer.cs
TabSettingsTray.cs
FormAbout.Designer.cs
FormAbout.cs
FormGuide.Designer.cs
FormGuide.cs
FormMessage.Designer.cs
FormMessage.cs
FormPlugins.Designer.cs
FormPlugins.cs
FormSettings.Designer.cs
FormSettings.cs
Management
Plugins
Properties
Resources
Updates
Utils
bld
lib
subprocess
video
.gitattributes
.gitignore
LICENSE.md
Program.cs
README.md
Reporter.cs
TweetDuck.csproj
TweetDuck.sln
TweetDuck.sln.DotSettings
Version.cs
app.config
packages.config
TweetDuck/Dialogs/Settings/DialogSettingsRestart.cs

63 lines
1.7 KiB
C#

using System;
using System.Windows.Forms;
using TweetDuck.Configuration;
using TweetLib.Core;
using TweetLib.Utils.Collections;
namespace TweetDuck.Dialogs.Settings {
sealed partial class DialogSettingsRestart : Form {
public CommandLineArgs Args { get; private set; }
public DialogSettingsRestart(CommandLineArgs currentArgs) {
InitializeComponent();
cbLogging.Checked = currentArgs.HasFlag(Arguments.ArgLogging);
cbLogging.CheckedChanged += control_Change;
if (App.IsPortable) {
tbDataFolder.Text = "Not available in portable version";
tbDataFolder.Enabled = false;
}
else {
tbDataFolder.Text = currentArgs.GetValue(Arguments.ArgDataFolder) ?? string.Empty;
tbDataFolder.TextChanged += control_Change;
}
control_Change(this, EventArgs.Empty);
Text = Program.BrandName + " Arguments";
}
private void control_Change(object sender, EventArgs e) {
Args = new CommandLineArgs();
if (cbLogging.Checked) {
Args.AddFlag(Arguments.ArgLogging);
}
if (!string.IsNullOrWhiteSpace(tbDataFolder.Text) && tbDataFolder.Enabled) {
Args.SetValue(Arguments.ArgDataFolder, tbDataFolder.Text);
}
tbShortcutTarget.Text = $@"""{Program.ExecutablePath}""{(Args.Count > 0 ? " " : "")}{Args}";
tbShortcutTarget.Select(tbShortcutTarget.Text.Length, 0);
}
private void tbShortcutTarget_Click(object sender, EventArgs e) {
if (tbShortcutTarget.SelectionLength == 0) {
tbShortcutTarget.SelectAll();
}
}
private void btnRestart_Click(object sender, EventArgs e) {
DialogResult = DialogResult.OK;
Close();
}
private void btnCancel_Click(object sender, EventArgs e) {
DialogResult = DialogResult.Cancel;
Close();
}
}
}