private void OnButtonActionClick(object sender, ListViewColumnMouseEventArgs e) { // not stored in app configuration file if (e.SubItem.Text == "LocalSqlServer") { MessageBox.Show("Can not change LocalSqlServer connection!!!"); return; } // Get current connection var projectConnection = _projectConnections .FirstOrDefault(projectConnectionItem => projectConnectionItem.Name == e.Item.Tag.ToString()); var f = new ChangeServerForm(e.SubItem.Text); try { if (f.ShowDialog() != DialogResult.OK) { return; } var ops = new ConnectionHelper(); ops.ChangeServer(projectConnection.Name, f.NewServerName); e.SubItem.Text = f.NewServerName; } finally { f.Dispose(); } }
/* * when block is selected in table it sets the current selction to that * also updates the info table to dislpay block info */ private void selBlock(object sender, ListViewColumnMouseEventArgs e) { if (!(e.Item.SubItems[0].Text == "Yard")) { blockSelected = Int32.Parse(e.Item.SubItems[0].Text) + 1; Block b = myBlockList[blockSelected - 1];//bc index starts at zero + header row updateBlockLabel.Text = b.blockNum.ToString(); if (b.isOccupied == true) { updateBlockStatLabel.Text = "Occupied"; } else { updateBlockStatLabel.Text = "Empty"; } updateSectionLabel.Text = b.section; updateLineLabel.Text = b.line; } else { trainSelectedBool = false; } }
private void EditCourse(object sender, ListViewColumnMouseEventArgs e) { var course = GetCourseFromEvent(e); var editor = new QuestionManager(Db, course); Hide(); editor.ShowDialog(); Show(); }
private void PlayCourse(object sender, ListViewColumnMouseEventArgs e) { var course = GetCourseFromEvent(e); var game = new Quiz(Db, course); Hide(); game.ShowDialog(); Show(); }
private void OnButtonAction1Click(object sender, ListViewColumnMouseEventArgs e) { if (e.Item != null) { if (MessageBox.Show("Do you really want to delete all entries of table " + e.Item.Text + "?", "Delete All Entries", MessageBoxButtons.YesNo) == DialogResult.Yes) { Database.ClearTable(e.Item.Text, db); } } }
private void EditItem(object sender, ListViewColumnMouseEventArgs e) { var question = (QuestionDto)e.Item.Tag; var editItemForm = new QuestionEditor(Db, Course, question); Hide(); editItemForm.ShowDialog(); Show(); UpdateQuestionList(); }
private void OnButtonActionClick(object sender, ListViewColumnMouseEventArgs e) { if ((e.Item != null) && (e.Item.Text == LocationDesignator.TableName)) { StationData.Database.LocationDeleteAll(); } else if ((e.Item != null) && (e.Item.Text == QRVDesignator.TableName)) { StationData.Database.QRVDeleteAll(); } }
private void DeleteItem(object sender, ListViewColumnMouseEventArgs e) { var question = (QuestionDto)e.Item.Tag; DialogResult dialogResult = MessageBox.Show($"Soll '{question.Text}' wirklich gelöscht werden?", "Sicher?", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { Db.DeleteQuestion(question); } UpdateQuestionList(); }
private void OnButtonActionClick(object sender, ListViewColumnMouseEventArgs e) { DnsPodApi.Domain tag = (DnsPodApi.Domain)e.Item.Tag; if (e.SubItem.Text == "动态解析") { new FDdns(tag).Show(); } else { new FMonitor(tag).Show(); } }
private void OnButtonActionClick(object sender, ListViewColumnMouseEventArgs e) { ListView.SelectedIndexCollection sel = walletList.SelectedIndices; if (sel.Count == 1) { ListViewItem selItem = walletList.Items[sel[0]]; AddIncome addincome = new AddIncome( this, Convert.ToInt32(table.Rows[selItem.Index]["id_wallet"]), table.Rows[selItem.Index]["name"].ToString() ); addincome.Show(); } }
private void OnButtonActionClick3(object sender, ListViewColumnMouseEventArgs e) // редактирвоане кошелька { ListView.SelectedIndexCollection sel = walletList.SelectedIndices; if (sel.Count == 1) { ListViewItem selItem = walletList.Items[sel[0]]; EditWallet testDialog = new EditWallet(Convert.ToInt32(table.Rows[selItem.Index]["id_wallet"])); // Show testDialog as a modal dialog and determine if DialogResult = OK. if (testDialog.ShowDialog(this) == DialogResult.OK) { UpdateForm(); } testDialog.Dispose(); } }
private void OnButtonActionClick(object sender, ListViewColumnMouseEventArgs e) { var cellName = e.SubItem.Name; var cellText = e.SubItem.Text; var itemIndex = e.Item.Index; if (cellText.Equals("预览") && DicPrintQueue.Keys.Contains(itemIndex)) { if (!string.IsNullOrEmpty(DicPrintQueue[itemIndex])) { PrintPreview frmPreview = new PrintPreview(DicPrintQueue[itemIndex]); frmPreview.ShowDialog(); } } if (cellText.Equals("正在打印")) { return; } if (!DicPrintQueue.Keys.Contains(itemIndex)) { if (!bgw.IsBusy) { DicPrintQueue.Add(itemIndex, string.Empty); e.SubItem.Text = "正在打印.."; bgw.RunWorkerAsync(); return; } else { e.SubItem.Text = "无空闲,请重试"; } } }
private void OnButtonActionClick(object sender, ListViewColumnMouseEventArgs e) { //MessageBox.Show(this, @"you clicked " + e.SubItem.Text); switch (e.SubItem.Text.Substring(0, 4)) { case "Indi": MessageBox.Show("Le match n'a pas encore débuté ou il n'existe pas de live pour ce match"); break; case "http": System.Diagnostics.Process.Start(e.SubItem.Text); break; case "Pas ": MessageBox.Show("Le live n'est pas prévu"); break; default: MessageBox.Show("Live prévu le " + e.SubItem.Text); break; } /*if (e.SubItem.Text==("Indisponible")) * { * MessageBox.Show("Le match n'a pas encore débuté ou il n'existe pas de live pour ce match"); * } * else if (e.SubItem.Text.Substring(0,4)=="http") * { * System.Diagnostics.Process.Start(e.SubItem.Text); * // webBrowser1.Navigate(e.SubItem.Text); * // webBrowser1.Url = new Uri(e.SubItem.Text); * } * else * { * MessageBox.Show("Live prévu le " + e.SubItem.Text); * }*/ }
/* * when train is selected in table it sets the current selction to that * also updates the info table to dislpay train info */ private void selTrain(object sender, ListViewColumnMouseEventArgs e) { String trainSelected = e.Item.SubItems[2].Text; if (!(trainSelected.Equals("-"))) { Char delimiter = ' '; String[] txtSubstrings = trainSelected.Split(delimiter); Console.WriteLine(txtSubstrings[0]); Console.WriteLine(txtSubstrings[1]); trainSelectedInt = Int32.Parse(txtSubstrings[1]); Console.WriteLine("train selected is: " + trainSelectedInt); updateTrainLabel.Text = txtSubstrings[1]; foreach (Train t in myTrainList) { if (t.trainId == trainSelectedInt) { updateSugSpeedLabel.Text = t.suggestedSpeed.ToString(); updateSugAuthLabel.Text = t.authority.ToString(); } } trainSelectedBool = true; } }
private void OnButtonDeleteClick(object sender, ListViewColumnMouseEventArgs e) { e.Item.Remove(); }
private void OnButtonAction2Click(object sender, ListViewColumnMouseEventArgs e) { if (e.Item != null) { DataTable dt; string tablename = e.Item.Text; string columns = ""; // fill DataTable with all fields except BLOBs // get table structure, very basic approach SQLiteConnection conn = Database.GetDBConnection(db); Console.WriteLine("Reading columns for table: " + tablename); try { dt = conn.GetSchema("Columns"); foreach (DataColumn col in dt.Columns) { Console.Write("[" + col.ColumnName + "] "); } Console.WriteLine("\nDumping content:"); foreach (DataRow row in dt.Rows) { for (int j = 0; j < dt.Columns.Count; j++) { Console.Write(row[j].ToString() + ","); } Console.WriteLine(); // extract all column names and types from given table if (row["TABLE_NAME"].ToString().ToLower() == tablename.ToLower()) { if (row["DATA_TYPE"].ToString().ToLower() != "blob") { columns = columns + row["COLUMN_NAME"].ToString() + ","; } } } // remove trailing "," if (columns.EndsWith(",")) { columns = columns.Remove(columns.Length - 1); } // Fill DataTable when at least one column is found if (!string.IsNullOrEmpty(columns)) { // fill DataTable dt = new DataTable(); string sql = "SELECT " + columns + " FROM " + tablename; Console.WriteLine("Initializing DataAdapter: " + sql); using (SQLiteDataAdapter dataAdapter = new SQLiteDataAdapter(sql, conn)) { dataAdapter.Fill(dt); DatabaseEditDlg Dlg = new DatabaseEditDlg(dt); Dlg.ShowDialog(); } } } catch (Exception ex) { Console.WriteLine(ex.ToString()); } } }
private CourseDto GetCourseFromEvent(ListViewColumnMouseEventArgs e) { return(new CourseDto(e.Item.Tag.ToString(), e.Item.Text)); }