Пример #1
0
 public HotkeysWindow(AppTray appTray)
 {
     InitializeComponent();
     Icon     = Properties.Resources.TrayIcon;
     _appTray = appTray;
     _hotkeyBindingSource.DataSource = appTray.Hotkeys;
 }
Пример #2
0
        static void Main()
        {
            bool createdNew = true;

            //No idea why but when used Guid from the assembly then createdNew always return false... although this didn't happen in other project
            //var assemblyGuidAttrib = (GuidAttribute)Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(GuidAttribute), true)[0];
            //using (Mutex mutex = new Mutex(true, assemblyGuidAttrib.ToString(), out createdNew))
            using (Mutex mutex = new Mutex(true, "41a052de-7449-49ea-87e8-2143a3d33122", out createdNew))
            {
                if (createdNew)
                {
                    Application.EnableVisualStyles();
                    Application.SetCompatibleTextRenderingDefault(false);

                    using (AppTray appIcon = new AppTray())
                    {
                        Application.Run();
                    }
                }
            }
        }