Ejemplo n.º 1
0
        private void ShowInitWindow()
        {
            InitWindow init = new InitWindow();

            Application.Current.MainWindow = init;
            init.ShowDialog();
        }
Ejemplo n.º 2
0
 public ImageControler(Scene scene)
 {
     InputFormControler = new InputFormControler(scene, this);
     Scene           = scene;
     InitWindow      = new InitWindow(this, InputFormControler);
     FileManipulator = new FileManipulator(scene);
     RenderManager   = new RenderManager(scene, FileManipulator, this);
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Metoda urcena pro nastaveni hodnot pred zacatkem renderovani.
        /// A spusteni vlakna pro samotne renderovani
        ///
        /// </summary>
        /// <param name="x"></param>
        /// <param name="y"></param>
        public void RenderImage(double x, double y)
        {
            Scene.Camera.eye.X = x;
            Scene.Camera.eye.Y = y;
            InitWindow.SetRenderingStatus();
            var th = new Thread(new ThreadStart(RenderManager.RenderingPicture));

            th.IsBackground = true;

            th.Start();
        }
Ejemplo n.º 4
0
        private void App_OnStartup(object sender, StartupEventArgs e)
        {
            mainWindow = new InitWindow();
            Task.Run(async() =>
            {
                await Task.Delay(1000);
                await InitApp();
            });


            mainWindow.Show();
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 初始化数据库连接字符串
        /// </summary>
        /// <param name="password"></param>
        /// <returns></returns>
        public static bool InitSql(string password = "")
        {
            string dbpath = new Settings().DBPath;
            if (dbpath.Length <= 0 || !File.Exists(dbpath))
            {
                InitWindow initWin = new InitWindow();
                initWin.ShowDialog();
                dbpath = new Settings().DBPath;
            }
            if (!File.Exists(dbpath)) return false;
            SQLiteHelper.ConStr.DataSource = dbpath;
            SQLiteHelper.ConStr.Password = password;

            return true;
        }
Ejemplo n.º 6
0
        private static bool HandleInitDataGeneration(InitWindow init, IContainer container)
        {
            if (init?.DataContext is InitViewModel vm)
            {
                if (vm.CanStartApplication)
                {
                    using (new MeasureTimeWrapper(() => vm.GenerateData(container.Resolve <ICommandDispatcher>()), "GenerateData")) { }
                }
                else
                {
                    Current.Shutdown();
                    return(true);
                }
            }

            return(false);
        }
Ejemplo n.º 7
0
        private async Task <InitWindow> HandleApplicationInit(ContainerBuilder builder)
        {
            InitWindow init = null;

            if (File.Exists(DatabaseFilepath))
            {
                if (Settings.Default.BackupDataBaseOnStart)
                {
                    _databaseBackuper.Backup();
                }
                string connectionString = $"Filename={DatabaseFilepath};Journal=true";
                if (Settings.Default.IsPasswordNeeded)
                {
                    var passwordWindow = new PasswordPromptWindow();
                    await passwordWindow.ShowBlocking();

                    if (passwordWindow.Success)
                    {
                        string password = string.Empty;
                        using (new MeasureTimeWrapper(
                                   () => password = passwordWindow.PasswordText.Encrypt(), "Password encryption")) { }

                        connectionString += $";password={password}";
                    }
                    else
                    {
                        _logger.Value.Debug("Password window closed by user");
                        Current.Shutdown();
                        return(null);
                    }
                }

                builder.Register(x => connectionString).Keyed <string>(DatabaseCommunicationModule.DB_KEY);
            }
            else
            {
                init = new InitWindow(builder, DatabaseFilepath);
                await init.ShowBlocking();
            }

            return(init);
        }
Ejemplo n.º 8
0
 /// <summary>
 /// Metoda pro prekresleni platna v uvodnim okne
 /// </summary>
 internal void RepaintCanvas()
 {
     InitWindow.RepaintCanvas();
 }
Ejemplo n.º 9
0
        public void ParseConfigIncoming(List <string> cfg, int confId)
        {
            // iterate through each line
            foreach (string s in cfg.Where(a => (a != "" || a != "\r" || a != "\n")))
            {
                // split to array based on whitespace
                string   st  = s.Trim().Replace("\r", "").Replace("\n\r", "").Replace("\r\n", "").Replace("\n", "");
                string[] arr = st.Split(' ');
                // normal (non controller) settings should only have 2 items in the array
                if (arr.Length != 2)
                {
                    continue;
                }
                string propName  = arr[0].Replace(".", "__");
                string propValue = arr[1];

                // ignore .keys
                if (propName.StartsWith("."))
                {
                    continue;
                }

                // look for property in the configbasesettings
                PropertyInfo p = _ConfigBaseSettings.GetType().GetProperty(propName);
                if (p != null)
                {
                    if (confId == 0)
                    {
                        // this is for the base config

                        // filter out the system specific entries and update the correct config object
                        if (s.StartsWith("gb."))
                        {
                            InitWindow.SetPropertyValue(_ConfigGbSettings, p, null, arr[1]);
                            continue;
                        }
                        if (s.StartsWith("gba."))
                        {
                            InitWindow.SetPropertyValue(_ConfigGbaSettings, p, null, arr[1]);
                            continue;
                        }
                        if (s.StartsWith("lynx."))
                        {
                            InitWindow.SetPropertyValue(_ConfigLynxSettings, p, null, arr[1]);
                            continue;
                        }
                        if (s.StartsWith("md."))
                        {
                            InitWindow.SetPropertyValue(_ConfigMdSettings, p, null, arr[1]);
                            continue;
                        }
                        if (s.StartsWith("gg."))
                        {
                            InitWindow.SetPropertyValue(_ConfigGgSettings, p, null, arr[1]);
                            continue;
                        }
                        if (s.StartsWith("ngp."))
                        {
                            InitWindow.SetPropertyValue(_ConfigNgpSettings, p, null, arr[1]);
                            continue;
                        }
                        if (s.StartsWith("pce."))
                        {
                            InitWindow.SetPropertyValue(_ConfigPceSettings, p, null, arr[1]);
                            continue;
                        }
                        if (s.StartsWith("pcfx."))
                        {
                            InitWindow.SetPropertyValue(_ConfigPcfxSettings, p, null, arr[1]);
                            continue;
                        }
                        if (s.StartsWith("psx."))
                        {
                            InitWindow.SetPropertyValue(_ConfigPsxSettings, p, null, arr[1]);
                            continue;
                        }
                        if (s.StartsWith("sms."))
                        {
                            InitWindow.SetPropertyValue(_ConfigSmsSettings, p, null, arr[1]);
                            continue;
                        }
                        if (s.StartsWith("nes."))
                        {
                            InitWindow.SetPropertyValue(_ConfigNesSettings, p, null, arr[1]);
                            continue;
                        }
                        if (s.StartsWith("snes."))
                        {
                            InitWindow.SetPropertyValue(_ConfigSnesSettings, p, null, arr[1]);
                            continue;
                        }
                        if (s.StartsWith("ss."))
                        {
                            InitWindow.SetPropertyValue(_ConfigSsSettings, p, null, arr[1]);
                            continue;
                        }
                        if (s.StartsWith("vb."))
                        {
                            InitWindow.SetPropertyValue(_ConfigVbSettings, p, null, arr[1]);
                            continue;
                        }
                        if (s.StartsWith("wswan."))
                        {
                            InitWindow.SetPropertyValue(_ConfigWswanSettings, p, null, arr[1]);
                            continue;
                        }
                        if (s.StartsWith("snes_faust."))
                        {
                            InitWindow.SetPropertyValue(_ConfigSnes_faustSettings, p, null, arr[1]);
                            continue;
                        }
                        if (s.StartsWith("pce_fast."))
                        {
                            InitWindow.SetPropertyValue(_ConfigPce_fastSettings, p, null, arr[1]);
                            continue;
                        }

                        // now we should just be left with generic config commands. At this time we will apply them to all configs
                        InitWindow.SetPropertyValue(_ConfigGbSettings, p, null, arr[1]);
                        InitWindow.SetPropertyValue(_ConfigGbaSettings, p, null, arr[1]);
                        InitWindow.SetPropertyValue(_ConfigLynxSettings, p, null, arr[1]);
                        InitWindow.SetPropertyValue(_ConfigMdSettings, p, null, arr[1]);
                        InitWindow.SetPropertyValue(_ConfigGgSettings, p, null, arr[1]);
                        InitWindow.SetPropertyValue(_ConfigNgpSettings, p, null, arr[1]);
                        InitWindow.SetPropertyValue(_ConfigPceSettings, p, null, arr[1]);
                        InitWindow.SetPropertyValue(_ConfigPcfxSettings, p, null, arr[1]);
                        InitWindow.SetPropertyValue(_ConfigPsxSettings, p, null, arr[1]);
                        InitWindow.SetPropertyValue(_ConfigSmsSettings, p, null, arr[1]);
                        InitWindow.SetPropertyValue(_ConfigNesSettings, p, null, arr[1]);
                        InitWindow.SetPropertyValue(_ConfigSnesSettings, p, null, arr[1]);
                        InitWindow.SetPropertyValue(_ConfigSsSettings, p, null, arr[1]);
                        InitWindow.SetPropertyValue(_ConfigVbSettings, p, null, arr[1]);
                        InitWindow.SetPropertyValue(_ConfigWswanSettings, p, null, arr[1]);
                        InitWindow.SetPropertyValue(_ConfigSnes_faustSettings, p, null, arr[1]);
                        InitWindow.SetPropertyValue(_ConfigPce_fastSettings, p, null, arr[1]);
                        continue;
                    }

                    else
                    {
                        // this is a system.cfg file
                        switch (confId)
                        {
                        case 2000000001:
                            InitWindow.SetPropertyValue(_ConfigGbSettings, p, null, arr[1]);
                            break;

                        case 2000000002:
                            InitWindow.SetPropertyValue(_ConfigGbaSettings, p, null, arr[1]);
                            break;

                        case 2000000003:
                            InitWindow.SetPropertyValue(_ConfigLynxSettings, p, null, arr[1]);
                            break;

                        case 2000000004:
                            InitWindow.SetPropertyValue(_ConfigMdSettings, p, null, arr[1]);
                            break;

                        case 2000000005:
                            InitWindow.SetPropertyValue(_ConfigGgSettings, p, null, arr[1]);
                            break;

                        case 2000000006:
                            InitWindow.SetPropertyValue(_ConfigNgpSettings, p, null, arr[1]);
                            break;

                        case 2000000007:
                            InitWindow.SetPropertyValue(_ConfigPceSettings, p, null, arr[1]);
                            break;

                        case 2000000008:
                            InitWindow.SetPropertyValue(_ConfigPcfxSettings, p, null, arr[1]);
                            break;

                        case 2000000009:
                            InitWindow.SetPropertyValue(_ConfigPsxSettings, p, null, arr[1]);
                            break;

                        case 2000000010:
                            InitWindow.SetPropertyValue(_ConfigSmsSettings, p, null, arr[1]);
                            break;

                        case 2000000011:
                            InitWindow.SetPropertyValue(_ConfigNesSettings, p, null, arr[1]);
                            break;

                        case 2000000012:
                            InitWindow.SetPropertyValue(_ConfigSnesSettings, p, null, arr[1]);
                            break;

                        case 2000000013:
                            InitWindow.SetPropertyValue(_ConfigSsSettings, p, null, arr[1]);
                            break;

                        case 2000000014:
                            InitWindow.SetPropertyValue(_ConfigVbSettings, p, null, arr[1]);
                            break;

                        case 2000000015:
                            InitWindow.SetPropertyValue(_ConfigWswanSettings, p, null, arr[1]);
                            break;

                        case 2000000016:
                            InitWindow.SetPropertyValue(_ConfigSnes_faustSettings, p, null, arr[1]);
                            break;

                        case 2000000017:
                            InitWindow.SetPropertyValue(_ConfigPce_fastSettings, p, null, arr[1]);
                            break;
                        }
                    }
                }
                // look for property in confignetplaysettings
                PropertyInfo n = _ConfigNetplaySettings.GetType().GetProperty(propName);
                if (n != null)
                {
                    // property was found - update config
                    InitWindow.SetPropertyValue(_ConfigNetplaySettings, n, null, arr[1]);
                    continue;
                }

                // look for property in configserversettings
                PropertyInfo ser = _ConfigServerSettings.GetType().GetProperty(propName);
                if (ser != null)
                {
                    // property was found - update config
                    InitWindow.SetPropertyValue(_ConfigServerSettings, ser, null, arr[1]);
                    continue;
                }
            }
        }
Ejemplo n.º 10
0
        private void SwitchToLobby()
        {
            InitWindow window = (InitWindow)Window.GetWindow(this);

            window.SwitchToLobby();
        }