예제 #1
0
        public SettingsForm(Settings settings, SwitcherCore engine)
        {
            this.settings = settings;
            settings.AutoSwitchingToggle += OnAutoSwitchingModeToggle;

            this.engine   = engine;
            engine.Error += OnEngineError;

            InitializeComponent();
            InitializeTrayIcon();
            InitializeHotkeyBoxes();

            Version version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;

            Text = "AutoMova" + " " + version.Major + "." + version.Minor + " alpha (build " + version.Build + "." + version.Revision + ")"; //change form title
            if (Environment.OSVersion.Version < new Version(6, 2))
            {
                Icon = Properties.Resources.icon;
            }
            else
            {
                Icon = Properties.Resources.icon10;
            }
            UpdateUi();
        }
예제 #2
0
        static void Main()
        {
            if (mutex.WaitOne(TimeSpan.Zero, true))
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);

                var settings = Settings.Init();
                var engine   = new SwitcherCore(settings);
                Application.ApplicationExit += (s, a) => { engine.Dispose(); };
                var app = new SettingsForm(settings, engine);
                app.Exit += (s, e) => Application.Exit();
                var context = new ApplicationContext(app);
                Application.Run(context);
                mutex.ReleaseMutex();
            }
            else
            {
                LowLevelAdapter.SendShowSettingsMessage();
            }
        }