예제 #1
0
 void Export()
 {
     ieDialog = new ImportExportDialog(ExportData.DataFromDBs(), true);
     ieDialog.ImportExportComplete += (sss, e) =>
     {
         OpenDialog ofd = new OpenDialog(false, new List <string>()
         {
             "*.cmx"
         });
         ofd.FilesOpened += (sn, ee) =>
         {
             try
             {
                 XmlLoader <ExportData> .Save(e.Data, ee.Files[0]);
             }
             catch (Exception ex)
             {
                 DebugLogger.WriteLine(ex.ToString());
             }
         };
         MainUI.MainView.AddSubview(ofd.View);
     };
     MainUI.MainView.AddSubview(ieDialog.View);
 }
예제 #2
0
 void HandleOpenButtonTouchUpInside(object sender, EventArgs e)
 {
     openDialog = new OpenDialog();
     MainUI.MainView.AddSubview(openDialog.View);
     openDialog.FilesOpened += HandleOpenDialogFilesOpened;
 }
예제 #3
0
 public ViewDelegate(OpenDialog state)
 {
     this.state = state;
 }
예제 #4
0
        void Import()
        {
            OpenDialog ofd = new OpenDialog(true, new List <string>()
            {
                "*.cmx"
            });

            ofd.FilesOpened += (sn, ee) =>
            {
                try
                {
                    ExportData data = new ExportData();
                    foreach (var x in ee.Files)
                    {
                        try
                        {
                            ExportData newData = XmlLoader <ExportData> .Load(x);

                            data.Append(newData);
                        }
                        catch (Exception ex)
                        {
                            DebugLogger.WriteLine(ex.ToString());
                        }
                    }


                    ieDialog = new ImportExportDialog(data, true);
                    ieDialog.ImportExportComplete += (sss, e) =>
                    {
                        ExportData newData = e.Data;


                        foreach (Monster m in e.Data.Monsters)
                        {
                            m.DBLoaderID = 0;
                            MonsterDB.DB.AddMonster(m);
                            Monster.Monsters.Add(m);
                        }
                        foreach (Spell s in e.Data.Spells)
                        {
                            s.DBLoaderID = 0;
                            Spell.AddCustomSpell(s);
                        }
                        foreach (Feat s in e.Data.Feats)
                        {
                            s.DBLoaderID = 0;
                            Feat.AddCustomFeat(s);
                        }
                        foreach (Condition s in e.Data.Conditions)
                        {
                            Condition.CustomConditions.Add(s);
                        }
                        if (e.Data.Conditions.Count > 0)
                        {
                            Condition.SaveCustomConditions();
                        }
                        MainUI.MainView.ReloadTabs();
                    };
                    MainUI.MainView.AddSubview(ieDialog.View);
                }
                catch (Exception ex)
                {
                    DebugLogger.WriteLine(ex.ToString());
                }
            };
            MainUI.MainView.AddSubview(ofd.View);
        }
예제 #5
0
 public ViewDataSource(OpenDialog state)
 {
     this.state = state;
 }