예제 #1
0
        private async void OnSetCk3Root()
        {
            using (var dlg = new System.Windows.Forms.FolderBrowserDialog()) {
                System.Windows.Forms.DialogResult result = dlg.ShowDialog();

                if (result.ToString().Equals("OK"))
                {
                    string dir     = dlg.SelectedPath;
                    string currDir = dir.Substring(dir.LastIndexOf("\\") + 1);

                    if (currDir.Equals("Crusader Kings III"))
                    {
                        coaCompFilesLoader.ck3RootDir = dir;
                        await coaCompFilesLoader.WriteCk3DirToFile();

                        // FIX THIS TRASH: MAKE BTN DISAPPEAR WHEN DIR HAS BEEN SET
                        CoaCompFilesBtnVisibility = false;
                        InitCoaComponents();
                        CoaComponentsLoader.ImportCoaComponents(coaCompFilesLoader.ck3RootDir + "\\game\\gfx\\coat_of_arms\\patterns", "./coat_of_arms/patterns", ".dds", ".png");
                        CoaComponentsLoader.ImportCoaComponents(coaCompFilesLoader.ck3RootDir + "\\game\\gfx\\coat_of_arms\\colored_emblems", "./coat_of_arms/colored_emblems", ".dds", ".png");
                        OnPropertyChanged("CoaCompFilesBtnVisibility");
                        OnPropertyChanged("CoaComponents");
                        System.Windows.MessageBox.Show("CK3 root dir set:\r\n" + coaCompFilesLoader.ck3RootDir);
                    }
                    else
                    {
                        System.Windows.MessageBox.Show("Incorrect Path");
                    }
                }

                dlg.Dispose();
            }
        }
예제 #2
0
        private void InitCoaComponents()
        {
            coaComponents = new List <string>();
            if (coaCompFilesLoader.ck3RootDir != null)
            {
                string[] files = CoaComponentsLoader.GetFileNames(coaCompFilesLoader.ck3RootDir + "\\game\\gfx\\coat_of_arms\\patterns", "*.dds");
                foreach (string file in files)
                {
                    coaComponents.Add("pa:" + file.Substring(0, file.LastIndexOf('.')) + ".png");
                }

                files = CoaComponentsLoader.GetFileNames(coaCompFilesLoader.ck3RootDir + "\\game\\gfx\\coat_of_arms\\colored_emblems", "*.dds");
                foreach (string file in files)
                {
                    coaComponents.Add("ce:" + file.Substring(0, file.LastIndexOf('.')) + ".png");
                }
            }
        }
예제 #3
0
        public CoaViewModel()
        {
            coaList = new ObservableCollection <CoaModel>();

            coaCompFilesLoader        = new CoaComponentsLoader();
            coaCompFilesBtnVisibility = CanSetCk3Root();

            DeleteCommand          = new MyICommand(OnDelete, CanDelete);
            DuplicateCommand       = new MyICommand(OnDuplicate, CanDelete);
            MoveUpCommand          = new MyICommand(OnMoveUp, CanMoveUp);
            MoveDownCommand        = new MyICommand(OnMoveDown, CanMoveDown);
            SetCk3RootCommand      = new MyICommand(OnSetCk3Root, CanSetCk3Root);
            AddCoaComponentCommand = new MyICommand(OnAddComponent, CanAddComponent);
            ExportCk3FormatCommand = new MyICommand(OnExportCk3Format, CanDelete);
            NewCoaCommand          = new MyICommand(OnNewCoa, () => { return(true); });
            ExitAppCommand         = new MyICommand(() => { System.Windows.Application.Current.Shutdown(); }, () => { return(true); });
            PickColorCommand       = new MyICommandWithParameter <string>(OnPickColor, CanPickColor);
            ChangeSL = new MyICommandWithParameter <string>(OnChangeSL, CanPickColor);

            InitCoaComponents();
        }