Exemple #1
0
    //reads in server output and does what the server says
    public void HandleServerOutput()
    {
        List <string> serverOutput = udpListen.ReadMessages();

        //get the whole output in one string, from oldest to newest messages
        string fullOutput = "";

        foreach (string s in serverOutput)
        {
            fullOutput += s;
        }

        //turn the string into a nice list of messages
        List <Message> messages = DataParserAndFormatter.GetMessagesFromServerOutput(fullOutput);

        //handle each message (oldest to newest)
        foreach (Message message in messages)
        {
            UnityHandler.HandleMessage(message);
            if (debug == true)
            {
                //  Debug.Log("CLIENT: Sent message to Unity Handler");
            }
        }
    }
Exemple #2
0
        protected override void OnStartup(StartupEventArgs e)
        {
            UnityHandler.CreateContainer();
            var appSettingService = UnityHandler.UnityContainer.Resolve <IAppSettingService>();

            if (e.Args.Length > 0 && !string.IsNullOrEmpty(e.Args[0]) && e.Args[0] == "-removeAppData")
            {
                try
                {
                    appSettingService.AutoStartWithWindows = false;
                    appSettingService.RemoveAppConfigSettingFile();

                    Environment.Exit(0);
                }
                catch
                {
                    Environment.Exit(1);
                }
            }

            base.OnStartup(e);

            // register this application specific action service
            UnityHandler.UnityContainer.RegisterType <IActionService, ActionService>(lifetimeManager: new SingletonLifetimeManager());

            // ensure AppConfig Values exist
            bool firstTimeUser = appSettingService.RestoreDefaultAppConfigSetting(settingKey: null, overrideSetting: false);

            var hotkeyService = UnityHandler.UnityContainer.Resolve <IApplicationHotkeyService>();

            actionService = UnityHandler.UnityContainer.Resolve <IActionService>();
            ThemeManager.ChangeTheme(appSettingService.WindowTheme);

            // Show main window first, so that windows popping up (like new updates/new to app) are in foreground and escapable
            mainWindow = UnityHandler.UnityContainer.Resolve <MainWindow>();
            actionService.OwnerControl = mainWindow;

            HandleFirstStartAndUpdates(actionService, appSettingService, hotkeyService, firstTimeUser);
        }