private void deleteStartupShortCut() { string shortcutName = StaticUtility.returnTitleName(); string shortcutPath = Environment.GetFolderPath(Environment.SpecialFolder.Startup); string shortcutLocation = Path.Combine(shortcutPath, shortcutName + ".lnk"); try { if (System.IO.File.Exists(shortcutLocation)) { System.IO.File.Delete(shortcutLocation); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void createStartupShortCut() { string shortcutName = StaticUtility.returnTitleName(); string shortcutPath = Environment.GetFolderPath(Environment.SpecialFolder.Startup); string shortcutLocation = Path.Combine(shortcutPath, shortcutName + ".lnk"); deleteStartupShortCut(); WshShell shell = new WshShell(); IWshShortcut shortcut = (IWshShortcut)shell.CreateShortcut(shortcutLocation); shortcut.Description = StaticUtility.returnTitleName() + " startup shortcut. Instead of deleting this it's recommended to uncheck the box in the application."; // The description of the shortcut //shortcut.IconLocation = @"c:\myicon.ico"; // The icon of the shortcut shortcut.TargetPath = Application.ExecutablePath; // The path of the file that will launch when the shortcut is run try { shortcut.Save(); } // Save the shortcut catch (Exception ex) { MessageBox.Show(ex.Message); } }
/// <summary> /// /// </summary> private void initializeWindow() { Text = StaticUtility.returnTitleName() + " - Report"; initializeControlSettings(); refreshConfigFromFile(); //Want to update before we put all the event handlers in. //Report Tab Event Handlers Shown += new EventHandler(config_Shown); chart1.MouseDown += new MouseEventHandler(mouseDown_Click); reportDiffFileButton.Click += new EventHandler(reportDiffFileButton_Click); radioButtonManicTimeGrouped.CheckedChanged += new EventHandler(radioButtons_ReportPage); radioButtonManicTimeAll.CheckedChanged += new EventHandler(radioButtons_ReportPage); radioButtonManicTimeCategory.CheckedChanged += new EventHandler(radioButtons_ReportPage); radioButtonWorkWinderData.CheckedChanged += new EventHandler(radioButtons_ReportPage); //Application Settings EventHandlers checkFlashStop.CheckedChanged += new EventHandler(checkFlashStop_CheckedChanged); checkBox_RunOnStartup.CheckedChanged += new EventHandler(runOnStartUp_CheckedChanged); buttonSaveColumnConfig.Click += new EventHandler(saveColumnConfigButton_Click); //themeComboBox.SelectedIndexChanged += new EventHandler(themeComboBox_IndexChanged); //ManicTime Integration EventHandlers radioButtonManicTime_Disabled.CheckedChanged += new EventHandler(radioButtons_ManicTime_Changed); radioButtonManicTime_Enabled.CheckedChanged += new EventHandler(radioButtons_ManicTime_Changed); button_ManicTime_DirectoryDialog.Click += new EventHandler(button_ManicTime_DirectoryDialog_Click); linkLabel_DatabaseLocation.LinkClicked += new LinkLabelLinkClickedEventHandler(clicked_ManicTimeDBHelp); //Event Saving EventHandlers radioButtonEventSaving_Disabled.CheckedChanged += new EventHandler(radioButtons_SaveEvents_Changed); radioButtonEventSaving_Default.CheckedChanged += new EventHandler(radioButtons_SaveEvents_Changed); radioButtonEventSaving_Custom.CheckedChanged += new EventHandler(radioButtons_SaveEvents_Changed); button_EventSaving_DirectoryDialog.Click += new EventHandler(button_EventSaving_DirectoryDialog_Click); //General Help EventHandler linkLabelWorkWinderHelp.LinkClicked += new LinkLabelLinkClickedEventHandler(clicked_WorkWinderHelp); linkLabelFeedback.LinkClicked += new LinkLabelLinkClickedEventHandler(clicked_linkFeedback); }
private void initializeTLP(ref TableLayoutPanel TLP) { FormClosing += new FormClosingEventHandler(workWinder_FormClosing); //unrelated but I need to do this somewhere TLP = new TableLayoutPanel(); TLP.SuspendLayout(); SuspendLayout(); //Set Window Properties BackColor = theme.defWindowColor; Text = StaticUtility.returnTitleName(); AutoSize = true; AutoSizeMode = AutoSizeMode.GrowAndShrink; MinimumSize = new Size(Properties.Settings.Default.MainFormWindowWidth, 50); MaximizeBox = false; //Define Column Settings TLP.ColumnCount = 4; TLP.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 40F)); TLP.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 40F)); TLP.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100F)); TLP.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 80F)); //Add Rows addRow(TLP); addRow(TLP); //Set TableLayoutPanel Settings TLP.Dock = DockStyle.Fill; TLP.Location = new Point(0, 0); TLP.Margin = new Padding(0); TLP.Padding = new Padding(2); TLP.AutoSize = true; Controls.Add(TLP); //Stop Button StaticUtility.addLabel(ref TLP, ref tempLabel, theme.defStopBackColor, theme.defStopForeColor, 2, stop_Click, true, true, 0, 0); tempLabel.Text = "Stop"; //Total label StaticUtility.addLabel(ref TLP, ref tempLabel, theme.defTotalBackColor, theme.defTotalForeColor, 0, null, true, true, 2, 0); tempLabel.Text = "Total: 00:00:00"; //Up button StaticUtility.addLabel(ref TLP, ref tempLabel, theme.defUpDwBackColor, theme.defUpDwForeColor, 1, up_Click, true, false, 0, 1); tempLabel.Text = "p"; //Down button StaticUtility.addLabel(ref TLP, ref tempLabel, theme.defUpDwBackColor, theme.defUpDwForeColor, 1, down_Click, true, false, 1, 1); tempLabel.Text = "q"; //Open Report StaticUtility.addLabel(ref TLP, ref tempLabel, theme.defUpDwBackColor, theme.defUpDwForeColor, 2, config_Click, true, true, 2, 1); tempLabel.Text = "Report && Configuration"; //Setup the default name settings string[] nameLiDefault = Properties.Settings.Default.NameList.Split(new char[] { ',' }); for (int i = 0; i < nameLiDefault.Length; i++) { textBoxNamesArray[i] = nameLiDefault[i]; addTimerRow(ref TLP, textBoxNamesArray[i], false); } TLP.ResumeLayout(false); TLP.PerformLayout(); ResumeLayout(false); PerformLayout(); }