Ejemplo n.º 1
0
        public MainViewModel()
        {
            //Prepare commands
            NewFileCommand      = new RelayCommand(o => NewFile());
            OpenFileCommand     = new RelayCommand(o => OpenFile());
            CloseAllCommand     = new RelayCommand(o => CloseAllFiles(), o => Files.Count > 0);
            SaveAsCommand       = new RelayCommand(o => SaveFileAs(), o => SelectedFile != null);
            SaveAllCommand      = new RelayCommand(o => SaveAllFiles(), o => Files.Count > 0);
            ExitCommand         = new RelayCommand(o => Exit());
            ConfigureCommand    = new RelayCommand(o => Configure());
            CompileMapCommand   = new RelayCommand(o => Compile());
            DecompileMapCommand = new RelayCommand(o => Decompile(), o => !decompiling);

            //Check
            if (string.IsNullOrEmpty(RegistrySettings.WorkspaceDirectory))
            {
                RegistrySettings.WorkspaceDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments),
                                                                   "Abide", "Guerilla");
            }

            //Upgrade
            if (Properties.Settings.Default.UpgradeRequired)
            {
                Properties.Settings.Default.Upgrade();
                Properties.Settings.Default.UpgradeRequired = false;
            }

            //Check
            if (Properties.Settings.Default.FirstRun)
            {
                Properties.Settings.Default.FirstRun = false;
                ConfigWindow configWindow = new ConfigWindow();
                configWindow.ShowDialog();
            }

            //Check workspace
            if (!Directory.Exists(RegistrySettings.WorkspaceDirectory))
            {
                Directory.CreateDirectory(RegistrySettings.WorkspaceDirectory);
            }

            //Check maps
            string mapsDirectory = Path.Combine(RegistrySettings.WorkspaceDirectory, "maps");

            if (!Directory.Exists(mapsDirectory))
            {
                Directory.CreateDirectory(mapsDirectory);
            }

            //Check tags
            string tagsDirectory = Path.Combine(RegistrySettings.WorkspaceDirectory, "maps");

            if (!Directory.Exists(tagsDirectory))
            {
                Directory.CreateDirectory(tagsDirectory);
            }

            //Save
            Properties.Settings.Default.Save();
        }
Ejemplo n.º 2
0
        private void Configure()
        {
            //Create and show
            ConfigWindow configWindow = new ConfigWindow()
            {
                DataContext = RegistrySettings, Owner = Owner
            };

            configWindow.ShowDialog();
        }