Пример #1
0
        void App_Startup(object sender, StartupEventArgs e)
        {
            var process      = Process.GetCurrentProcess();
            var otherProcess = Process.GetProcesses().FirstOrDefault(p => p.ProcessName == process.ProcessName && p.Id != process.Id);

            if (otherProcess != null)
            {
                PerformRegularShutdownOprations = false;

                ShowWindow(otherProcess);

                Current.Shutdown();
                return;
            }

            if (!UserSettings.HasSettings() || UserSettings.Settings.Devices.Count == 0)
            {
                var setupWindow = new SetupWindow();
                setupWindow.Show();
            }
            else
            {
                NormalStartup(e);
            }
        }
Пример #2
0
        public void Execute(object parameter)
        {
            var setup = new SetupWindow(_workspace);

            setup.ShowDialog();
            _workspace.FocusListView();
        }
Пример #3
0
        /// <summary>
        /// Handles the OpenSetupRequested event.
        /// </summary>
        /// <param name="sender">The sender<see cref="object"/>.</param>
        /// <param name="e">The e<see cref="ViewModelEventArgs"/>.</param>
        private void Vm_OpenSetupRequested(object sender, ViewModelEventArgs e)
        {
            WpfHelper.SetWindowSettings(Window.GetWindow(this));
            var win = new SetupWindow();

            win.ShowDialog();
        }
Пример #4
0
        void App_Startup(object sender, StartupEventArgs e)
        {
            var process      = Process.GetCurrentProcess();
            var otherProcess = Process.GetProcesses().FirstOrDefault(p => p.ProcessName == process.ProcessName && p.Id != process.Id);

            if (otherProcess != null)
            {
                PerformRegularShutdownOprations = false;

                ShowWindow(otherProcess);

                Current.Shutdown();
                return;
            }

            if (!UserSettings.HasSettings() || UserSettings.Settings.Devices.Count == 0)
            {
                var setupWindow = new SetupWindow();
                setupWindow.Show();
            }
            else
            {
                var primaryColor   = (Color)ColorConverter.ConvertFromString("#3FAE29");
                var secondaryColor = (Color)ColorConverter.ConvertFromString("#2D2F30");
                var baseTheme      = Theme.Dark;
                var theme          = Theme.Create(baseTheme, primaryColor, secondaryColor);
                Application.Current.Resources.SetTheme(theme);
                NormalStartup(e);
            }
        }
Пример #5
0
        private static IEmulatorWindow SetupWindow(ISettings settings, ILoggerFactory loggerFactory,
                                                   ITextRecognition recognition)
        {
            IEmulatorWindow window = settings.EmulatorType switch
            {
                EmulatorType.NoxPlayer => new NoxWindow(settings.WindowName),
                EmulatorType.BlueStacks => new BluestacksWindow(loggerFactory.CreateLogger <BluestacksWindow>(), recognition, settings.WindowName),
                _ => throw new Exception("Invalid emulator type")
            };

            try
            {
                window.Initialize();
            }
            catch (FailedToFindWindowException)
            {
                var setup = new SetupWindow();
                var vm    = new SetupViewModel(loggerFactory.CreateLogger <SetupViewModel>(), recognition, settings);
                setup.DataContext = vm;
                vm.Saved         += () =>
                {
                    setup.DialogResult = true;
                    //setup.Hide();
                };

                if (setup.ShowDialog() != true)
                {
                    Current.Shutdown();
                }

                window = SetupWindow(settings, loggerFactory, recognition);
            }

            return(window);
        }
Пример #6
0
        private void App_OnStartup(object sender, StartupEventArgs e)
        {
            this.controller = new ApplicationController(Current);
            var setupWindow = new SetupWindow(this.controller);

            setupWindow.Show();
        }
Пример #7
0
        private void App_OnStartup(object sender, StartupEventArgs e)
        {
            string commandArg = string.Empty;

            if (e.Args.Length > 0)
            {
                commandArg = e.Args[0].ToLower().Trim().Substring(0, 2);
            }

            switch (commandArg)
            {
            case "/p":     // preview
                this.Shutdown();
                break;

            case "/s":     // screensaver
                this.controller = new ApplicationController(Current);
                this.StartScreensaver();
                break;

            default:     // no argument or /c both show config
                this.controller = new ApplicationController(Current);
                var setupWindow = new SetupWindow(this.controller);
                setupWindow.Show();
                break;
            }
        }
Пример #8
0
        static void Main()
        {
            //Application.EnableVisualStyles();
            //Application.SetCompatibleTextRenderingDefault(false);
            //Application.Run(new Form1());

            string      path     = Application.ExecutablePath;
            EndogineHub endogine = new EndogineHub(path);

            string[] aAvailableStrategies = StageBase.GetAvailableRenderers();
            //Endogine.MdiParent mdiParent = new MdiParent();
            //SetupWindow wndSetup = new SetupWindow(aAvailableStrategies, mdiParent);
            SetupWindow wndSetup = new SetupWindow(aAvailableStrategies, null);

            wndSetup.ShowDialog();

            Main main = new Main();

            main.Show();

            endogine.Init(main, null, null);
            main.EndogineInitDone();

            MusicGame.Midi.Main game = new MusicGame.Midi.Main();

            while (endogine.MainLoop())
            {
                Application.DoEvents();
            }
        }
        public override void Execute(object parameter)
        {
            SetupWindow Setup = new SetupWindow();

            Setup.Show();
            //Setup.Owner = this;
        }
Пример #10
0
 public void OpenSetup(Action OnSetupFinished)
 {
     if (Data.Settings.FirstTimeSetup)
     {
         SetupWindow setupWindow = new SetupWindow(this, OnSetupFinished);
         setupWindow.Owner = App.Current.MainWindow;
         setupWindow.Show();
     }
 }
Пример #11
0
        public static void ResetAllSettings(MainWindow mainWindow)
        {
            UserSettings.DeleteSettings();
            var setupWindow = new SetupWindow();

            setupWindow.Show();

            mainWindow.Close();
        }
Пример #12
0
        public void ShowSetupDialog(MainWindow mainWindow = null)
        {
            _parent.Effect = new BlurEffect();

            var setupWindow = new SetupWindow(mainWindow)
            {
                Owner = Window.GetWindow(_parent)
            };

            setupWindow.ShowDialog();

            _parent.Effect = new DropShadowEffect();
        }
Пример #13
0
 private SetupViewModel(Entities entities)
 {
     _entities = entities;
     MoveBack = new RelayCommand<int>(LoadPreviousVehicle);
     MoveForward = new RelayCommand<int>(LoadNextVehicle);
     Save = new RelayCommand<int>(SaveVechicle);
     Close = new RelayCommand<int>((i) => _window.Close());
     Types = _entities.Types.ToList();
     _window = new SetupWindow();
     _window.DataContext = this;
     Load(_entities.Vehicles);
     _window.ShowDialog();
 }
Пример #14
0
        public void GetConnectionStringTest()
        {
            string connectionExp  = "";
            string part           = @"Data Source=(LocalDB)\MSSQLLocalDB; AttachDbFilename=";
            string getPath        = Path.GetFullPath(Path.Combine(Environment.CurrentDirectory, @"..\..\..\"));
            string connectionPath = getPath + "dbs\\GODIETCUSTINFO.MDF";
            string part2          = ";Integrated Security = True";

            connectionExp = part + connectionPath + part2;
            SetupWindow sw     = new SetupWindow();
            string      conRes = sw.GetConnectionString();

            Assert.AreEqual(connectionExp, conRes);
        }
Пример #15
0
        private void ConnectDatabase(object parameter)
        {
            log.Debug("Connect to database");

            if (DatabaseConnection.ChangeDatabase(Directory, DbName))
            {
                NotificationProvider.Info("Connected to:", ConnectedFile);
                SetupWindow?.Close();
            }
            else
            {
                NotificationProvider.Error("Connection error", "Database connection failed.");
            }
            RaisePropertyChanged("ConnectionState");
            RaisePropertyChanged("ConnectedFile");
        }
Пример #16
0
        /// <summary>
        /// Session command
        /// </summary>
        public void GoToSessionBuilder()
        {
            var window = new SetupWindow();
            var mModel = new SetupViewModel();

            window.DataContext           = mModel;
            window.WindowStartupLocation = WindowStartupLocation.CenterScreen;

            try
            {
                window.ShowDialog();
            }
            catch (NullReferenceException ex)
            {
                Console.WriteLine(ex.ToString());
            }
        }
Пример #17
0
        private void CreateDatabase(object parameter)
        {
            log.Debug("Create database");

            if (DatabaseConnection.CreateDatabase(Directory, DbName))
            {
                RaisePropertyChanged("ConnectionState");
                RaisePropertyChanged("ConnectedFile");
                CollectDbNames(Directory);
                NotificationProvider.Info("Database created", "New database: " + DbName);
                NotificationProvider.Info("Connected to:", ConnectedFile);
                SetupWindow?.Close();
            }
            else
            {
                NotificationProvider.Error("New database error", "Database creation failed.");
            }
        }
Пример #18
0
        private void btnOpenJ_Click(object sender, RoutedEventArgs e)
        {
            var openFile = new OpenFileDialog();

            openFile.FileName = CFiles.MotionParams;
            if (openFile.ShowDialog() == true)
            {
                JsonSerializer Jser    = new JsonSerializer();
                StreamReader   sr      = new StreamReader(openFile.FileName);
                JsonReader     Jreader = new JsonTextReader(sr);
                Xparam = Jser.Deserialize <MotionParams_Copy>(Jreader);
                sr.Close();
                CFiles.MotionParams = openFile.FileName;

                Xparam.CopyParams(KM.CoordMotion.MotionParams); // copy the motion parameters to the KM instance
                SetupWindow st1 = new SetupWindow(KM.CoordMotion.MotionParams);
                st1.Show();
            }
        }
Пример #19
0
        private void Form1_Load(object sender, System.EventArgs e)
        {
            m_endogine = new EndogineHub(Application.ExecutablePath);

            string[] aAvailableStrategies = StageBase.GetAvailableRenderers(null);
//			string[] aAvailableStrategies = new string[]{Enum.GetName(typeof(EndogineHub.RenderStrategy), 0), Enum.GetName(typeof(EndogineHub.RenderStrategy), 1)};
            if (Endogine.AppSettings.Instance.GetNodeText("MDI") != "false")
            {
                this.IsMdiContainer = true;
            }

            if (Endogine.AppSettings.Instance.GetNodeText("SetupDialog") != "false")
            {
                SetupWindow wndSetup = new SetupWindow(aAvailableStrategies, this);
                wndSetup.ShowDialog();
            }

            m_formStage = new Main();

            Form formMdiParent = (Form)null;

            if (this.IsMdiContainer)
            {
                this.Width            = 800;
                this.Height           = 600;
                this.WindowState      = FormWindowState.Maximized;
                formMdiParent         = this;
                m_formStage.MdiParent = this;
            }
            else
            {
                this.Visible = false;                 //TODO: this doesn't work
                this.Text    = "Should be invisible!";
            }
            //TODO: anyhow, it's strange to use a Form to start from, the project should probably be a console application.

            m_formStage.Show();

            m_endogine.Init(m_formStage, formMdiParent, this);
            m_formStage.EndogineInitDone();
        }
Пример #20
0
        private void btnSaveJ_Click(object sender, RoutedEventArgs e)
        {
            SetupWindow St2 = new SetupWindow(KM.CoordMotion.MotionParams);

            St2.Show();
        }
Пример #21
0
        private void User_ActiveEvent(int id, string name, int command)
        {
            if (command == ElementCommands.InfoModule)
            {
                Connection.SendMessage(new MessageClass(Connection.ID, id, Commands.GetInfo, 0));
            }

            if (command == ElementCommands.SendModule)
            {
                Random r   = new Random();
                int    gid = -1;
                bool   ok  = true;
                while (ok)
                {
                    ok  = false;
                    gid = r.Next(1, Int32.MaxValue / 2);
                    for (int i = 0; i < Setupers.Count; i++)
                    {
                        if (gid == Setupers[i].ID)
                        {
                            ok = true;
                        }
                    }
                }

                var setup = new SetupWindow(gid, id, name, Connection);
                Setupers.Add(setup);
                setup.Owner       = this;
                setup.CloseEvent += (SetupWindow window) =>
                {
                    Setupers.Remove(window);
                    GC.Collect();
                };
                setup.Show();
            }

            if (command == ElementCommands.VideoModule)
            {
                Random r   = new Random();
                int    gid = -1;
                bool   ok  = true;
                while (ok)
                {
                    ok  = false;
                    gid = r.Next(1, Int32.MaxValue / 2);
                    for (int i = 0; i < VideoWindows.Count; i++)
                    {
                        if (gid == VideoWindows[i].ID)
                        {
                            ok = true;
                        }
                    }
                }

                var video = new VideoWindow(gid, id, name, Connection);
                VideoWindows.Add(video);
                video.CloseEvent += (VideoWindow window) =>
                {
                    VideoWindows.Remove(window);
                    GC.Collect();
                };
                video.Show();
            }

            if (command == ElementCommands.FileModule)
            {
                Random r   = new Random();
                int    gid = -1;
                bool   ok  = true;
                while (ok)
                {
                    ok  = false;
                    gid = r.Next(1, Int32.MaxValue / 2);
                    for (int i = 0; i < VideoWindows.Count; i++)
                    {
                        if (gid == VideoWindows[i].ID)
                        {
                            ok = true;
                        }
                    }
                }

                var fileWindow = new FileWindow(gid, id, name, Connection);
                FileWindows.Add(fileWindow);
                fileWindow.CloseEvent += (FileWindow window) =>
                {
                    FileWindows.Remove(window);
                    GC.Collect();
                };
                fileWindow.Show();
            }
        }
Пример #22
0
 /// <summary>
 /// Inicia la configuración del PlugIn, esta debe ser una nueva ventana.
 /// </summary>
 public void startPluginConfiguration()
 {
     SetupWindow sw = new SetupWindow();
     sw.Closed += new EventHandler(SetupWindow_Closed);
     sw.Show();
 }