コード例 #1
0
 public ActiveListManagementWindow(IGauntletDbAdapter sqliteDb)
 {
     InitializeComponent();
     //this._mySqlDb = mySqlDb;
     this._sqliteDb = sqliteDb;
     //LoadDbLists(mySqlDb);
 }
コード例 #2
0
        private void LoadDbLists(IGauntletDbAdapter db)
        {
            _activeCol = new ObservableCollection<ToDoList>(db.GetLists(true));
            _inactiveCol = new ObservableCollection<ToDoList>(db.GetLists(false));
            lvActive.ItemsSource = _activeCol;
            lvInactive.ItemsSource = _inactiveCol;

            IsChanged = false;
            tbDbName.Text = GetDbName(db);
        }
コード例 #3
0
        private string GetDbName(IGauntletDbAdapter db)
        {
            string name = "[unknown db]";

            //if (db.Equals(_mySqlDb))
            //{
            //    return "MySQL";
            //}

            if (db.Equals(_sqliteDb))
            {
                return "SQLite";
            }

            return name;
        }
コード例 #4
0
 public void Configure(MenuController mc,
                       IListMatrix ilm,
                       IGauntletDbAdapter sqliteDb,
                       StoryboardStatusBar statusBar)
 {
     this.ilm = ilm;
     this.sqliteDb = sqliteDb;
     this.statusBar = statusBar;
     mc.AddMenuItem("Gauntlet", "Export Active SQLite Lists To FileSystem Sync Folder", ExportActiveSqliteLists);
     //mc.AddMenuItem("Gauntlet", "Export Active MySQL Lists To FileSystem Sync Folder", ExportActiveMySqlLists);
     mc.AddMenuItem("Gauntlet", "Active List Management", ShowActiveListManagement);
     mc.AddMenuItem("Gauntlet", "Import Synced Files", ImportSyncedFiles);
     mc.AddMenuItem("Gauntlet", "Import Synced Archive Files", ImportSyncedArchiveFiles);
     mc.AddMenuItem("Gauntlet", "Consume All Imported Files", ConsumeAllImportedFiles);
     mc.AddMenuItem("Tools", "FileMatrix...", LaunchFileMatrix);
     mc.AddMenuItem("Tools", "ObjectGrid...", LaunchObjectGrid);
 }
コード例 #5
0
 public void ConfigureWithoutUI(IListMatrix ilm, IGauntletDbAdapter db)
 {
     this.ilm = ilm;
     //this.mysqlDb = db;
     this.statusBar = new StoryboardStatusBar(); //this prevents null exceptions where status is logged
 }
コード例 #6
0
        private void ExportActiveLists(IGauntletDbAdapter db)
        {
            int foundCount = 0;

            Configuration.EnsureDirectories();

            foreach (ToDoList lst in db.GetLists(true))
            {
                string phoneListPath = Configuration.GetPhoneSyncSynergyFilePath(lst.Name);
                string tabletListPath = Configuration.SynergyV3SyncFilePath("galaxy-a", lst.Name);
                string logosListPath = Configuration.SynergyV3SyncFilePath("logos", lst.Name);

                WriteListToPath(lst, phoneListPath, foundCount);
                WriteListToPath(lst, tabletListPath, foundCount);
                WriteListToPath(lst, logosListPath, foundCount);

                //if (!File.Exists(phoneListPath))
                //{
                //    File.WriteAllLines(phoneListPath, lst.Items.ToFragmentArray());
                //}
                //else
                //{
                //    foundCount++;
                //}

                //if (!File.Exists(tabletListPath))
                //{
                //    File.WriteAllLines(tabletListPath, lst.Items.ToFragmentArray());
                //}
                //else
                //{
                //    foundCount++;
                //}

                //if (!File.Exists(logosListPath))
                //{
                //    File.WriteAllLines(logosListPath, lst.Items.ToFragmentArray());
                //}
                //else
                //{
                //    foundCount++;
                //}
            }

            if (foundCount > 0)
            {
                MessageBox.Show(foundCount +
                    " files already existed and were ignored. " +
                    "To export fresh versions of all lists, first" +
                    " consume all files then export again.");
            }

            statusBar.StatusBarText = "Files Exported.";
        }
コード例 #7
0
        private void UpdateDbActiveInactive(IGauntletDbAdapter db, IEnumerable<ToDoList> setToActive, IEnumerable<ToDoList> setToInactive)
        {
            db.UpdateActiveInactive(setToActive, setToInactive);

            try
            {
                LoadDbLists(db);
            }
            catch (Exception ex)
            {
                Display.Exception(ex);
            }
        }
コード例 #8
0
        private void UpdateDb(IGauntletDbAdapter db)
        {
            foreach (ToDoList tdl in _activeCol)
            {
                db.SetActive(tdl.Name, true);
            }

            foreach (ToDoList tdl in _inactiveCol)
            {
                db.SetActive(tdl.Name, false);
            }

            LoadDbLists(db);
        }