private void RefreshData() { Cursor.Current = Cursors.WaitCursor; lbData.Items.Clear(); lbData.Items.Add("Retrieving data. Please wait ..."); lbData.Refresh(); string[] dataArray; if (wr == null || wr.Target == null) { dataArray = new string[DataArrayLength]; string text = " Created " + DateTime.Now.ToString("f"); for (int i = 0; i < DataArrayLength; i++) { dataArray[i] = "Element " + i.ToString() + text; } wr = new WeakReference(dataArray); } else { dataArray = (string[])wr.Target; } string [] tempStrings = new String[ItemsInListBox]; for (int i = 0; i < ItemsInListBox; i++) { tempStrings[i] = dataArray[i]; } lbData.Items.Clear(); lbData.Items.AddRange(tempStrings); Cursor.Current = Cursors.Default; }
private void sizeContextCombo_SelectedIndexChanged(object sender, System.EventArgs e) { if (m_inUpdate) { return; } var st2 = this.CurrentStrokeType as IStroke2; if (st2 != null) { st2.SizeContext = (SizeContextType)Enum.Parse(typeof(SizeContextType), (string)sizeContextCombo.SelectedValue); UpdatePreviewResult(); lineStyles.Refresh(); Changed?.Invoke(this, new EventArgs()); } }
/// <summary> /// Standard Click EventHandler for Panel pBackColor. /// </summary> /// <param name="sender">Standard sender object.</param> /// <param name="e">Standard EventArgs object.</param> private void pBackColor_Click(object sender, System.EventArgs e) { ColorDialog cd = new ColorDialog(); cd.AllowFullOpen = true; cd.AnyColor = true; cd.FullOpen = true; cd.Color = cHatchStyleBackColor; DialogResult dr = cd.ShowDialog(); if (dr == DialogResult.OK) { pBackColor.BackColor = cd.Color; cHatchStyleBackColor = cd.Color; lbHatchStyles.Refresh(); } }
public static void AddItemThreadSafe(this System.Windows.Forms.ListBox lb, object item) { if (lb.InvokeRequired) { lb.Invoke(new MethodInvoker(delegate { lb.Items.Add(item); lb.TopIndex = Math.Max(lb.Items.Count - lb.ClientSize.Height / lb.ItemHeight + 1, 0); lb.Refresh(); })); } else { lb.Items.Add(item); lb.TopIndex = Math.Max(lb.Items.Count - lb.ClientSize.Height / lb.ItemHeight + 1, 0); lb.Refresh(); } }
public void Write_to_log(ref string outstring) { //write log to log file if (outfile.Length > 0) { StreamWriter log_out_file; try { log_out_file = File.AppendText(outfile); if (cache.Count > 0) { foreach (string line in cache) { log_out_file.WriteLine(line); } cache.Clear(); } log_out_file.WriteLine(outstring); log_out_file.Flush(); log_out_file.Close(); } catch (Exception) { if (!msgbox) { string msg = string.Format(LocRM.GetString("String9"), outfile); //string msg = "Datei " + outfile + " kann nicht geöffnet werden"; MessageBox.Show(msg, "Information", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); msgbox = true; } } } else { cache.Add(outstring); } //write log to log window log_output.BeginUpdate(); if (log_output.Items.Count > maxlines) { log_output.Items.RemoveAt(0); } log_output.Items.Add(outstring); log_output.TopIndex = log_output.Items.Count - 1; log_output.EndUpdate(); log_output.Refresh(); }
public void LogMessagePrint(string msg) { if (log.InvokeRequired) { log.Invoke(new MethodInvoker(delegate() { LogMessagePrint(msg); })); } else { log.Items.Add("[" + LogGetTime() + "] : " + msg); log.Refresh(); log.SelectedIndex = log.Items.Count - 1; } }
/// <summary> /// listbox's event handler for mousedown /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void lstWeatherItemNames_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e) { //if right click then select a record if (e.Button == MouseButtons.Right) { //given the point, return the item index Point pt = new Point(e.X, e.Y); int index = lstWeatherItemNames.IndexFromPoint(pt); if (index > 0) { //select the item pointed by the index lstWeatherItemNames.ClearSelected(); lstWeatherItemNames.SelectedIndex = index; lstWeatherItemNames.Refresh(); } } }
private void cmdAdd_Click(object sender, System.EventArgs e) { Customer cust; int listNumber; cust = myCustomers.Add(txtFirstName.Text, txtLastName.Text, txtAccount.Text); listNumber = lstItems.Items.Add(cust); lstItems.Refresh(); txtFirstName.Text = string.Empty; txtLastName.Text = string.Empty; txtAccount.Text = string.Empty; }
public void WriteTrace(string info) { listBoxOutput.Items.Add(info); listBoxOutput.Refresh(); }
//======================================================== private void GenerateCode() { // Verify that output folders exist CheckDirectories(); // Build full outpath string outputPath = txtOutputPath.Text + txtProjectName.Text + "\\"; // Create dataset to hold all data DataSet ds = new DataSet("DatabaseSchema"); // Get primary/foreign key relationships ds.Tables.Add(GetRelationshipSchema()); foreach (ListViewItem item in listTables.Items) { if (item.Checked) { string tableName = item.Text.Replace("Table - ", ""); // Add schema for each table selected ds.Tables.Add(GetTableSchema(tableName)); if (true) { XmlDocument xmlSchema = GetEntitySchema(ds, tableName); // Xml Entity Schema WriteFile(xmlSchema.OuterXml, outputPath + "Xml\\" + tableName + ".xml", false); // Txt Entity Schema TransformIntoFile(xmlSchema, txtTemplatePath.Text + @"Txt\@[email protected]", outputPath + "Txt\\" + tableName + ".txt", false); if (_isSql) { // Business Logic Layer TransformIntoFile(xmlSchema, txtTemplatePath.Text + @"Biz\Biz@[email protected]", outputPath + "Biz\\Biz" + tableName + ".cs", false); // Sql Data Access Layer TransformIntoFile(xmlSchema, txtTemplatePath.Text + @"Dal\Dal@[email protected]", outputPath + "Dal\\Dal" + tableName + ".cs", false); // List Stored Procedure TransformIntoFile(xmlSchema, txtTemplatePath.Text + @"Sql\@Entity@_List.sql.xslt", outputPath + "Sql\\" + tableName + "_Verbs.sql", false); // Report Stored Procedure TransformIntoFile(xmlSchema, txtTemplatePath.Text + @"Sql\@Entity@_Report.sql.xslt", outputPath + "Sql\\" + tableName + "_Verbs.sql", true); // Select Single Stored Procedure TransformIntoFile(xmlSchema, txtTemplatePath.Text + @"Sql\@Entity@_Select.sql.xslt", outputPath + "Sql\\" + tableName + "_Verbs.sql", true); // Insert Stored Procedure TransformIntoFile(xmlSchema, txtTemplatePath.Text + @"Sql\@Entity@_Insert.sql.xslt", outputPath + "Sql\\" + tableName + "_Verbs.sql", true); // Update Stored Procedure TransformIntoFile(xmlSchema, txtTemplatePath.Text + @"Sql\@Entity@_Update.sql.xslt", outputPath + "Sql\\" + tableName + "_Verbs.sql", true); // Delete Stored Procedure TransformIntoFile(xmlSchema, txtTemplatePath.Text + @"Sql\@Entity@_Delete.sql.xslt", outputPath + "Sql\\" + tableName + "_Verbs.sql", true); // Exists Stored Procedure TransformIntoFile(xmlSchema, txtTemplatePath.Text + @"Sql\@Entity@_Exists.sql.xslt", outputPath + "Sql\\" + tableName + "_Verbs.sql", true); // List By FK Stored Procedure(s) TransformIntoFile(xmlSchema, txtTemplatePath.Text + @"Sql\@Entity@_ListByFk.sql.xslt", outputPath + "Sql\\" + tableName + "_Verbs.sql", true); // List Xml Stored Procedure //TransformIntoFile(xmlSchema, txtTemplatePath.Text + @"StoredProcs\@Entity@_XmlVerbs.sql.xslt", outputPath + "Objects\\" + tableName + "_ListXml.sql", false ); // Select Single Xml Stored Procedure //TransformIntoFile(xmlSchema, txtTemplatePath.Text + @"StoredProcs\@Entity@_XmlVerbs.sql.xslt", outputPath + "Objects\\" + tableName + "_SelectXml.sql", true ); } else { // Business Logic Layer TransformIntoFile(xmlSchema, txtTemplatePath.Text + @"Biz@[email protected]", outputPath + "Biz\\Biz" + tableName + ".cs", false); // OleDb Data Access Layer TransformIntoFile(xmlSchema, txtTemplatePath.Text + @"Dal\Ole@[email protected]", outputPath + "Dal\\Ole" + tableName + ".cs", false); } // Entity List Control Class TransformIntoHtml(xmlSchema, txtTemplatePath.Text + @"Web\Controls\@[email protected]", outputPath + "Web\\Controls\\" + tableName + "List.ascx", false); TransformIntoFile(xmlSchema, txtTemplatePath.Text + @"Web\Controls\@[email protected]", outputPath + "Web\\Controls\\" + tableName + "List.ascx.cs", false); // Entity View Control Class TransformIntoHtml(xmlSchema, txtTemplatePath.Text + @"Web\Controls\@[email protected]", outputPath + "Web\\Controls\\" + tableName + "View.ascx", false); TransformIntoFile(xmlSchema, txtTemplatePath.Text + @"Web\Controls\@[email protected]", outputPath + "Web\\Controls\\" + tableName + "View.ascx.cs", false); // Entity Edit Control Class TransformIntoHtml(xmlSchema, txtTemplatePath.Text + @"Web\Controls\@[email protected]", outputPath + "Web\\Controls\\" + tableName + "Edit.ascx", false); TransformIntoFile(xmlSchema, txtTemplatePath.Text + @"Web\Controls\@[email protected]", outputPath + "Web\\Controls\\" + tableName + "Edit.ascx.cs", false); // Entity Managment Page Interface Class TransformIntoHtml(xmlSchema, txtTemplatePath.Text + @"Web\Manage@[email protected]", outputPath + "Web\\Manage" + tableName + ".aspx", false); TransformIntoFile(xmlSchema, txtTemplatePath.Text + @"Web\Manage@[email protected]", outputPath + "Web\\Manage" + tableName + ".aspx.cs", false); } listStatus.Items.Add("- Generated table: " + tableName); listStatus.Refresh(); } } }
/// <summary> /// FillVariableListBox() /// ListBox and ComboBox both derive from ListControl /// According to Help file Items property of ListControl is Public. /// Contrary to helpfile there is no such property. /// So polymorphism could not be used as expected /// </summary> /// <param name="lbx">ListBox to be filled</param> /// <param name="scopeWord">The scope of the variable</param> protected void FillVariableListBox(ListBox lbx, VariableType scopeWord) { lbx.Items.Clear(); VariableCollection vars = this.EpiInterpreter.Context.MemoryRegion.GetVariablesInScope(scopeWord); lbx.BeginUpdate(); foreach (IVariable var in vars) { if (!(var is Epi.Fields.PredefinedDataField)) { lbx.Items.Add(var.Name.ToString()); } } lbx.EndUpdate(); lbx.Sorted = true; lbx.Refresh(); }
public void Refresh() { lbSymbols.Refresh(); DrawPreview(); }
/* private void refreshNeighborPanel(string toIgnore = null) { panelTest.Controls.Clear(); listNeighborComboBox.Clear(); listNeighborCheckBox.Clear(); listNeighborButton.Clear(); //add all the new components to the panel List<string> temp = featGraph.getFeatureNames(); int counter = 0; for (int x = 0; x < temp.Count; x++) { if (temp[x] == toIgnore) { counter = 1; continue; } CheckBox checkBoxTemp = new CheckBox(); checkBoxTemp.AutoSize = true; checkBoxTemp.Location = new System.Drawing.Point(3, 3 + (49 * (x-counter) ) ); checkBoxTemp.Name = "checkBoxNeighbor" + x.ToString(); checkBoxTemp.Size = new System.Drawing.Size(80, 17); checkBoxTemp.Text = temp[x]; checkBoxTemp.UseVisualStyleBackColor = true; panelTest.Controls.Add(checkBoxTemp); listNeighborCheckBox.Add(checkBoxTemp); ComboBox comboBoxTemp = new ComboBox(); comboBoxTemp.FormattingEnabled = true; comboBoxTemp.Location = new System.Drawing.Point(3, 25 + (49 * (x-counter) ) ); comboBoxTemp.Name = "comboBoxNeighbor" + x.ToString(); comboBoxTemp.Size = new System.Drawing.Size(141, 21); comboBoxTemp.Enabled = false; panelTest.Controls.Add(comboBoxTemp); listNeighborComboBox.Add(comboBoxTemp); Button buttonTemp = new Button(); buttonTemp.Location = new System.Drawing.Point(150, 25 + (49 * (x-counter) ) ); buttonTemp.Name = "buttonNeighbor" + x.ToString(); buttonTemp.Size = new System.Drawing.Size(44, 21); buttonTemp.TabIndex = 13; buttonTemp.Text = "Add"; buttonTemp.UseVisualStyleBackColor = true; buttonTemp.Enabled = false; panelTest.Controls.Add(buttonTemp); listNeighborButton.Add(buttonTemp); } } */ private void refreshFeatureTagListBox(ListBox toRefresh) { toRefresh.Items.Clear(); if (selectedIndex == -1) { toRefresh.Refresh(); return; } List<string> tmp = featGraph.Features[selectedIndex].getTagKeys(); for (int x = tmp.Count-1; x >= 0; x--) { toRefresh.Items.AddRange(new object[] { tmp[x] }); } toRefresh.Refresh(); }
//Helper functions to refresh listbox that contains a list of feature private void refreshFeatureListBox(ListBox toRefresh, string toIgnore = null) { toRefresh.Items.Clear(); List<string> tmp = featGraph.getFeatureNames(); for (int x = 0; x < tmp.Count; x++) { if (toIgnore != null && tmp[x] != toIgnore) { toRefresh.Items.AddRange(new object[] { tmp[x] }); } else if (toIgnore == null) { toRefresh.Items.AddRange(new object[] { tmp[x] }); } } toRefresh.Refresh(); }
private void listBox1_SizeChanged(object sender, System.EventArgs e) { /*Activity ac = (Activity)listBox1.Items[0]; * MessageBox.Show(ac.getTransferSpeed().ToString());*/ listBox1.Refresh(); }