Пример #1
0
        public PrototypesPage()
        {
            Resources.Add("Self", this);
            Resources.Add("OpenCommand", new DelegateCommand((sender) => {
                var dialog = new System.Windows.Forms.FolderBrowserDialog();
                var result = dialog.ShowDialog();
                if (result == System.Windows.Forms.DialogResult.OK)
                {
                    var aomDir = new AOMDirectory();
                    aomDir.Load(dialog.SelectedPath);
                    Overlord.FromAOMDirectory(aomDir, (log) => { });
                }
            }));
            Resources.Add("SaveCommand", new DelegateCommand((sender) => {
                MessageBox.Show("Saving doesnt work yet");

                /*var dialog = new SaveFileDialog() { };
                 * dialog.ShowDialog();*/
            }));
            Resources.Add("CloseCommand", new DelegateCommand((sender) => { }));
            Resources.Add("PrototypeImageCommand", new DelegateCommand((prototype) => {
                var unitSettings = new UnitPrototypeSettings()
                {
                    Prototype = prototype as PrototypeViewModel,
                };
                unitSettings.Show();
            }));

            InitializeComponent();

            /*if (string.IsNullOrWhiteSpace(Overlord.Directory)) {
             *  ((Storyboard)FileSourceGrid.Resources["FileSourceGridFlash"]).Begin();
             * }*/
        }
Пример #2
0
        public void FromAOMDirectory(AOMDirectory directory, Action <LogCapture> onLoad)
        {
            if (loaded != false)
            {
                loaded = false;
                NotifyPropertyChanged("IsLoaded", "IsNotLoaded");
            }
            TextureFile  = null;
            Texture2File = null;
            DataFile     = null;
            Data2File    = null;
            Directory    = directory;
            int    toLoad    = 0;
            Action CheckLoad = delegate {
                ++toLoad;
                if (toLoad == 6)
                {
                    Load(onLoad);
                }
            };

            LoadBar(AOMDirectory.TexturesBAR, (bar) => { TextureFile = bar; CheckLoad(); });
            LoadBar(AOMDirectory.Textures2BAR, (bar) => { Texture2File = bar; CheckLoad(); });
            LoadBar(AOMDirectory.DataBAR, (bar) => { DataFile = bar; CheckLoad(); });
            LoadBar(AOMDirectory.Data2BAR, (bar) => { Data2File = bar; CheckLoad(); });
            LoadBar(AOMDirectory.SoundsBAR, (bar) => { SoundsFile = bar; CheckLoad(); });
            LoadBar(AOMDirectory.Sounds2BAR, (bar) => { Sounds2File = bar; CheckLoad(); });
        }