Example #1
0
        private void LoadConfig()
        {
            var loadConfig = ConfigLoader.Load(_configPath);

            if (loadConfig != null)
            {
                outpotLogBox.Items.Add($">> Loaded config file from {_configPath}");
                _config = loadConfig;

                //Check if the configs dimensions are less than min
                if (_config.Width < MinWidth)
                {
                    _config.Width = (float)MinWidth;
                }
                else if (_config.Height < MinHeight)
                {
                    _config.Height = (float)MinHeight;
                }
            }
            else
            {
                _config = new Config();

                outpotLogBox.Items.Add(">> Config file not found! Creating new config file...");
                Directory.CreateDirectory(_configCompanyPath);
                Directory.CreateDirectory(_configApplicationPath);
            }

            ApplyConfig();
        }
Example #2
0
        private void Window_Closing(object sender, CancelEventArgs e)
        {
            MessageBoxResult result = MessageBox.Show("Are you sure you want to close? Any unsaved changes will be lost!", "Warning!", MessageBoxButton.YesNo);

            if (result == MessageBoxResult.Yes)
            {
                e.Cancel = false;
                return;
            }
            else
            {
                if (_config != null)
                {
                    ConfigLoader.Save(_config, _configPath);
                    e.Cancel = true;
                }
            }
        }