Start() public method

public Start ( ) : void
return void
コード例 #1
0
        static void Main(string[] args)
        {
            for (var i = 0; i < args.Length; i++)
            {
                if (args[i] == "--debug")
                {
                    IsDebug = true;
                }

                if (args[i] == "--default")
                {
                    ForceDefaultMapping = true;
                }

                if (args[i] == "--skip-ui")
                {
                    ShouldOpenUI = false;
                }

                if (args[i] == "--mapping")
                {
                    InitialMappingName = args[i + 1];
                    i++;
                }

                if (args[i] == "--start-disabled")
                {
                    ShouldStartDisabled = true;
                }
            }

            RestServerInstance        = new RestServer();
            KeyboardMapperInstance    = new KeyboardMapper();
            ControllerManagerInstance = new ControllerManager();

            KeyboardMapperInstance.OnParse += (s, e) => {
                if (ControllerManagerInstance.IsRunning)
                {
                    ControllerManagerInstance.Stop();
                    ControllerManagerInstance.Start();
                }
            };

            RestServerInstance.Start();

            if (!ShouldStartDisabled)
            {
                KeyboardMapperInstance.Start();
                ControllerManagerInstance.Start();
            }

            // See https://github.com/gmamaladze/globalmousekeyhook/issues/3#issuecomment-230909645
            System.Windows.Forms.ApplicationContext msgLoop = new System.Windows.Forms.ApplicationContext();

            ConsoleCtrlHandlerRef += new ConsoleCtrlHandler(HandleConsoleExit);
            SetConsoleCtrlHandler(ConsoleCtrlHandlerRef, true);

            System.Windows.Forms.Application.Run(msgLoop);
        }
コード例 #2
0
    //初始化
    public void Start()
    {
        //UI
        myControlManager = new ControllerManager();
        myControlManager.Inject(myFigureSystem);
        myStateManager = new PlayerStateGroup();
        myStateManager.Inject(myFigureSystem);
        myLoginManager = new LoginUIControl();
        myLoginManager.Inject(myFigureSystem);
        myFirstLoginManager = new FirstLoginControl();


        //Start
        myControlManager.Start();
        myStateManager.Start();
        myLoginManager.Start();
        myFirstLoginManager.Start();

        //系統
        myFigureSystem = new FigureSystem();
        mySceneSystem  = new SceneSystem();

        //Start
        myFigureSystem.Start();
        mySceneSystem.Start();
    }
コード例 #3
0
        static void Main(string[] args)
        {
            for (var i = 0; i < args.Length; i++)
            {
                if (args[i] == "--debug")
                {
                    IsDebug = true;
                }

                if (args[i] == "--default")
                {
                    ForceDefaultMapping = true;
                }

                if (args[i] == "--skip-ui")
                {
                    ShouldOpenUI = false;
                }
            }

            RestServerInstance        = new RestServer();
            KeyboardMapperInstance    = new KeyboardMapper();
            ControllerManagerInstance = new ControllerManager();

            KeyboardMapperInstance.OnParse += (s, e) => {
                if (ControllerManagerInstance.IsRunning)
                {
                    ControllerManagerInstance.Stop();
                    ControllerManagerInstance.Start();
                }
            };

            RestServerInstance.Start();
            KeyboardMapperInstance.Start();
            ControllerManagerInstance.Start();

            // See https://github.com/gmamaladze/globalmousekeyhook/issues/3#issuecomment-230909645
            System.Windows.Forms.ApplicationContext msgLoop = new System.Windows.Forms.ApplicationContext();
            System.Windows.Forms.Application.Run(msgLoop);
        }
コード例 #4
0
        protected override void OnStartup(StartupEventArgs e)
        {
            if (!Args.Contains("--ignore-mutex")) // parameter to ignore existing instances
            {
                // Check if an existing instance of the application is running
                _mutex = new Mutex(false, "Global\\" + _appGuid);
                if (!_mutex.WaitOne(0, false))
                {
                    // Instance already running
                    MessageBox.Show("Another instance of WoWmapper is already open", "Already running", MessageBoxButton.OK,
                                    MessageBoxImage.Error);
                    Environment.Exit(0);
                    return;
                }
            }

            SetTheme();

            // Start up threads
            BindManager.LoadBindings();
            ControllerManager.Start();
            ProcessManager.Start();
            InputMapper.Start();

            if (Settings.Default.EnableOverlay)
            {
                Overlay.Start();
            }

            base.OnStartup(e);

            // Create system tray icon
            _notifyIcon.Icon    = Icon.ExtractAssociatedIcon(Assembly.GetExecutingAssembly().Location);
            _notifyIcon.Text    = "WoWmapper";
            _notifyIcon.Visible = true;
            _notifyIcon.Click  += (sender, args) =>
            {
                var me = (MouseEventArgs)args;
                if (me.Button == MouseButtons.Right)
                {
                    _notifyMenu.IsOpen = true;
                }
            };
            _notifyIcon.DoubleClick += (sender, args) => { Application.Current.MainWindow.Show(); };
            _notifyMenuOpen.Click   += (sender, args) => { Application.Current.MainWindow.Show(); };
            _notifyMenuExit.Click   += (sender, args) => { Application.Current.Shutdown(); };
        }
コード例 #5
0
        public MainWindow()
        {
            InitializeComponent();

            var currentVersion = Assembly.GetExecutingAssembly().GetName().Version;

            Logger.Write("------------------------------------------");
            Logger.Write("WoWmapper {0} initializing...", currentVersion);
            Logger.Write("Operating System: Windows {0}, {1}", Environment.OSVersion, Environment.Is64BitOperatingSystem ? "x64" : "x86");
            Logger.Write("Application Path: {0}", System.AppDomain.CurrentDomain.BaseDirectory);

            var dxKey     = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\DirectX");
            var dxVersion = new Version();

            var dxVersionString = (string)dxKey?.GetValue("Version");

            if (dxVersionString != null)
            {
                dxVersion = new Version(dxVersionString);
            }

            if (dxVersion < new Version("4.09.00.0904"))
            {
                var downloadDXnow = System.Windows.MessageBox.Show(
                    "DirectX 9.0c is required for Xbox controller support. Would you like to download it now?",
                    "DirectX not found", MessageBoxButton.YesNo, MessageBoxImage.Warning);
                if (downloadDXnow == MessageBoxResult.Yes)
                {
                    Process.Start("https://www.microsoft.com/en-us/download/confirmation.aspx?id=8109");
                }
                Settings.Default.EnableXbox = false;
                Settings.Default.Save();
            }


            if (new Version(Settings.Default.LastRunVersion) < currentVersion)
            {
                Logger.Write("Upgrading application settings");
                Settings.Default.Upgrade();
            }

            Settings.Default.LastRunVersion = currentVersion.ToString();
            Settings.Default.Save();

            AppDataDir = Path.Combine(Environment.GetEnvironmentVariable("LocalAppData"), "WoWmapper");
            if (!Directory.Exists(AppDataDir))
            {
                Logger.Write("App data dir not found\nCreating{0}", AppDataDir);
                Directory.CreateDirectory(AppDataDir);
            }

            // Add notification menu items
            ((MenuItem)_notifyMenu.Items[0]).Click += NotifyMenu_Open_WoWmapper;
            ((MenuItem)_notifyMenu.Items[2]).Click += NotifyMenu_Controllers;
            ((MenuItem)_notifyMenu.Items[3]).Click += NotifyMenu_Keybinds;
            ((MenuItem)_notifyMenu.Items[5]).Click += NotifyMenu_Exit;
            _notifyIcon              = new NotifyIcon();
            _notifyIcon.Click       += NotifyIcon_Click;
            _notifyIcon.DoubleClick += NotifyIcon_DoubleClick;
            _notifyIcon.Visible      = true;
            _notifyIcon.Icon         = Properties.Resources.WoWmapper_Icon;


            // Add custom accents
            ThemeManager.AddAccent("DeathKnight", new Uri("pack://application:,,,/Resources/Accents/DeathKnight.xaml"));
            ThemeManager.AddAccent("Druid", new Uri("pack://application:,,,/Resources/Accents/Druid.xaml"));
            ThemeManager.AddAccent("Hunter", new Uri("pack://application:,,,/Resources/Accents/Hunter.xaml"));
            ThemeManager.AddAccent("Mage", new Uri("pack://application:,,,/Resources/Accents/Mage.xaml"));
            ThemeManager.AddAccent("Monk", new Uri("pack://application:,,,/Resources/Accents/Monk.xaml"));
            ThemeManager.AddAccent("Paladin", new Uri("pack://application:,,,/Resources/Accents/Paladin.xaml"));
            ThemeManager.AddAccent("Priest", new Uri("pack://application:,,,/Resources/Accents/Priest.xaml"));
            ThemeManager.AddAccent("Rogue", new Uri("pack://application:,,,/Resources/Accents/Rogue.xaml"));
            ThemeManager.AddAccent("Shaman", new Uri("pack://application:,,,/Resources/Accents/Shaman.xaml"));
            ThemeManager.AddAccent("Warlock", new Uri("pack://application:,,,/Resources/Accents/Warlock.xaml"));
            ThemeManager.AddAccent("Warrior", new Uri("pack://application:,,,/Resources/Accents/Warrior.xaml"));

            // Load saved theme and accent
            var appTheme  = ThemeManager.AppThemes.FirstOrDefault(theme => theme.Name == Settings.Default.AppTheme);
            var appAccent = ThemeManager.Accents.FirstOrDefault(accent => accent.Name == Settings.Default.AppAccent);

            // Load defaults if invalid
            if (appTheme == null)
            {
                appTheme = ThemeManager.GetAppTheme("BaseLight");
                Settings.Default.AppTheme = "BaseLight";
                Settings.Default.Save();
            }
            if (appAccent == null)
            {
                appAccent = ThemeManager.GetAccent("Blue");
                Settings.Default.AppAccent = "Blue";
                Settings.Default.Save();
            }

            // Set drop shadow
            if (Settings.Default.AppDropShadow)
            {
                BorderThickness = new Thickness(0);
                GlowBrush       = Brushes.Black;
            }

            // Apply theme
            ThemeManager.ChangeAppStyle(Application.Current, appAccent, appTheme);

            // Hook events
            AdvancedSettings.ShowFeedbackWarning += AdvancedSettings_ShowFeedbackWarning;
            AdvancedSettings.DoResetAll          += AdvancedSettings_DoResetAll;
            ShowMessage            += MainWindow_ShowMessage;
            ShowKeybindDialogEvent += OnShowKeybindDialog;

            // Initialize UI timer
            _timerUpdateUi.Elapsed += Timer_UpdateUI;
            _timerUpdateUi.Interval = 100;
            _timerUpdateUi.Start();

            // Initialize controllers
            BindingManager.LoadKeybinds();

            // Initialize process watcher
            ProcessWatcher.Start();
            ControllerManager.Start();
            HapticManager.Start();
            Keymapper.Start();
        }