public void Should_create_folder_when_it_does_not_exist() { //Arrange var directoryPath = "ABC"; var doesFolderExist = false; var doesFileExist = true; var fileLoaderMock = new Mock <IFileLoaderAgent>(MockBehavior.Strict); fileLoaderMock.Setup(x => x.GetApplicationFolderPath()).Returns(directoryPath); fileLoaderMock.Setup(x => x.DoesDirectoryExist(directoryPath)).Returns(() => doesFolderExist).Callback(() => { doesFolderExist = true; }); fileLoaderMock.Setup(x => x.DoesFileExist(It.IsAny <string>())).Returns(() => doesFileExist).Callback(() => { doesFileExist = false; });; fileLoaderMock.Setup(x => x.CreateDirectory(directoryPath)); fileLoaderMock.Setup(x => x.DeleteFile(It.IsAny <string>())); fileLoaderMock.Setup(x => x.WriteAllText(It.IsAny <string>(), It.IsAny <string>())); fileLoaderMock.Setup(x => x.ReadAllText(It.IsAny <string>())).Returns("<a/>"); var configBusiness = new ConfigBusiness(fileLoaderMock.Object); //Act var config = configBusiness.OpenDatabaseConfig().First(); //Assert Assert.That(config, Is.Not.Null); Assert.That(config.Url, Is.EqualTo(Constants.NoConfigUrl)); Assert.That(config.Username, Is.EqualTo(null)); Assert.That(config.Password, Is.EqualTo(null)); Assert.That(config.Name, Is.EqualTo(null)); fileLoaderMock.Verify(x => x.CreateDirectory(directoryPath), Times.Once); }
public WindowsService() { _console = new ServerConsole(); ServiceName = Constants.ServiceName; //TODO: Inject before this point var configBusiness = new ConfigBusiness(new FileLoaderAgent()); configBusiness.InvalidConfigEvent += InvalidConfigEvent; var influxDbAgentLoader = new InfluxDbAgentLoader(); var counterBusiness = new CounterBusiness(); var publisherBusiness = new PublisherBusiness(); counterBusiness.GetPerformanceCounterEvent += GetPerformanceCounterEvent; CounterBusiness.ChangedCurrentCultureEvent += ChangedCurrentCultureEvent; var sendBusiness = new SendBusiness(configBusiness, new ConsoleQueueEvents(_console)); var tagLoader = new TagLoader(configBusiness); _processor = new Processor(configBusiness, counterBusiness, publisherBusiness, sendBusiness, tagLoader); _processor.EngineActionEvent += _processor_EngineActionEvent; // These Flags set whether or not to handle that specific // type of event. Set to true if you need it, false otherwise. CanHandlePowerEvent = true; CanHandleSessionChangeEvent = true; CanPauseAndContinue = true; CanShutdown = true; CanStop = true; _console.LineWrittenEvent += _console_LineWrittenEvent; }
public void Should_throw_if_group_has_no_Name() { //Arrange var fileLoaderMock = new Mock <IFileLoaderAgent>(MockBehavior.Strict); fileLoaderMock.Setup(x => x.ReadAllText(It.IsAny <string>())).Returns(() => string.Format("<CounterGroup></CounterGroup>")); var configBusiness = new ConfigBusiness(fileLoaderMock.Object); IConfig config = null; Exception exception = null; //Act try { config = configBusiness.LoadFile("myFile.xml"); } catch (Exception exp) { exception = exp; } //Assert Assert.That(config, Is.Null); Assert.That(exception, Is.Not.Null); Assert.That(exception.Message, Is.EqualTo("No Name attribute specified for the CounterGroup.")); }
public void Should_throw_if_group_SecondsInterval_is_not_numeric() { //Arrange var fileLoaderMock = new Mock <IFileLoaderAgent>(MockBehavior.Strict); fileLoaderMock.Setup(x => x.ReadAllText(It.IsAny <string>())).Returns(() => string.Format("<CounterGroup Name=\"A\" SecondsInterval=\"A\"></CounterGroup>")); var configBusiness = new ConfigBusiness(fileLoaderMock.Object); IConfig config = null; Exception exception = null; //Act try { config = configBusiness.LoadFile("myFile.xml"); } catch (Exception exp) { exception = exp; } //Assert Assert.That(config, Is.Null); Assert.That(exception, Is.Not.Null); Assert.That(exception.Message, Is.EqualTo("Cannot parse attribute SecondsInterval value to integer.")); }
public void Should_set_all_provided_values_to_the_counter() { //Arrange var counterGroupName = "AA"; var secondsInterval = 11; var counterName = "A"; var categoryName = "B"; var instanceName = "C"; var fieldName = "D"; var max = 25.5f; var fileLoaderMock = new Mock <IFileLoaderAgent>(MockBehavior.Strict); fileLoaderMock.Setup(x => x.ReadAllText(It.IsAny <string>())).Returns(() => string.Format(CultureInfo.InvariantCulture, "<{0}><Database><Url>X</Url><Username>X</Username><Password>X</Password><Name>X</Name></Database><CounterGroup Name=\"{1}\" SecondsInterval=\"{2}\"><Counter><CounterName>{3}</CounterName><CategoryName>{4}</CategoryName><InstanceName>{5}</InstanceName><FieldName>{6}</FieldName><Limits Max=\"{7}\" /></Counter></CounterGroup></{0}>", Constants.ServiceName, counterGroupName, secondsInterval, counterName, categoryName, instanceName, fieldName, max)); var configBusiness = new ConfigBusiness(fileLoaderMock.Object); Exception exception = null; //Act var config = configBusiness.LoadFile("myFile.xml"); //Assert Assert.That(config, Is.Not.Null); Assert.That(exception, Is.Null); Assert.That(config.Groups.Count, Is.EqualTo(1)); Assert.That(config.Groups.Single().Name, Is.EqualTo(counterGroupName)); Assert.That(config.Groups.Single().SecondsInterval, Is.EqualTo(secondsInterval)); Assert.That(config.Groups.Single().Counters.Count(), Is.EqualTo(1)); Assert.That(config.Groups.Single().Counters.Single().CategoryName, Is.EqualTo(categoryName)); Assert.That(config.Groups.Single().Counters.Single().CounterName.Name, Is.EqualTo(counterName)); Assert.That(config.Groups.Single().Counters.Single().InstanceName.Name, Is.EqualTo(instanceName)); Assert.That(config.Groups.Single().Counters.Single().FieldName, Is.EqualTo(fieldName)); Assert.That(config.Groups.Single().Counters.Single().Max, Is.EqualTo(max)); }
public void Should_throw_if_there_are_several_database_configuration_information() { //Arrange var fileLoaderMock = new Mock <IFileLoaderAgent>(MockBehavior.Strict); fileLoaderMock.Setup(x => x.ReadAllText("File1.xml")).Returns(() => "<Database><Url>A</Url><Username>A</Username><Password>A</Password><Name>A</Name></Database>"); fileLoaderMock.Setup(x => x.ReadAllText("File2.xml")).Returns(() => "<Database><Url>A</Url><Username>A</Username><Password>A</Password><Name>A</Name></Database>"); var configBusiness = new ConfigBusiness(fileLoaderMock.Object); IConfig config = null; Exception exception = null; //Act try { config = configBusiness.LoadFiles(new[] { "File1.xml", "File2.xml" }); } catch (Exception exp) { exception = exp; } //Assert Assert.That(config, Is.Not.Null); Assert.That(exception, Is.Null); Assert.That(config.Databases.Count, Is.EqualTo(2)); }
protected override void CreateFile(String filePath) { ConfigBusiness config = new ConfigBusiness(filePath); config.Set("DeviceType", "LaunchpadPro"); config.Set("DeviceBackGround", "#535353"); config.Set("DeviceSize", "600"); config.Set("IsMembrane", "false"); config.Save(); mw.mySettingUserControl.AddPlayer(Path.GetFileName(filePath)); }
public CompositeRoot() { ClientConsole = new ClientConsole(); InfluxDbAgentLoader = new InfluxDbAgentLoader(); FileLoaderAgent = new FileLoaderAgent(); ConfigBusiness = new ConfigBusiness(FileLoaderAgent); ConfigBusiness.InvalidConfigEvent += InvalidConfigEvent; CounterBusiness = new CounterBusiness(); PublisherBusiness = new PublisherBusiness(); SendBusiness = new SendBusiness(ConfigBusiness, InfluxDbAgentLoader); SendBusiness.SendBusinessEvent += SendBusinessEvent; TagLoader = new TagLoader(ConfigBusiness); }
public FrmMain() { InitializeComponent(); lstConfig = new List <Config>(); configBusiness = new ConfigBusiness(); lsvConfig.Columns.Add("Name", (lsvConfig.Width / 2) - 21); lsvConfig.Columns.Add("Keyword", (lsvConfig.Width / 2)); lsvStatus.Columns.Add("", lsvStatus.Width - 10); Init(); }
public CompositeRoot() { ClientConsole = new ClientConsole(); InfluxDbAgentLoader = new InfluxDbAgentLoader(); FileLoaderAgent = new FileLoaderAgent(); ConfigBusiness = new ConfigBusiness(FileLoaderAgent); ConfigBusiness.InvalidConfigEvent += InvalidConfigEvent; CounterBusiness = new CounterBusiness(); PublisherBusiness = new PublisherBusiness(); MetaDataBusiness = new MetaDataBusiness(); SendBusiness = new SendBusiness(ConfigBusiness, new ConsoleQueueEvents(ClientConsole)); TagLoader = new TagLoader(ConfigBusiness); SocketClient = new SocketClient(); }
public void Should_not_throw_if_there_is_no_database_configuration_information() { //Arrange var folderPath = "ABC"; var fileLoaderMock = new Mock <IFileLoaderAgent>(MockBehavior.Strict); fileLoaderMock.Setup(x => x.GetApplicationFolderPath()).Returns(folderPath); fileLoaderMock.Setup(x => x.DoesDirectoryExist(folderPath)).Returns(true); fileLoaderMock.Setup(x => x.DoesFileExist(It.IsAny <string>())).Returns(false); fileLoaderMock.Setup(x => x.ReadAllText(It.IsAny <string>())).Returns(() => "<A></A>"); var configBusiness = new ConfigBusiness(fileLoaderMock.Object); //Act var config = configBusiness.LoadFile("myFile.xml"); //Assert Assert.That(config, Is.Not.Null); }
public void TestMethod1() { string strConfig = @"C:\Users\thedtv\Desktop\abc.config"; string flowPath = @"C:\Users\thedtv\Desktop\Maaa\Main.xaml"; string flowSeq = @"C:\Users\thedtv\Desktop\Maaa\MainSeq.xaml"; ConfigBusiness configBusiness = new ConfigBusiness(); string[] paths = { flowPath, flowSeq }; var lstCopnfig = configBusiness.Import(strConfig); Assert.AreEqual(lstCopnfig.Count, 6); Assert.AreNotEqual(lstCopnfig[0].Keyword, ""); }
private void btnConnect_Click(object sender, EventArgs e) { var config = new Config { ServerName = txtServerName.Text, DatabaseName = txtDatabaseName.Text, UserName = txtUserName.Text, Password = txtPassword.Text }; if (checkBoxWindows.Checked) { ConfigBusiness.WindowsAuthentication(config); } else { ConfigBusiness.SqlSeverAuthentication(config); } Dispose(); }
private void showPlatformsListToolStripMenuItem_Click(object sender, EventArgs e) { try { dataGridViewPlatforms.Visible = showPlatformsListToolStripMenuItem.Checked; if (updating) { return; } ConfigBusiness.SetElementVisibility(Column.PlatformsList, dataGridViewPlatforms.Visible); } catch (OperationCanceledException ioex) { return; } catch (Exception ex) { FormCustomMessage.ShowError(ex.Message); } }
private void FormMain_ResizeEnd(object sender, EventArgs e) { try { ConfigBusiness.SetHeight(Height.ToString()); ConfigBusiness.SetWidth(Width.ToString()); int imagesHeightTotal = pictureBoxBoxart.Size.Height * 3; int heightLeft = flowLayoutPanelPictures.Size.Height - imagesHeightTotal; if (heightLeft < 25 && heightLeft > 0) { return; } if (heightLeft > 0) { int heightForEachPicture = Convert.ToInt32(heightLeft / 3) + pictureBoxBoxart.Size.Height - 6; flowLayoutPanelPictures.Size = new Size(heightForEachPicture + 6, dataGridView.Size.Height); pictureBoxBoxart.Size = new Size(heightForEachPicture, heightForEachPicture); pictureBoxTitle.Size = new Size(heightForEachPicture, heightForEachPicture); pictureBoxGameplay.Size = new Size(heightForEachPicture, heightForEachPicture); } else { int heightForEachPicture = pictureBoxBoxart.Size.Height - 6 - Convert.ToInt32(heightLeft * -1 / 3); flowLayoutPanelPictures.Size = new Size(heightForEachPicture + 6, dataGridView.Size.Height); pictureBoxBoxart.Size = new Size(heightForEachPicture, heightForEachPicture); pictureBoxTitle.Size = new Size(heightForEachPicture, heightForEachPicture); pictureBoxGameplay.Size = new Size(heightForEachPicture, heightForEachPicture); } } catch (Exception ex) { FormCustomMessage.ShowError(ex.Message); } }
private void showYearReleasedColumnToolStripMenuItem_Click(object sender, EventArgs e) { try { columnYearReleased.Visible = showYearReleasedColumnToolStripMenuItem.Checked; if (updating) { return; } ConfigBusiness.SetElementVisibility(Column.ColumnYearReleased, columnYearReleased.Visible); } catch (OperationCanceledException ioex) { return; } catch (Exception ex) { FormCustomMessage.ShowError(ex.Message); } }
public BaseController() : base() { loginBusiness = new LoginBusiness(this.GetContext()); batchBusiness = new BatchBusiness(this.GetContext()); cardBusiness = new CardBusiness(this.GetContext()); requestBusiness = new RequestBusiness(this.GetContext()); newsBusiness = new NewsBusiness(this.GetContext()); cusBusiness = new CustomerBusiness(this.GetContext()); rankBusiness = new RankBusiness(this.GetContext()); configBusiness = new ConfigBusiness(this.GetContext()); pointBusiness = new PointBusiness(this.GetContext()); warrantyBusiness = new WarrantyBusiness(this.GetContext()); statisticBus = new StatisticBusiness(this.GetContext()); orderBus = new OrderBusiness(this.GetContext()); userBusiness = new UserBusiness(this.GetContext()); itemBusiness = new ItemBusiness(this.GetContext()); productsBusiness = new ItemBusiness(this.GetContext()); notifyBusiness = new NotifyBusiness(this.GetContext()); shopBusiness = new ShopBusiness(this.GetContext()); agentBusiness = new AgentBusiness(this.GetContext()); vnpay = new VNPay(this.GetContext()); }
private void ToolStripMenuItemShowPlatformColumn_CheckedChanged(object sender, EventArgs e) { try { columnPlatform.Visible = showPlatformColumnToolStripMenuItem.Checked; if (updating) { return; } ConfigBusiness.SetElementVisibility(Column.ColumnPlatform, columnPlatform.Visible); } catch (OperationCanceledException ioex) { return; } catch (Exception ex) { FormCustomMessage.ShowError(ex.Message); } }
private void btnOk_Click(object sender, RoutedEventArgs e) { ConfigBusiness config = new ConfigBusiness(filePath); ComboBoxItem item = (ComboBoxItem)cbDeviceType.SelectedItem; config.Set("DeviceType", item.Content.ToString()); config.Set("DeviceBackGround", tbBackGround.Text); if (!Double.TryParse(tbDeviceSize.Text.Trim(), out Double iDeviceSize)) { System.Windows.Forms.MessageBox.Show("请输入正确的数字(可以为小数)!"); return; } config.Set("DeviceSize", iDeviceSize.ToString()); if (cbMembrane.IsChecked == true) { config.Set("IsMembrane", "true"); } else { config.Set("IsMembrane", "false"); } config.Save(); }
public void Should_fill_database_configuration() { //Arrange var url = "A"; var username = "******"; var password = "******"; var databaseName = "D"; var fileLoaderMock = new Mock <IFileLoaderAgent>(MockBehavior.Strict); fileLoaderMock.Setup(x => x.ReadAllText(It.IsAny <string>())).Returns(() => string.Format("<Database><Url>{0}</Url><Username>{1}</Username><Password>{2}</Password><Name>{3}</Name></Database>", url, username, password, databaseName)); var configBusiness = new ConfigBusiness(fileLoaderMock.Object); //Act var config = configBusiness.LoadFile("myFile.xml"); //Assert var database = config.Databases.First(); Assert.That(database, Is.Not.Null); Assert.That(database.Url, Is.EqualTo(url)); Assert.That(database.Username, Is.EqualTo(username)); Assert.That(database.Password, Is.EqualTo(password)); Assert.That(database.Name, Is.EqualTo(databaseName)); }
public WindowsService() { _console = new ServerConsole(); ServiceName = Constants.ServiceName; //TODO: This can be removed when the new version of Tharga.Toolkit.Console is used. One version after 1.5.13.0 will do this for you. if (!EventLog.SourceExists(ServiceName)) { EventLog.CreateEventSource(ServiceName, "Application"); } //TODO: Inject before this point var configBusiness = new ConfigBusiness(new FileLoaderAgent()); configBusiness.InvalidConfigEvent += InvalidConfigEvent; var influxDbAgentLoader = new InfluxDbAgentLoader(); var counterBusiness = new CounterBusiness(); var publisherBusiness = new PublisherBusiness(); counterBusiness.GetPerformanceCounterEvent += GetPerformanceCounterEvent; var sendBusiness = new SendBusiness(configBusiness, influxDbAgentLoader); sendBusiness.SendBusinessEvent += SendBusinessEvent; var tagLoader = new TagLoader(configBusiness); _processor = new Processor(configBusiness, counterBusiness, publisherBusiness, sendBusiness, tagLoader); _processor.EngineActionEvent += _processor_EngineActionEvent; // These Flags set whether or not to handle that specific // type of event. Set to true if you need it, false otherwise. CanHandlePowerEvent = true; CanHandleSessionChangeEvent = true; CanPauseAndContinue = true; CanShutdown = true; CanStop = true; }
private void buttonSelectCore_Click(object sender, EventArgs e) { var config = ConfigBusiness.GetFolder(Folder.Retroarch); OpenFileDialog dialog = new OpenFileDialog(); if (!string.IsNullOrEmpty(config)) { config = config + "\\" + "cores"; if (Directory.Exists(config)) { dialog.InitialDirectory = config; } } dialog.Filter = "Libreto Core | *.dll"; if (dialog.ShowDialog() == DialogResult.OK) { var corename = RomFunctions.GetFileName(dialog.FileName); textBoxCommand.Text = Values.RetroarchCommand.Replace("[CORE]", corename); textBoxEmuName.Text = RomFunctions.FillEmuName(textBoxEmuName.Text, textBoxPath.Text, checkBoxUseRetroarch.Checked, corename); } }
private void showGameplayArtToolStripMenuItem_Click(object sender, EventArgs e) { try { if (!pictureBoxGameplay.Visible && showGameplayArtToolStripMenuItem.Checked) { flowLayoutPanelPictures.Visible = true; } pictureBoxGameplay.Visible = showGameplayArtToolStripMenuItem.Checked; ConfigBusiness.SetElementVisibility(Column.GameplayArt, pictureBoxGameplay.Visible); flowLayoutPanelPictures.Visible = pictureBoxBoxart.Visible || pictureBoxTitle.Visible || pictureBoxGameplay.Visible; FormMain_ResizeEnd(sender, e); } catch (OperationCanceledException ioex) { return; } catch (Exception ex) { FormCustomMessage.ShowError(ex.Message); } }
private void checkBoxUseRetroarch_Click(object sender, EventArgs e) { //buttonSelectCore.Enabled = checkBoxUseRetroarch.Checked; //textBoxPath.Enabled = !checkBoxUseRetroarch.Checked; //textBoxCommand.Enabled = !checkBoxUseRetroarch.Checked; if (!checkBoxUseRetroarch.Checked) { textBoxPath.Text = ""; textBoxCommand.Text = ""; return; } var config = ConfigBusiness.GetFolder(Folder.Retroarch); if (string.IsNullOrEmpty(config)) { FormCustomMessage.ShowError("Retroarch folder not added. Please add on Settings menu."); return; } textBoxPath.Text = config + "\\" + "retroarch.exe"; if (!File.Exists(textBoxPath.Text)) { FormCustomMessage.ShowError("Retroarch exe not found"); return; } textBoxCommand.Text = Values.RetroarchCommand; if (textBoxCommand.Text.Contains("[CORE]")) { buttonSelectCore_Click(sender, e); } }
private void buttonSave_Click(object sender, EventArgs e) { ConfigBusiness.SetFolder(Folder.Retroarch, textBoxRetroarchFolder.Text); ConfigBusiness.SetFolder(Folder.MAME, textBoxMameFolder.Text); Close(); }
private void FormSettings_Load(object sender, EventArgs e) { buttonSave.Click += buttonSave_Click; textBoxMameFolder.Text = ConfigBusiness.GetFolder(Folder.MAME); textBoxRetroarchFolder.Text = ConfigBusiness.GetFolder(Folder.Retroarch); }
private void FormMain_Load(object sender, EventArgs e) { try { //DateTime begin = DateTime.Now; updating = true; //FormMessage.ShowMessage("Loading XML..."); Functions.InitXml(); FillPlatformGrid(); //FormMessage.ShowMessage("Loading Roms..."); columnSeries.Visible = showSeriesToolStripMenuItem.Checked = ConfigBusiness.GetElementVisibility(Column.ColumnRomSeries); columnPlatform.Visible = showPlatformColumnToolStripMenuItem.Checked = ConfigBusiness.GetElementVisibility(Column.ColumnPlatform); columnGenre.Visible = showGenreColumnToolStripMenuItem.Checked = ConfigBusiness.GetElementVisibility(Column.ColumnGenre); columnStatus.Visible = showStatusColumnToolStripMenuItem.Checked = ConfigBusiness.GetElementVisibility(Column.ColumnStatus); columnLabels.Visible = showLabelsColumnToolStripMenuItem.Checked = ConfigBusiness.GetElementVisibility(Column.ColumnLabels); columnRomDBName.Visible = showRomDBNameColumnToolStripMenuItem.Checked = ConfigBusiness.GetElementVisibility(Column.ColumnRomDBName); columnFilename.Visible = showFilenameToolStripMenuItem.Checked = ConfigBusiness.GetElementVisibility(Column.ColumnFileName); columnDeveloper.Visible = showDeveloperColumnToolStripMenuItem.Checked = ConfigBusiness.GetElementVisibility(Column.ColumnDeveloper); columnPublisher.Visible = showPublisherColumnToolStripMenuItem.Checked = ConfigBusiness.GetElementVisibility(Column.ColumnPublisher); columnYearReleased.Visible = showYearReleasedColumnToolStripMenuItem.Checked = ConfigBusiness.GetElementVisibility(Column.ColumnYearReleased); columnRating.Visible = showRatingColumnToolStripMenuItem.Checked = ConfigBusiness.GetElementVisibility(Column.ColumnRating); pictureBoxBoxart.Visible = showBoxArtToolStripMenuItem.Checked = ConfigBusiness.GetElementVisibility(Column.BoxArt); pictureBoxTitle.Visible = showTitleToolStripMenuItem.Checked = ConfigBusiness.GetElementVisibility(Column.TitleArt); pictureBoxGameplay.Visible = showGameplayArtToolStripMenuItem.Checked = ConfigBusiness.GetElementVisibility(Column.GameplayArt); dataGridViewPlatforms.Visible = showPlatformsListToolStripMenuItem.Checked = ConfigBusiness.GetElementVisibility(Column.PlatformsList); flowLayoutPanelPictures.Visible = pictureBoxBoxart.Visible || pictureBoxTitle.Visible || pictureBoxGameplay.Visible; //FormMessage.ShowMessage("Filling Grid..."); FillLabelFilter(); FillGenreFilter(); FillPublisherFilter(); FillDeveloperFilter(); FillYearReleasedFilter(); FillStatusFilter(); updating = true; Filter filter = FilterFunctions.GetFilter(); textBoxFilter.Text = filter.text; if (!string.IsNullOrEmpty(filter.textType)) { comboBoxFilter.Text = filter.textType; } if (!string.IsNullOrEmpty(filter.platform)) { comboBoxPlatform.Text = filter.platform; } if (!string.IsNullOrEmpty(filter.label)) { comboBoxLabels.Text = filter.label; } if (!string.IsNullOrEmpty(filter.genre)) { comboBoxGenre.Text = filter.genre; } if (!string.IsNullOrEmpty(filter.status)) { comboBoxStatus.Text = filter.status; } if (!string.IsNullOrEmpty(filter.developer)) { comboBoxDeveloper.Text = filter.developer; } if (!string.IsNullOrEmpty(filter.publisher)) { comboBoxPublisher.Text = filter.publisher; } if (!string.IsNullOrEmpty(filter.year)) { comboBoxYearReleased.Text = filter.year; } checkBoxFavorite.Checked = filter.favorite; checkBoxArcade.Checked = filter.arcade; checkBoxConsole.Checked = filter.console; checkBoxHandheld.Checked = filter.handheld; checkBoxCD.Checked = filter.cd; FillPlatformFilter(filter.platform); updating = false; FilterRoms(filter); dataGridView.ClearSelection(); var height = ConfigBusiness.GetHeight(); var width = ConfigBusiness.GetWidth(); if (!string.IsNullOrEmpty(height) && !string.IsNullOrEmpty(width)) { this.Height = Convert.ToInt32(height); this.Width = Convert.ToInt32(width); } if (string.IsNullOrEmpty(filter.romfile)) { SelectRandomRom(); } else { for (int i = 0; i < dataGridView.Rows.Count; i++) { if (dataGridView.Rows[i].Cells[columnPlatform.Index].Value.ToString() == filter.romplatform && dataGridView.Rows[i].Cells[columnFilename.Index].Value.ToString() == filter.romfile) { dataGridView.CurrentCell = dataGridView.Rows[i].Cells[0]; break; } } } this.textBoxFilter.TextChanged += new System.EventHandler(this.textBoxFilter_TextChanged); try { Functions.BackupDB(); } catch (Exception backupEx) { FormCustomMessage.ShowError(backupEx.Message); } //FormMessage.CloseMessage(); //DateTime end = DateTime.Now; //FormCustomMessage.Show((end - begin).ToString()); } catch (Exception ex) { FormCustomMessage.ShowError(ex.Message); } }