private void frameToolStripMenuItem_Click(object sender, EventArgs e) { using (var dialog = new InputDialog<int>("Frame", previewFrame.Frame)) { if (dialog.ShowDialog() == DialogResult.OK) { previewFrame.Frame = Math.Max(0, Math.Min(Program.VideoSource.NumberOfFrames - 1, dialog.Value)); // Make sure we don't go out of bounds. } } }
void join_Click(object sender, EventArgs e) { if (m_server == null || m_client == null || m_client.m_user == null) { MessageBox.Show("错误:信息为空。"); return; } string pass = ""; if (m_room.NeedPass()) { using (InputDialog input = new InputDialog("请输入密码", true)){ if (input.ShowDialog() == DialogResult.OK) { pass += "$" + input.InputText; } else { return; } } } RoomTool.Start(m_server, m_client.m_user, m_room.Name + pass); }
private void timeToolStripMenuItem_Click(object sender, EventArgs e) { using (var dialog = new InputDialog<TimeSpan>("Time", Program.FrameToTimeSpan(previewFrame.Frame))) { if (dialog.ShowDialog() == DialogResult.OK) { int i = Program.TimeSpanToFrame(dialog.Value); i = Math.Max(0, Math.Min(Program.VideoSource.NumberOfFrames - 1, i)); // Make sure we don't go out of bounds. previewFrame.Frame = i; } } }
void CmdConvertClick(object sender, EventArgs e) { txtLog.Text = String.Format("Start Time: {0}", DateTime.Now.ToLongTimeString()); OdbcDba JetDb = new OdbcDba(); SQLiteDba SQLiteDb = new SQLiteDba(); try { File.Delete(this.SQLiteFile); } catch (IOException) { string Msg = String.Format("Cannot delete the existing SQLite file {0}", SQLiteFile); MessageBox.Show(Msg); return; } try { JetDb.ConnectMDB(this.JetSqlFile); } catch (OdbcException ex) { //TODO: this is the error code for incorrect access password. Make this a constant. if (ex.ErrorCode == -2147217843 || ex.ErrorCode == -2146232009) { DialogResult Result; InputDialog GetPassword = new InputDialog(); Result = GetPassword.ShowDialog("Enter the password for the database"); if (Result == DialogResult.OK) { try { ((OdbcDba) JetDb).ConnectMDB(JetSqlFile, GetPassword.Input); } catch (OdbcException exSecond) { if (ex.ErrorCode == -2147217843 || ex.ErrorCode == -2146232009) { MessageBox.Show("Incorrect Password"); } else { throw exSecond; } return; } finally { GetPassword.Dispose(); } } } else if (ex.ErrorCode == -2147467259) { Text = "PlaneDisaster.NET"; string Msg = String.Format("File [{0}] not found.", JetSqlFile); MessageBox.Show(Msg, "Error Opening File"); return; } else { throw ex; } } SQLiteDb.Connect(this.SQLiteFile); string [] Tables = JetDb.GetTables(); foreach (string Table in Tables ) { try { SQLiteDb.DataTable2SQLiteTable(JetDb.GetTableAsDataTable(Table)); } catch (OdbcException ex) { string Message = String.Format("{0}: {1}\n", Table, ex.Message); File.AppendAllText(String.Concat(SQLiteFile, ".log"), Message); } } JetDb.Disconnect(); SQLiteDb.Disconnect(); MessageBox.Show("Database Successfully converted."); txtLog.Text += String.Format(" End Time: {0}", DateTime.Now.ToLongTimeString()); }
private void TargetFpsLink_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { var input = new InputDialog("Target Rate", "Enter target FPS rate (higher is more cpu)"); var result = input.ShowDialog(this); if (result != DialogResult.OK) return; int rate; if(!int.TryParse(input.InputTextBox.Text, out rate)) return; if (rate <= 0 || 100 < rate) return; XRay.TargetFps = rate; Main.RedrawTimer.Interval = 1000 / rate; if (XRay.Remote != null) XRay.Remote.SendClientSettings(); RefreshContent(); }