Exemplo n.º 1
0
        private void NewScreen()
        {
            var newScreen = new Screen();

            newScreen.Id = 1;
            if (Screens.Any())
            {
                newScreen.Id = Screens.Max(x => x.Id) + 1;
            }

            Screens.Add(newScreen);
            _currentScreen = newScreen;
            var newScreenListItem = new ListBoxItem
            {
                Tag     = newScreen.Id,
                Content = newScreen.Id + " - Screen"
            };

            listScreens.Items.Add(newScreenListItem);
            foreach (ListBoxItem item in listScreens.Items)
            {
                var tag = (int)item.Tag;
                if (tag == newScreen.Id)
                {
                    listScreens.SelectedItem = item;
                }
            }

            LoadSelectedScreen();
            NewOption();
        }
Exemplo n.º 2
0
        public int FindNextScreenId()
        {
            int stageCount   = Screens.Count();
            int nextScreenId = stageCount + 1;

            while (Screens.Any(s => s.Name == nextScreenId.ToString()))
            {
                nextScreenId++;
            }
            return(nextScreenId);
        }
Exemplo n.º 3
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;
                }
            };
        }
        public override bool Validate()
        {
            if (!Screens.Any(s => s.IsSelected.Value))
            {
                var window = WindowAssist.GetWindow(Controller);

                MessageBoxEx.Show("You must select at least 1 monitors for the UI Viewport.", "Select Monitor", parent: window);
                return(false);
            }

            return(base.Validate());
        }
Exemplo n.º 5
0
        private void BtnDeleteScreen_Click(object sender, RoutedEventArgs e)
        {
            if (_currentScreen == null ||
                listScreens.SelectedItem == null ||
                !Screens.Any())
            {
                return;
            }

            Screens.RemoveAll(x => x.Id == _currentScreen.Id);
            listScreens.Items.Remove(listScreens.SelectedItem);

            _currentScreen = null;
            _currentOption = null;
            _currentAction = null;
            ClearScreen();
            RenumberScreens();
        }
Exemplo n.º 6
0
 private bool IsSetupRequired()
 {
     return(Screens.Any(s => s.IsSetup == false));
 }