コード例 #1
0
ファイル: MainWindow.xaml.cs プロジェクト: Weesals/ModHQ
 private void LoadAOMDirectory(AOMDirectory dir)
 {
     //LoadBar.IsIndeterminate = true;
     //LoadBar.Visibility = Visibility.Visible;
     if (dir.Loaded)
     {
         TryingLoad.Visibility = Visibility.Visible;
         NotLoaded.Visibility  = Visibility.Collapsed;
         Overlord.FromAOMDirectory(dir, (log) => {
             string errors = log.ErrorsAsString, warnings = log.WarningsAsString, infos = log.InfosAsString;
             if (!string.IsNullOrWhiteSpace(errors) || !string.IsNullOrWhiteSpace(warnings) || !string.IsNullOrWhiteSpace(infos))
             {
                 string msg = "Load complete." +
                              (!string.IsNullOrWhiteSpace(errors) ? "\n\nErrors:\n" + errors : "") +
                              (!string.IsNullOrWhiteSpace(warnings) ? "\n\nWarnings:\n" + warnings : "") +
                              (!string.IsNullOrWhiteSpace(infos) ? "\n\nInfo:\n" + infos : "");
                 SetValue(MessagesProperty, msg);
                 Debug.WriteLine("Loaded AOM data from " + dir);
             }
             //LoadBar.IsIndeterminate = false;
             //LoadBar.Visibility = Visibility.Hidden;
             LoadError.Visibility     = Visibility.Collapsed;
             WindowContent.Visibility = Visibility.Visible;
         });
     }
     //((Storyboard)FileSourceGrid.Resources["FileSourceGridFlash"]).Stop();
 }
コード例 #2
0
ファイル: MainWindow.xaml.cs プロジェクト: Weesals/ModHQ
        public MainWindow()
        {
            Overlord     = new Overlord();
            AOMDirectory = new AOMDirectory();

            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) {
             *      LoadAOMDirectory(dialog.SelectedPath);
             *  }
             * }));
             * Resources.Add("SaveCommand", new DelegateCommand((sender) => {
             *  MessageBox.Show("Saving doesnt work yet");
             *  //var dialog = new SaveFileDialog() { };
             *  //dialog.ShowDialog();
             * }));
             * Resources.Add("PrototypeImageCommand", new DelegateCommand((prototype) => {
             *  var unitSettings = new UnitPrototypeSettings() {
             *      Prototype = prototype as PrototypeViewModel,
             *  };
             *  unitSettings.Show();
             * }));*/
            Resources.Add("CloseCommand", new DelegateCommand((sender) => { this.Close(); }));

            InitializeComponent();

            //SetValue(PrototypesProperty, protoXml);

            Loaded += delegate {
                AOMDirectory.Enumerate();
                //dir.Load();
                //LoadAOMDirectory(dir);
            };

            /*KeyDown += (s, e) => {
             *  if (e.Key >= Key.D0 && e.Key <= Key.D9) {
             *      SetValue(SelectedItemProperty, protoXml.Prototypes[(int)e.Key - (int)Key.D0]);
             *  }
             * };*/

            //DwmDropShadow.DropShadowToWindow(this);
        }