void Hide_Click(object sender, EventArgs e) { if (!Settings.Default.HideOSD) { hideVolumeOSDLib.HideOSD(); Settings.Default.HideOSD = true; switchMenu.ImageIndex = 0; switchMenu.Text = "Show Volume OSD"; } else { hideVolumeOSDLib.ShowOSD(); Settings.Default.HideOSD = false; switchMenu.Image = Resources.SwitchDisabled; switchMenu.ImageIndex = 1; switchMenu.Text = "Hide Volume OSD"; } Settings.Default.Save(); }
static void Main(string[] args) { if (mutex.WaitOne(TimeSpan.Zero, true)) { if ((args.GetLength(0) == 1)) { HideVolumeOSDLib lib = new HideVolumeOSDLib(null); lib.Init(); if (args[0] == "-hide") { lib.HideOSD(); } else if (args[0] == "-show") { lib.ShowOSD(); } } else { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); using (ProcessIcon pi = new ProcessIcon()) { pi.Display(); if (!InitFailed) { Application.Run(); } } } mutex.ReleaseMutex(); } }