/// <summary> /// Initial Windows layout. /// </summary> private void Initialize() { this.Title = Properties.Settings.Default.Company + " Studio" + " ver " + GetAssemblyVersion("SerialPortCommander.exe", 3); commander = new SerialCommander("BumbleBee"); commander.LoadSetting(Properties.Settings.Default.Entry); MainGrid.DataContext = commander; //check the selected mode based on file name loaded MenuItem[] menus = new MenuItem[3] { menuModem, menuPager, menuPTX }; int index = 0; string fileName = Properties.Settings.Default.Entry.TrimEnd( System.IO.Path.GetExtension(SerialCommander.DEFAULT_FILENAME).ToCharArray()); fileName = fileName.TrimStart( System.IO.Path.GetFileNameWithoutExtension(SerialCommander.DEFAULT_FILENAME).ToCharArray()); if (fileName.Length > 0) index = Convert.ToInt32(fileName); menus[index].IsChecked = true; }
public void LoadSettingTest() { SerialCommander target = new SerialCommander("BumbleBee"); target.LoadSetting(); Assert.IsTrue(target.CommandGroups.Count > 0); }