Beispiel #1
0
        protected override void OnLoad(EventArgs e)
        {
            _config = ScreenConfigCollection.Load();
            ScreenConfigCollection.OnChanged += OnDisplaySettingsChanged;

            base.OnLoad(e);
        }
Beispiel #2
0
 public MouseBridgeService()
 {
     _screens = ScreenConfigCollection.Load();
     ScreenConfigCollection.OnChanged += config => {
         _screens = config;
     };
 }
Beispiel #3
0
        private void InitSystemInfos()
        {
            LogInfos($"Config: {Json(ScreenConfigCollection.Load())}");
            LogInfos($"Screens: {Json(Screen.AllScreens)}");
            LogInfos($"SystemInformation: {Json(StaticProperties(typeof(SystemInformation)))}");
            LogInfos($"Environment: {Json(StaticProperties(typeof(Environment)))}");

            void LogInfos(string msg)
            {
                this.InfosBox.AppendText($"{msg}\r\n");
            }
Beispiel #4
0
        public DiagnosticForm(ServiceThread service)
        {
            Service = service;
            InitializeComponent();

            var diagnostic = false;

            this.BtnStartDiagnostic.Click += delegate {
                if (!diagnostic)
                {
                    ConsoleBox.Text = string.Empty;
                    var config = ScreenConfigCollection.Load();
                    Service.StopService();
                    Service.StartService(new MouseBridgeDiagnosticService(config, RealtimeLog));
                    this.BtnStartDiagnostic.Text = "Stop Diagnostic";
                    diagnostic = true;
                }
                else
                {
                    Service.RestoreOriginalState();
                    this.BtnStartDiagnostic.Text = "Start Diagnostic";
                    diagnostic = false;
                }
            };

            this.BtnCopy.Click += delegate {
                var sb = new StringBuilder();

                // update log infos
                LogfileBox.Text = string.Empty;
                InitLogFileInfos();

                sb.AppendLine(InfosBox.Text);
                sb.AppendLine();
                sb.AppendLine();
                sb.AppendLine(ConsoleBox.Text);
                sb.AppendLine();
                sb.AppendLine();
                sb.AppendLine(LogfileBox.Text);

                Clipboard.SetText(sb.ToString());

                MessageBox.Show("Diagnostic data copied to clipboard.");
            };

            this.Closing += delegate {
                Service.RestoreOriginalState();
            };

            ConsoleBox.Text = "\r\n  INFO: Start Diagnostic to see Realtime output..";

            InitSystemInfos();
            InitLogFileInfos();
        }
Beispiel #5
0
        public ConfigFrom(ServiceThread service)
        {
            this.Icon = App.Icon;

            Service = service;

            Screens             = ScreenConfigCollection.Load();
            Settings            = Settings.Load();
            Settings.Configured = Screens.Any(_ => _.HasBridges);

            InitializeComponent();

            this.Text += $" v{Assembly.GetEntryAssembly()?.GetName().Version}";

            this.ResizeRedraw        = true;
            this.InfoText.Visible    = Settings.Configured == false;
            this.BtnConfigure.Click += (s, e) => {
                ShowForms();
            };
            this.BtnDiagnostic.Click += (s, e) => {
                ShowDiagnosticForm();
            };
            this.EnableAutoStart.Checked         = Settings.AutoStartEnabled;
            this.EnableAutoStart.CheckedChanged += delegate {
                if (EnableAutoStart.Checked)
                {
                    Task.Run(() => new ProjectInstaller().Install());
                    Settings.AutoStartEnabled = true;
                }
                else
                {
                    Task.Run(() => new ProjectInstaller().Uninstall());
                    Settings.AutoStartEnabled = false;
                }
            };
            if (!Settings.Configured && !Settings.AutoStartEnabled)
            {
                this.EnableAutoStart.Checked = true;
            }

            this.TeleportationActive.Checked         = Settings.TeleportationActive;
            this.TeleportationActive.CheckedChanged += delegate {
                if (TeleportationActive.Checked)
                {
                    Service.StartService();
                    Settings.TeleportationActive = true;
                }
                else
                {
                    Service.StopService();
                    Settings.TeleportationActive = false;
                }
            };
        }