public void TestToolbarGetSetting() { XPathHandler handler = new XPathHandler(@"../../TestData/config.xml"); ToolbarSetting settingToolStripFile = new ToolbarSetting(handler); settingToolStripFile.GetSetting("toolStripFile"); Assert.AreEqual("toolStripFile", settingToolStripFile.Name); Assert.AreEqual(3, settingToolStripFile.X); Assert.AreEqual(24, settingToolStripFile.Y); Assert.AreEqual(true, settingToolStripFile.Visible); }
public void TestToolbarSaveSettinAndGetSetting() { XPathHandler handler = new XPathHandler(@"../../TestData/configWriteTemp.xml"); ToolbarSetting settingToolStripFileFirst = new ToolbarSetting(handler); settingToolStripFileFirst.GetSetting("toolStripFile"); ToolbarSetting settingToolStripFileSave = new ToolbarSetting(handler); settingToolStripFileSave.Name = "toolStripFile"; settingToolStripFileSave.X = settingToolStripFileFirst.X + 1; settingToolStripFileSave.Y = settingToolStripFileFirst.Y + 1; settingToolStripFileSave.Visible = !settingToolStripFileFirst.Visible; settingToolStripFileSave.SaveSetting(); ToolbarSetting settingToolStripFileSecond = new ToolbarSetting(handler); settingToolStripFileSecond.GetSetting("toolStripFile"); Assert.AreEqual(settingToolStripFileSave.Name, settingToolStripFileSecond.Name); Assert.AreEqual(settingToolStripFileSave.X, settingToolStripFileSecond.X); Assert.AreEqual(settingToolStripFileSave.Y, settingToolStripFileSecond.Y); Assert.AreEqual(settingToolStripFileSave.Visible, settingToolStripFileSecond.Visible); }
/// <summary> /// Called when MainForm is starting. /// Setting positions for MainForm and Toolbars. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void MainFormLoad(object sender, EventArgs e) { // Setting MainForm starting values FormSetting mainFormSetting = new FormSetting(_handler); mainFormSetting.GetSetting("MainForm"); if (mainFormSetting.X == -1 || mainFormSetting.Y == -1) StartPosition = FormStartPosition.CenterScreen; else Location = new Point(mainFormSetting.X, mainFormSetting.Y); Width = mainFormSetting.Width; Height = mainFormSetting.Height; // Setting toolStripFile starting values ToolbarSetting settingToolStripFile = new ToolbarSetting(_handler); settingToolStripFile.GetSetting("toolStripFile"); if (settingToolStripFile.X == -1 || settingToolStripFile.Y == -1) toolStripFile.Location = new Point(3, 24); else toolStripFile.Location = new Point(settingToolStripFile.X, settingToolStripFile.Y); toolStripFile.Visible = settingToolStripFile.Visible; mainMenuViewToolbarsFile.Checked = toolStripFile.Visible; contextMenuFile.Checked = toolStripFile.Visible; // Setting toolStripSums starting values ToolbarSetting settingToolStripSums = new ToolbarSetting(_handler); settingToolStripSums.GetSetting("toolStripSums"); if (settingToolStripSums.X == -1 || settingToolStripSums.Y == -1) toolStripSums.Location = new Point(3, 49); else toolStripSums.Location = new Point(settingToolStripSums.X, settingToolStripSums.Y); toolStripSums.Visible = settingToolStripSums.Visible; mainMenuViewToolbarsSums.Checked = toolStripSums.Visible; contextMenuSums.Checked = toolStripSums.Visible; // Setting statusStrip1 starting values StatusbarSetting settingStatusStrip1 = new StatusbarSetting(_handler); settingStatusStrip1.GetSetting("statusStrip1"); statusStrip1.Visible = settingStatusStrip1.Visible; mainMenuViewStatusBar.Checked = statusStrip1.Visible; // Setting columnSize starting values ColumnSetting settingColumnSize = new ColumnSetting(_handler); settingColumnSize.GetSetting("columnSize"); columnSize.DisplayIndex = settingColumnSize.DisplayIndex; columnSize.Width = settingColumnSize.Width; // Setting columnFullpath starting values ColumnSetting settingColumnFullpath = new ColumnSetting(_handler); settingColumnFullpath.GetSetting("columnFullpath"); columnFullpath.DisplayIndex = settingColumnFullpath.DisplayIndex; columnFullpath.Width = settingColumnFullpath.Width; //Setting columnVerified starting values ColumnSetting settingColumnVerified = new ColumnSetting(_handler); settingColumnVerified.GetSetting("columnVerified"); columnVerified.DisplayIndex = settingColumnVerified.DisplayIndex; columnVerified.Width = settingColumnVerified.Width; // Setting columnType starting values ColumnSetting settingColumnType = new ColumnSetting(_handler); settingColumnType.GetSetting("columnType"); columnType.DisplayIndex = settingColumnType.DisplayIndex; columnType.Width = settingColumnType.Width; // Setting columnFilename starting values ColumnSetting settingColumnFilename = new ColumnSetting(_handler); settingColumnFilename.GetSetting("columnFilename"); columnFilename.DisplayIndex = settingColumnFilename.DisplayIndex; columnFilename.Width = settingColumnFilename.Width; UpdateViewMenuItems(); }