public static void SearchLyrics(CD cd) { FormProgress formProgress = new FormProgress(); formProgress.LabelProgress.Text = StringTable.SearchLyrics; formProgress.ProgressBar.Maximum = cd.Tracks.Count; formProgress.Show(); foreach (Track track in cd.Tracks) { Application.DoEvents(); string artist = (cd.Sampler) ? track.Artist : cd.Artist; string title = track.Title; if (!string.IsNullOrEmpty(artist) && !string.IsNullOrEmpty(title)) { string lyrics = Search(artist, title); track.Lyrics = lyrics; } formProgress.ProgressBar.Value++; Application.DoEvents(); } formProgress.Close(); }
public void UpdateNetwork(Network n) { try { //Create Progress Form FormProgress fp = new FormProgress(); //Create Query connection = new SQLiteConnection("Data Source=" + dbpath + ";Version=3; foreign keys=true;"); connection.Open(); command = new SQLiteCommand(connection); command.CommandText = "UPDATE network SET name=@name, inputtype=@inputtype WHERE networkNumber=@nnr ;"; command.Parameters.AddWithValue("@nnr", n.NetworkNumber); command.Parameters.AddWithValue("@name", n.Name); command.Parameters.AddWithValue("@inputtype", n.InputType); command.ExecuteNonQuery(); //drop old ip address connection to this network command.CommandText = "DELETE FROM networkipadress WHERE networkNumber=@nnr ;"; command.Parameters.AddWithValue("@nnr", n.NetworkNumber); //initialize Progress Form fp.SetMax(n.IpAddresses.Count); fp.Show(); //Add new ip-Addresses SQLiteTransaction transaction = connection.BeginTransaction(); foreach (IPAddress ip in n.IpAddresses) { try {//Write IP to table, if it is already there, throw exception command.CommandText = "INSERT INTO ipaddresses (ipaddress) VALUES(@ipaddress);"; command.Parameters.AddWithValue("@ipaddress", ip.ToString()); command.ExecuteNonQuery(); } catch (Exception e) { Log.WriteLog("Error writing IP to DB: " + e.Message); } try {//Connect ip to netwok in database command.CommandText = "INSERT INTO networkipadress (networkNumber, ipaddress) VALUES(@networkNumber, @ipaddress);"; command.Parameters.AddWithValue("@networkNumber", n.NetworkNumber); command.Parameters.AddWithValue("@ipaddress", ip.ToString()); command.ExecuteNonQuery(); } catch (Exception e) { Log.WriteLog("Error writing IP/NW to DB: " + e.Message); } fp.Progress(); } transaction.Commit(); Log.WriteLog(string.Format("Network {0} changed in database.", n.Name)); fp.Close(); } catch (Exception e) { MessageBox.Show("Error SQL Write Network", "", MessageBoxButtons.OK, MessageBoxIcon.Error); Log.WriteLog(e.Message); } connection.Close(); }
public void SaveNetwork(Network n, NetworkInventory ni) { try { //Create Progress Form FormProgress fp = new FormProgress(); //Create Query connection = new SQLiteConnection("Data Source=" + dbpath + ";Version=3; foreign keys=true;"); connection.Open(); command = new SQLiteCommand(connection); command.CommandText = "INSERT INTO network (networkNumber, name, inputtype, networkInventoryNumber) VALUES(@networkNumber, @name, @inputtype, @networkInventoryNumber);"; command.Parameters.AddWithValue("@networkNumber", n.NetworkNumber); command.Parameters.AddWithValue("@name", n.Name); command.Parameters.AddWithValue("@inputtype", n.InputType); command.Parameters.AddWithValue("@networkInventoryNumber", ni.NetworkInventoryNumber); command.ExecuteNonQuery(); SQLiteTransaction transaction = connection.BeginTransaction(); //Initialize Progress Form fp.SetMax(n.IpAddresses.Count); fp.Show(); foreach (IPAddress ip in n.IpAddresses) { try {//Write IP to table, if it is already there, throw exception command.CommandText = "INSERT INTO ipaddresses (ipaddress) VALUES(@ipaddress);"; command.Parameters.AddWithValue("@ipaddress", ip.ToString()); command.ExecuteNonQuery(); //Log.WriteLog("IPAddress {0} saved to database", ip.ToString()); } catch (Exception e) { Log.WriteLog("Error writing IP to DB: " + e.Message); } try {//Connect ip to netwok in database command.CommandText = "INSERT INTO networkipadress (networkNumber, ipaddress) VALUES(@networkNumber, @ipaddress);"; command.Parameters.AddWithValue("@networkNumber", n.NetworkNumber); command.Parameters.AddWithValue("@ipaddress", ip.ToString()); command.ExecuteNonQuery(); //Log.WriteLog("IPaddress {0} connected to network {1} in database.", ip.ToString(), n.Name); } catch (Exception e) { Log.WriteLog("Error writing IP/NW to DB: " + e.Message); } fp.Progress(); } transaction.Commit(); Log.WriteLog(string.Format("Network {0} saved to database.", n.Name)); fp.Close(); } catch (Exception e) { MessageBox.Show("Error SQL Write Network", "", MessageBoxButtons.OK, MessageBoxIcon.Error); Log.WriteLog(e.Message); } connection.Close(); }
public ProgressHelper(string title = null) { _Form = new FormProgress(title); _Form.StartPosition = FormStartPosition.CenterScreen; _Form.Show(); _Form.Refresh(); _Instance = this; }
public bool RebuildIndices(List <IClass> classes) { Thread thread = new Thread(new ParameterizedThreadStart(RebuildIndecesAsync)); FormProgress progress = new FormProgress(this, thread, classes); progress.Text = "Shrink Spatial Indices..."; progress.Show(); return(true); }
public ProgressHelper(Form owner, string title = null) { _Form = new FormProgress(title); _Form.StartPosition = FormStartPosition.CenterParent; _Form.Show(owner); _Form.Location = new Point( (owner.Width - _Form.Width) / 2 + owner.Left, (owner.Height - _Form.Height) / 2 + owner.Top); _Form.Refresh(); _Instance = this; }
private void RefreshObjects(bool AddNewsOnly) { try { var map = new DataBaseMapper(DataBaseDataSet, SelectedConnection); try { Progreso = new FormProgress(); Progreso.Show(); map.ProgressProcessChanged += ProgressProcessChanged; map.ProgressActionChanged += ProgressActionChanged; map.ProgressIncrementProcess += ProgressIncrementProcess; map.ProgressIncrementAction += ProgressIncrementAction; map.LoadAndRefreshAllObjects(true, AddNewsOnly); Progreso.Close(); Application.DoEvents(); if (map.Log.ToString() != "") { var log = new FormLog(); log.AppendText(map.Log.ToString()); log.ShowDialog(); } } catch { Progreso.Close(); Application.DoEvents(); throw; } finally { map.ProgressProcessChanged -= ProgressProcessChanged; map.ProgressActionChanged -= ProgressActionChanged; map.ProgressIncrementProcess -= ProgressIncrementProcess; map.ProgressIncrementAction -= ProgressIncrementAction; } } catch (Exception ex) { MessageBox.Show(ex.Message, Program.AssemblyTitle, MessageBoxButtons.OK, MessageBoxIcon.Error); } this.Show(); }
private void backgroundWorker1_ProgressChanged(object sender, ProgressChangedEventArgs e) { if (e.ProgressPercentage == 0 && m_Form == null) { m_Form = new FormProgress(); m_Form.Show(); } if (e.ProgressPercentage == 100 && m_Form != null) { m_Form.Close(); m_Form = null; return; } var message = (string)e.UserState; m_Form.UpdateProgress(e.ProgressPercentage, message); }
private void TransferFields() { FormProgress formProgress = new FormProgress(); Field sourceField = ((ComboBoxItem)comboBoxSourceField.SelectedItem).Field; try { formProgress.Text = StringTable.TransferFieldsRunning; formProgress.Show(); TransferFields(formProgress); } finally { formProgress.Close(); } }
private void UpdateView() { formProgress1 = new FormProgress(); formProgress1.StartPosition = FormStartPosition.Manual; formProgress1.Location = new System.Drawing.Point(this.Location.X + this.Width / 2, this.Location.Y + this.Height / 2); formProgress1.Show(); formProgress1.Refresh(); displayOptionsDialog1.OnProgress += new cbp.ProgressEventHandler(displayDirector1_OnProgress); TimeSeries.SeriesList list = input.CreateSelectedSeries(scenarioChooser1.Selected, SelectedSites()); if (list.Count > 0) { presenter.Draw(input); // displayOptionsDialog1.Draw(list, viewer1); } else { viewer1.Clear(); } }
public void Fill(Database db, ConnectionInfo ci, bool selectFirst) { isLoading = true; //trv.Nodes.Clear(); string time; var tc = new TimerCount(); using (progress = new FormProgress()) { //f.StartProgress(1, count); progress.SetMessage("Loading objects"); progress.Show(this); progress.Update(); try { tc.Next("NodeDatabase"); if (nodeDb == null) { nodeDb = new NodeDatabase(ci.Text); nodeDb.Fill(db); trv.Nodes.Add(nodeDb); trv.HandleMultiSelection = true; tc.Next("ExpandAllForce"); trv.ExpandAllForce(db); } tc.Next("DataToView"); DataToView(); tc.Next("LoadGrid"); LoadGrid(db); tc.Next("nodeDb.Expand()"); nodeDb.Expand(); if (selectFirst) { bool isSelected = false; int count = 0; var nodeTables = GetNode <NodeTables>(); foreach (NodeBase node in nodeTables.Nodes) { count++; if (node.Checked) { isSelected = true; trv.SelectedNode = node; node.EnsureVisible(); break; } } if (!isSelected) { var nodeViews = GetNode <NodeViews>(); foreach (NodeBase node in nodeViews.Nodes) { count++; if (node.Checked) { trv.SelectedNode = node; node.EnsureVisible(); break; } } } if (count <= 15) { trv.TopNode = nodeDb; } } //nodeDb.Checked = false; //nodeDb.UncheckChildren(); //nodeDb.Checked = false; time = tc.ToString(); } catch (Exception ex) { time = tc.ToString(); Program.ShowError(ex); } } //ControlUtil.ChangeFontOnlyParent(tabObjects, 12); isLoading = false; #if DEBUG2 if (db.ProviderType == EnumDbProviderType.Oracle) { Program.ShowInformation(time); } #endif }
public void Fill(Database db, ConnectionInfo ci) { isLoading = true; trv.Nodes.Clear(); string time; var tc = new TimerCount(); file.Parameters.Tables.ForEach(p => p.IsSelected = false); file.Parameters.Views.ForEach(p => p.IsSelected = false); using (progress = new FormProgress()) { //f.StartProgress(1, count); progress.SetMessage("Loading objects"); progress.Show(this); progress.Update(); try { tc.Next("NodeDatabase"); nodeDb = new NodeDatabase(ci.Text); nodeDb.Fill(db); trv.Nodes.Add(nodeDb); trv.HandleMultiSelection = true; tc.Next("ExpandAllForce"); trv.ExpandAllForce(db); tc.Next("DataToView"); DataToView(); tc.Next("LoadGrid"); LoadGrid(db); tc.Next("nodeDb.Expand()"); nodeDb.Expand(); nodeDb.Checked = false; nodeDb.UncheckChildren(); nodeDb.Checked = false; time = tc.ToString(); } catch (Exception ex) { time = tc.ToString(); Program.ShowError(ex); } } //ControlUtil.ChangeFontOnlyParent(tabObjects, 12); isLoading = false; #if DEBUG2 if (db.ProviderType == EnumDbProviderType.Oracle) { Program.ShowInformation(time); } #endif }