예제 #1
0
 public void SaveSettings(DsmSettings settings)
 {
     _inMemorySettings.AskConfirmationOnDelete          = settings.AskConfirmationOnDelete;
     _inMemorySettings.AskConfirmationOnLoad            = settings.AskConfirmationOnLoad;
     _inMemorySettings.AskConfirmationOnReload          = settings.AskConfirmationOnReload;
     _inMemorySettings.AskConfirmationOnSave            = settings.AskConfirmationOnSave;
     _inMemorySettings.AskConfirmationOnSaveAs          = settings.AskConfirmationOnSaveAs;
     _inMemorySettings.AskConfirmationRestoreDocs       = settings.AskConfirmationRestoreDocs;
     _inMemorySettings.RestoreOpenedDocumentsAfterDebug = settings.RestoreOpenedDocumentsAfterDebug;
 }
예제 #2
0
 public void SaveSettings(DsmSettings settings)
 {
     _inMemorySettings.AskConfirmationOnDelete = settings.AskConfirmationOnDelete;
       _inMemorySettings.AskConfirmationOnLoad = settings.AskConfirmationOnLoad;
       _inMemorySettings.AskConfirmationOnReload = settings.AskConfirmationOnReload;
       _inMemorySettings.AskConfirmationOnSave = settings.AskConfirmationOnSave;
       _inMemorySettings.AskConfirmationOnSaveAs = settings.AskConfirmationOnSaveAs;
       _inMemorySettings.AskConfirmationRestoreDocs = settings.AskConfirmationRestoreDocs;
       _inMemorySettings.RestoreOpenedDocumentsAfterDebug = settings.RestoreOpenedDocumentsAfterDebug;
 }
예제 #3
0
 public MemorySettingsRepository()
 {
     _inMemorySettings = new DsmSettings();
       _inMemorySettings.AskConfirmationOnDelete = true;
       _inMemorySettings.AskConfirmationOnLoad = true;
       _inMemorySettings.AskConfirmationOnReload = true;
       _inMemorySettings.AskConfirmationOnSave = true;
       _inMemorySettings.AskConfirmationOnSaveAs = true;
       _inMemorySettings.AskConfirmationRestoreDocs = true;
       _inMemorySettings.RestoreOpenedDocumentsAfterDebug = true;
 }
예제 #4
0
 public MemorySettingsRepository()
 {
     _inMemorySettings = new DsmSettings();
     _inMemorySettings.AskConfirmationOnDelete          = true;
     _inMemorySettings.AskConfirmationOnLoad            = true;
     _inMemorySettings.AskConfirmationOnReload          = true;
     _inMemorySettings.AskConfirmationOnSave            = true;
     _inMemorySettings.AskConfirmationOnSaveAs          = true;
     _inMemorySettings.AskConfirmationRestoreDocs       = true;
     _inMemorySettings.RestoreOpenedDocumentsAfterDebug = true;
 }
예제 #5
0
        public DsmSettingsBuilder StartDefault()
        {
            _dsmSettings = new DsmSettings();
              _dsmSettings.AskConfirmationOnDelete = false;
              _dsmSettings.AskConfirmationOnLoad = false;
              _dsmSettings.AskConfirmationOnReload = false;
              _dsmSettings.AskConfirmationOnSave = false;
              _dsmSettings.AskConfirmationOnSaveAs = false;

              return this;
        }
        public void TestSaveAndLoadSettings()
        {
            var repo = new XmlSettingsRepository();
              var settings = new DsmSettings();
              repo.LoadSettings(settings);

              Assert.IsTrue(settings.AskConfirmationOnDelete);
              Assert.IsTrue(settings.AskConfirmationOnLoad);
              Assert.IsTrue(settings.AskConfirmationOnReload);
              Assert.IsTrue(settings.AskConfirmationOnSave);
              Assert.IsTrue(settings.AskConfirmationOnSaveAs);
              Assert.IsTrue(settings.AskConfirmationRestoreDocs);
              Assert.IsTrue(settings.RestoreOpenedDocumentsAfterDebug);
              Assert.AreEqual(10, settings.ToolBarRowIndex);
              Assert.IsTrue(settings.ToolBarVisible);
              Assert.AreEqual(-1, settings.ToolBarTop);
              Assert.AreEqual(-1, settings.ToolBarLeft);
              Assert.IsNull(settings.ToolBarPosition);

              settings.AskConfirmationOnDelete = false;
              settings.AskConfirmationOnLoad = false;
              settings.AskConfirmationOnReload = false;
              settings.AskConfirmationOnSave = false;
              settings.AskConfirmationOnSaveAs = false;
              settings.AskConfirmationRestoreDocs = false;
              settings.RestoreOpenedDocumentsAfterDebug = false;
              settings.ToolBarRowIndex = 1;
              settings.ToolBarVisible = false;
              settings.ToolBarTop = 1;
              settings.ToolBarLeft = 1;
              settings.ToolBarPosition = "something";

              repo.SaveSettings(settings);

              settings = new DsmSettings();
              repo = new XmlSettingsRepository();
              repo.LoadSettings(settings);

              Assert.IsFalse(settings.AskConfirmationOnDelete);
              Assert.IsFalse(settings.AskConfirmationOnLoad);
              Assert.IsFalse(settings.AskConfirmationOnReload);
              Assert.IsFalse(settings.AskConfirmationOnSave);
              Assert.IsFalse(settings.AskConfirmationOnSaveAs);
              Assert.IsFalse(settings.AskConfirmationRestoreDocs);
              Assert.IsFalse(settings.RestoreOpenedDocumentsAfterDebug);
              Assert.AreEqual(1, settings.ToolBarRowIndex);
              Assert.IsFalse(settings.ToolBarVisible);
              Assert.AreEqual(1, settings.ToolBarTop);
              Assert.AreEqual(1, settings.ToolBarLeft);
              Assert.AreEqual("something", settings.ToolBarPosition);
        }
예제 #7
0
        public void LoadSettings(DsmSettings settings)
        {
            var repositoryFile = getRepositoryFile();

              var settingsNode = getSettingsNode(repositoryFile);

              loadSetting("AskConfirmationOnDelete", (string s) => settings.AskConfirmationOnDelete = bool.Parse(s), settingsNode);
              loadSetting("AskConfirmationOnLoad", (string s) => settings.AskConfirmationOnLoad = bool.Parse(s), settingsNode);
              loadSetting("AskConfirmationOnReload", (string s) => settings.AskConfirmationOnReload = bool.Parse(s), settingsNode);
              loadSetting("AskConfirmationOnSave", (string s) => settings.AskConfirmationOnSave = bool.Parse(s), settingsNode);
              loadSetting("AskConfirmationOnSaveAs", (string s) => settings.AskConfirmationOnSaveAs = bool.Parse(s), settingsNode);
              loadSetting("AskConfirmationRestoreDocs", (string s) => settings.AskConfirmationRestoreDocs = bool.Parse(s), settingsNode);
              loadSetting("RestoreOpenedDocumentsAfterDebug", (string s) => settings.RestoreOpenedDocumentsAfterDebug = bool.Parse(s), settingsNode);
              loadSetting("ToolBarRowIndex", (string s) => settings.ToolBarRowIndex = int.Parse(s), settingsNode);
              loadSetting("ToolBarVisible", (string s) => settings.ToolBarVisible = bool.Parse(s), settingsNode);
              loadSetting("ToolBarPosition", (string s) => settings.ToolBarPosition = s, settingsNode);
              loadSetting("ToolBarLeft", (string s) => settings.ToolBarLeft = int.Parse(s), settingsNode);
              loadSetting("ToolBarTop", (string s) => settings.ToolBarTop = int.Parse(s), settingsNode);
              //loadSetting("ToolBarWidth", (string s) => settings.ToolBarWidth = int.Parse(s), settingsNode);
              //loadSetting("ToolBarHeight", (string s) => settings.ToolBarHeight = int.Parse(s), settingsNode);
        }
예제 #8
0
        public void LoadSettings(DsmSettings settings)
        {
            var repositoryFile = getRepositoryFile();

            var settingsNode = getSettingsNode(repositoryFile);

            loadSetting("AskConfirmationOnDelete", (string s) => settings.AskConfirmationOnDelete                   = bool.Parse(s), settingsNode);
            loadSetting("AskConfirmationOnLoad", (string s) => settings.AskConfirmationOnLoad                       = bool.Parse(s), settingsNode);
            loadSetting("AskConfirmationOnReload", (string s) => settings.AskConfirmationOnReload                   = bool.Parse(s), settingsNode);
            loadSetting("AskConfirmationOnSave", (string s) => settings.AskConfirmationOnSave                       = bool.Parse(s), settingsNode);
            loadSetting("AskConfirmationOnSaveAs", (string s) => settings.AskConfirmationOnSaveAs                   = bool.Parse(s), settingsNode);
            loadSetting("AskConfirmationRestoreDocs", (string s) => settings.AskConfirmationRestoreDocs             = bool.Parse(s), settingsNode);
            loadSetting("RestoreOpenedDocumentsAfterDebug", (string s) => settings.RestoreOpenedDocumentsAfterDebug = bool.Parse(s), settingsNode);
            loadSetting("ToolBarRowIndex", (string s) => settings.ToolBarRowIndex = int.Parse(s), settingsNode);
            loadSetting("ToolBarVisible", (string s) => settings.ToolBarVisible   = bool.Parse(s), settingsNode);
            loadSetting("ToolBarPosition", (string s) => settings.ToolBarPosition = s, settingsNode);
            loadSetting("ToolBarLeft", (string s) => settings.ToolBarLeft         = int.Parse(s), settingsNode);
            loadSetting("ToolBarTop", (string s) => settings.ToolBarTop           = int.Parse(s), settingsNode);
            //loadSetting("ToolBarWidth", (string s) => settings.ToolBarWidth = int.Parse(s), settingsNode);
            //loadSetting("ToolBarHeight", (string s) => settings.ToolBarHeight = int.Parse(s), settingsNode);
        }
예제 #9
0
        public void SaveSettings(DsmSettings settings)
        {
            var repositoryFile = getRepositoryFile();

              var settingsNode = getSettingsNode(repositoryFile);

              saveSetting("AskConfirmationOnDelete", settings.AskConfirmationOnDelete.ToString(), settingsNode);
              saveSetting("AskConfirmationOnLoad", settings.AskConfirmationOnLoad.ToString(), settingsNode);
              saveSetting("AskConfirmationOnReload", settings.AskConfirmationOnReload.ToString(), settingsNode);
              saveSetting("AskConfirmationOnSave", settings.AskConfirmationOnSave.ToString(), settingsNode);
              saveSetting("AskConfirmationOnSaveAs", settings.AskConfirmationOnSaveAs.ToString(), settingsNode);
              saveSetting("AskConfirmationRestoreDocs", settings.AskConfirmationRestoreDocs.ToString(), settingsNode);
              saveSetting("RestoreOpenedDocumentsAfterDebug", settings.RestoreOpenedDocumentsAfterDebug.ToString(), settingsNode);
              saveSetting("ToolBarRowIndex", settings.ToolBarRowIndex.ToString(), settingsNode);
              saveSetting("ToolBarVisible", settings.ToolBarVisible.ToString(), settingsNode);
              saveSetting("ToolBarPosition", settings.ToolBarPosition.ToString(), settingsNode);
              saveSetting("ToolBarLeft", settings.ToolBarLeft.ToString(), settingsNode);
              saveSetting("ToolBarTop", settings.ToolBarTop.ToString(), settingsNode);
              //saveSetting("ToolBarWidth", settings.ToolBarWidth.ToString(), settingsNode);
              //saveSetting("ToolBarHeight", settings.ToolBarHeight.ToString(), settingsNode);

              repositoryFile.Save(FilePath);
        }
예제 #10
0
        public void SaveSettings(DsmSettings settings)
        {
            var repositoryFile = getRepositoryFile();

            var settingsNode = getSettingsNode(repositoryFile);

            saveSetting("AskConfirmationOnDelete", settings.AskConfirmationOnDelete.ToString(), settingsNode);
            saveSetting("AskConfirmationOnLoad", settings.AskConfirmationOnLoad.ToString(), settingsNode);
            saveSetting("AskConfirmationOnReload", settings.AskConfirmationOnReload.ToString(), settingsNode);
            saveSetting("AskConfirmationOnSave", settings.AskConfirmationOnSave.ToString(), settingsNode);
            saveSetting("AskConfirmationOnSaveAs", settings.AskConfirmationOnSaveAs.ToString(), settingsNode);
            saveSetting("AskConfirmationRestoreDocs", settings.AskConfirmationRestoreDocs.ToString(), settingsNode);
            saveSetting("RestoreOpenedDocumentsAfterDebug", settings.RestoreOpenedDocumentsAfterDebug.ToString(), settingsNode);
            saveSetting("ToolBarRowIndex", settings.ToolBarRowIndex.ToString(), settingsNode);
            saveSetting("ToolBarVisible", settings.ToolBarVisible.ToString(), settingsNode);
            saveSetting("ToolBarPosition", settings.ToolBarPosition.ToString(), settingsNode);
            saveSetting("ToolBarLeft", settings.ToolBarLeft.ToString(), settingsNode);
            saveSetting("ToolBarTop", settings.ToolBarTop.ToString(), settingsNode);
            //saveSetting("ToolBarWidth", settings.ToolBarWidth.ToString(), settingsNode);
            //saveSetting("ToolBarHeight", settings.ToolBarHeight.ToString(), settingsNode);

            repositoryFile.Save(FilePath);
        }
예제 #11
0
        public void TestSettingsDefaultValuesAreCorrect()
        {
            var settings = new DsmSettings();

              Assert.IsTrue(settings.AskConfirmationOnDelete);
              Assert.IsTrue(settings.AskConfirmationOnLoad);
              Assert.IsTrue(settings.AskConfirmationOnReload);
              Assert.IsTrue(settings.AskConfirmationOnSave);
              Assert.IsTrue(settings.AskConfirmationOnSaveAs);
              Assert.IsTrue(settings.AskConfirmationRestoreDocs);
              Assert.IsTrue(settings.RestoreOpenedDocumentsAfterDebug);
              Assert.AreEqual(10, settings.ToolBarRowIndex);
              Assert.IsTrue(settings.ToolBarVisible);
              Assert.AreEqual(-1, settings.ToolBarTop);
              Assert.AreEqual(-1, settings.ToolBarLeft);
              Assert.IsNull(settings.ToolBarPosition);
        }