/// <summary> /// Opens a small window to prompt for the added stock value /// </summary> private void AddStock(object sender, RoutedEventArgs e) { // Creates a new dialig, with custom cancel text, submit text and add stock title text var dialog = new MyDialog(LangResource.Cancel, LangResource.Submit, LangResource.AddStockTitle); // If the submit buttonn was clicked in the dialog if (dialog.ShowDialog() == true) { // Try to parse the value to an integer if (int.TryParse(dialog.ResponseText, out int response)) { // If the result is bigger than 0, add the response to the stock of the product, and update the CurrentStock. if (response > 0) { var product = ((FrameworkElement)sender).DataContext as ProductOverviewItem; Product toBeUpdated = _prodRepo.Get(product.ID); toBeUpdated.CurrentStock += response; product.CurrentStock += response; _prodRepo.Update(toBeUpdated); _prodRepo.SaveChangesAsync(); BindData(); } } } }
private void button1_Click(object sender, EventArgs e) { MyError.NewRecord(); if (textBox1.Text == "") { MyError.Set(textBox1, "!!!"); } else { MyError.Clear(textBox1); } if (textBox2.Text == "") { MyError.Set(textBox2, "!!!"); } else { MyError.Clear(textBox2); } if (MyError.CheckAll()) { MyDialog.Msg(""); } }
private void add_order(object sender, RoutedEventArgs e) { MyDialog dialog = new MyDialog(typeof(OrderObj), "添加订单信息"); dialog.ShowDialog(); if (dialog.DialogResult == false) { return; } ObservableCollection <OrderObj> newList = dialog.getObjectList(); List <String> errorList = new List <string>(); foreach (var item in newList) { int operatorCode = helper.Order_add(item.订单号.Trim(), item.销售日期.ToString().Trim(), item.货物编号.Trim(), item.客户编号.Trim(), item.员工编号.Trim(), item.货物数量.ToString().Trim()); if (operatorCode == 0) { resetList(); return; } else { errorList.Add(item.订单号 + " : " + Sql.ErrorCodeToString(operatorCode)); } } if (errorList.Count != 0) { MessageBox.Show(MainWindow.MakeErrorString(errorList), "订单添加出错"); } }
public void ListView_AddPlaylist(object sender, RoutedEventArgs routedEventArgs, MediaElement media, TreeView treePlaylist, ListView list, String fgList, bool diapo) { String caption; if (diapo) { caption = "diaporama"; } else { caption = "playlist"; } String name = MyDialog.Prompt("Create a " + caption, "Enter the " + caption + "'s name", MyDialog.Size.Normal); if (String.IsNullOrEmpty(name)) { MessageBox.Show("Incorrect name", "Error creating " + caption, MessageBoxButton.OK); return; } IList selectedListViewItems = list.SelectedItems; var items = selectedListViewItems.Cast <IMyMedia>(); foreach (var item in items) { _playlistManager.AddElem(name, item.Path.Replace("\\", "/").Replace(" ", "%20")); } _playlistManager.RefreshPlaylists(treePlaylist, fgList); }
public void Playlist_Rename(object sender, RoutedEventArgs e, TreeView treePlaylist, String fgList) { MenuItem mi = sender as MenuItem; if (mi != null) { ContextMenu cm = mi.CommandParameter as ContextMenu; if (cm != null) { TextBlock item = cm.PlacementTarget as TextBlock; if (item != null) { String newName = MyDialog.Prompt("Change playlist name", "Enter the new name :", MyDialog.Size.Normal); if (String.IsNullOrEmpty(newName)) { MessageBox.Show("Incorrect name", "Error renaming playlist", MessageBoxButton.OK); return; } _playlistManager.RenamePlaylist(item.Text, newName); _playlistManager.RefreshPlaylists(treePlaylist, fgList); } } } }
private void EditButton_Click(object sender, RoutedEventArgs e) { if (string.IsNullOrWhiteSpace(PublisherIdTextBox.Text)) { MyDialog.Show("Publisher ID is empty!", "You need to fill Publisher ID text box"); } else { int id = Convert.ToInt32(PublisherIdTextBox.Text); string name = NameTextBox.Text; string country = CountryTextBox.Text; Publisher editedPublisher = new Publisher(id, name, country); Publisher.UpdateAllProperty(editedPublisher); MyDialog.Show(editedPublisher.Name + " has been edited"); PublisherIdTextBox.Text = ""; NameTextBox.Text = ""; CountryTextBox.Text = ""; this.publishers = Publisher.SelectAll(); DataGrid.ItemsSource = publishers; } }
public void miFileOpen_Click(object sender, System.EventArgs e) { // Implementation goes here MyDialog dlgFileOpen = new MyDialog("File Open"); dlgFileOpen.ShowDialog(); }
// WDR: handler implementations for MyFrame public void OnTest(object sender, Event e) { MyDialog dialog = new MyDialog(this, -1, "Test dialog", wxDefaultPosition, wxDefaultSize, (uint)wxDEFAULT_DIALOG_STYLE); dialog.ShowModal(); }
private void add_cust(object sender, RoutedEventArgs e) { MyDialog dialog = new MyDialog(typeof(CustObj), "添加客户"); dialog.ShowDialog(); if (dialog.DialogResult == false) { return; } ObservableCollection <CustObj> newList = dialog.getObjectList(); List <String> errorList = new List <string>(); foreach (var item in newList) { int operatorCode = helper.Cust_add(item.客户号.Trim(), item.姓名.Trim(), item.电话.Trim(), item.地址.Trim()); if (operatorCode == 0) { resetList(); return; } else { errorList.Add(item.客户号 + " : " + Sql.ErrorCodeToString(operatorCode)); } } if (errorList.Count != 0) { MessageBox.Show(MainWindow.MakeErrorString(errorList), "添加客户出错"); } }
private void EditButton_Click(object sender, RoutedEventArgs e) { if (string.IsNullOrWhiteSpace(GameIdTextBox.Text)) { MyDialog.Show("Game ID is empty!", "You need to fill Game ID text box"); } else { Game editedGame = new Game(); editedGame.GameId = Convert.ToInt32(GameIdTextBox.Text); editedGame.Title = TitleTextBox.Text; editedGame.Genre = GenreTextBox.Text; editedGame.Publisher = ((Publisher)PublisherComboBox.SelectedItem).Name; editedGame.PublisherId = ((Publisher)PublisherComboBox.SelectedItem).PublisherId; editedGame.Platform = PlatformComboBox.SelectedItem.ToString(); editedGame.Price = Convert.ToInt32(PriceTextBox.Text); editedGame.Quantity = Convert.ToInt32(QuantityTextBox.Text); Game.UpdateAllProperties(editedGame); MyDialog.Show(editedGame.Title + " has been edited"); GameIdTextBox.Text = ""; TitleTextBox.Text = ""; GenreTextBox.Text = ""; PublisherComboBox.SelectedIndex = -1; PlatformComboBox.SelectedIndex = -1; PriceTextBox.Text = ""; QuantityTextBox.Text = ""; this.games = Game.SelectAll(); DataGrid.ItemsSource = games; } }
private void AddEmp(object sender, RoutedEventArgs e) { MyDialog dialog = new MyDialog(typeof(EmpObj), "添加员工信息"); dialog.ShowDialog(); if (dialog.DialogResult == false) { return; } ObservableCollection <EmpObj> newList = dialog.getObjectList(); List <String> errorList = new List <string>(); foreach (var item in newList) { int operatorCode = helper.ManEmp_add(item.工号.Trim(), item.姓名.Trim(), item.性别.ToString(), item.年龄.ToString(), item.基本工资.ToString(), md5helper.encrypt("123456"), 0); if (operatorCode == 0) { resetList(); return; } else { errorList.Add(item.工号 + " : " + Sql.ErrorCodeToString(operatorCode)); } } if (errorList.Count != 0) { MessageBox.Show(MainWindow.MakeErrorString(errorList), "添加员工出错"); } }
private void generateStickers() { progressBar.Value = MIN_PROGRESS; if (saveToPath == null || saveToPath.Equals("")) { MyDialog.info("Please choose folder to save file"); return; } try { List <StickerData> stickerData = getStickerData(); if (stickerData.Count == 0) { MyDialog.info("Sticker Data Cannot be NULL"); return; } Generator Generator = new Generator(institution, saveToPath, progressBar); progressBar.Value = 10; Generator.generateSticker(stickerData); } catch (Exception e) { } finally { } progressBar.Value = MAX_PROGRESS; progressBar.Hide(); }
// 开始 void Start() { //获取Text获取Cube、title、info title = GameObject.Find("title"); info = GameObject.Find("information"); Cube = GameObject.Find("Cube"); canTakePhotos = true; mMyDialog = FindObjectOfType <MyDialog>(); mQualityDialog = FindObjectOfType <QualityDialog>(); myPersonalPanel = FindObjectOfType <PersonalPanel>(); if (myPersonalPanel) { myPersonalPanel.gameObject.SetActive(false); } if (mMyDialog) { mMyDialog.gameObject.SetActive(false); //设置提示面板的不显示 } if (mQualityDialog) { mQualityDialog.gameObject.SetActive(false);//设置提示面板的不显示 } StartCoroutine("StartCamera"); }
public void DialogContent() { tlog.Debug(tag, $"DialogContent START"); var testingTarget = new MyDialog(); Assert.IsNotNull(testingTarget, "null handle"); Assert.IsInstanceOf <Dialog>(testingTarget, "Should return Dialog instance."); View view = new View() { Size = new Size(50, 80), BackgroundColor = Color.Cyan }; testingTarget.Content = view; tlog.Debug(tag, "Content : " + testingTarget.Content); // content == value testingTarget.Content = view; tlog.Debug(tag, "Content : " + testingTarget.Content); // content != null View view2 = new View() { Size = new Size(30, 60), BackgroundColor = Color.Green }; testingTarget.Content = view2; tlog.Debug(tag, "Content : " + testingTarget.Content); tlog.Debug(tag, $"DialogContent END (OK)"); }
private void EditAction(object sender, RoutedEventArgs e) { var index = Chargo_DataGrid.SelectedIndex; Console.WriteLine(list[index]); MyDialog dialog = new MyDialog(list[index], false, "修改货物信息"); dialog.ShowDialog(); if (dialog.DialogResult == false) { return; } //list[index] = dialog.getObjResult() as EmpObj; var item = dialog.getObjResult() as CarObj; var key = list[index].货物号; if (item.货物号 != key) { helper.Cargo_alter(key, 6, item.货物号, 0); key = item.货物号; } helper.Cargo_alter(key, 1, item.称, 0); helper.Cargo_alter(key, 2, item.进价.ToString(), 1); helper.Cargo_alter(key, 3, item.售价.ToString(), 1); helper.Cargo_alter(key, 5, item.库存量.ToString(), 1); resetList(); }
public void miFileOpen_Click(object sender, System.EventArgs e) { // Implementation goes here MyDialog dlgFileOpen = new MyDialog("File Open"); dlgFileOpen.ShowDialog(); if (dlgFileOpen.ChoseOpen) { // If the user has asked to OPEN a Feed, we'll add this to the list // Create RSSFeed container RSSFeed feed = new RSSFeed(); feed.feedName = dlgFileOpen.txtRssURL.Text; feed.feedURL = dlgFileOpen.txtRssURL.Text; // Add it to our list feeds.Add(feed); Console.WriteLine("->Added 'feed' to 'feeds' list"); // Refresh our Subscription control RefreshSubscriptions(); // Set the current channel if (currentChannel == null) { currentChannel = new Channel(); } currentChannel.InitialiseFromURL(feed.feedURL); // Read the Threads associated with the current channel RefreshThreads(currentChannel); // Debug Console.Out.WriteLine(dlgFileOpen.txtRssURL.Text); } }
private void AddChargo(object sender, RoutedEventArgs e) { MyDialog dialog = new MyDialog(typeof(CarObj), "添加货物信息"); dialog.ShowDialog(); if (dialog.DialogResult == false) { return; } ObservableCollection <CarObj> newList = dialog.getObjectList(); List <String> errorList = new List <string>(); foreach (var item in newList) { int operatorCode = helper.Cargo_add(item.货物号.Trim(), item.称.Trim(), item.进价.ToString(), item.售价.ToString(), item.库存量.ToString()); if (operatorCode == 0) { resetList(); return; } else { errorList.Add(item.货物号 + " : " + Sql.ErrorCodeToString(operatorCode)); } } if (errorList.Count != 0) { MessageBox.Show(MainWindow.MakeErrorString(errorList), "添加货物出错"); } }
private void button4_Click(object sender, EventArgs e) //恢复配置文件 { writer = new StreamWriter(INI.Root + @"\Backup\Configuration.ini", false, Encoding.ASCII); //配置文件用UTF-8编码(默认编码)会无法识别。 writer.Write(Configuration.Replace("\n", Environment.NewLine)); writer.Close(); MyDialog.Msg("配置文件已恢复!", 1); }
private void editOrder(object sender, RoutedEventArgs e) { var index = Order_DataGrid.SelectedIndex; Console.WriteLine(list[index]); MyDialog dialog = new MyDialog(list[index], false, "修改订单信息"); dialog.ShowDialog(); if (dialog.DialogResult == false) { return; } var item = dialog.getObjResult() as OrderObj; var key = list[index].订单号; if (item.订单号 != key) { helper.ManOrder_alter(key, 8, item.订单号, 0); key = item.订单号; } int operatorCode = helper.ManOrder_alter(key, 1, item.销售日期, 0); if (operatorCode != 0) { MessageBox.Show(item.订单号 + " : " + Sql.ErrorCodeToString(operatorCode)); } helper.ManOrder_alter(key, 2, item.货物编号, 0); helper.ManOrder_alter(key, 3, item.客户编号, 0); helper.ManOrder_alter(key, 4, item.员工编号, 0); helper.ManOrder_alter(key, 5, item.货物数量.ToString().Trim(), 1); resetList(); }
// Use this for initialization void Start() { s_instance = this; m_Text = GetComponentInChildren <Text> (); Button exit = GetComponentInChildren <Button> (); exit.onClick.AddListener(this.OnButtonClicked); ShowMsgBox(); }
private void button1_Click(object sender, EventArgs e)//分组管理 { if (Text.Contains("未知")) { MyDialog.Msg("请使用已知地点。", 2); return; } new Groups().ShowDialog(); ReloadData(); }
private void button3_Click(object sender, EventArgs e)//标签管理 { if (LBGroups.Items.Count == 0) { MyDialog.Msg("请新建标签分组。", 2); return; } new LabelsUpdate(LBGroups.SelectedValue).ShowDialog(); ReloadData(); }
private void button4_Click(object sender, EventArgs e)//使用选中地点 { if (LB.SelectedValue == null) { MyDialog.Msg("没有选中地点。", 2); return; } INI.SetLocationID(LB.SelectedValue); MyDialog.Msg("设置完成!", 1); this.Text = "当前地点:" + ((DataRowView)LB.SelectedItem)["LocationName"]; }
private void clearDataGrid() { if (!MyDialog.confirm("Do you want to clear all data?")) { return; } datagridView.Rows.Clear(); datagridView.Refresh(); initDatagridView(); }
public void CommonDialogPropertyTag() { MyDialog md = new MyDialog(); object s = "MyString"; Assert.AreEqual(null, md.Tag, "A1"); md.Tag = s; Assert.AreSame(s, md.Tag, "A2"); }
private void OnMonthInterventions() { var dialog = new MyDialog(); if (dialog.ShowDialog() == true) { ExcelParser.Instance.SetFileName(@Path); ExcelParser.Instance.GetPatientsValues(dialog.ResponseText); } }
private void button9_Click(object sender, EventArgs e) //下一页 { if (++GV.NowPage > GV.TotalPages) //超过最大页码 { GV.NowPage--; MyDialog.Msg("已在最后一页。", 2); return; } GV.ShowData(); SetNumericValue(GV.NowPage); }
private void button8_Click(object sender, EventArgs e) //上一页 { if (--GV.NowPage < 1) //小于最小页码 { GV.NowPage++; MyDialog.Msg("已在第一页。", 2); return; } GV.ShowData(); SetNumericValue(GV.NowPage); }
public void miFileOpen_Click(object sender, System.EventArgs e) { // Implementation goes here MyDialog dlgFileOpen = new MyDialog("File Open"); dlgFileOpen.ShowDialog(); if (dlgFileOpen.ChoseOpen) { Console.Out.WriteLine(dlgFileOpen.txtRssURL.Text); } }
static void Main(string[] args) { var businessRules = new TransformDataIntoNewData(); var ui = new MyDialog(businessRules); businessRules.Dialog = ui; ui.OnOKUseButtonPressed(); // simulate user pressing button System.Console.ReadKey(); // prevent console from closing }
// WDR: handler implementations for MyFrame public void OnTest(object sender, Event e) { MyDialog dialog = new MyDialog( this, -1, "Test dialog", wxDefaultPosition, wxDefaultSize, (uint)wxDEFAULT_DIALOG_STYLE ); dialog.ShowModal(); }
private void OpenNewDBConnectionWindow(object sender, SelectionChangedEventArgs e) { if ((comboBoxDatabase.SelectedValue as ListBoxItem).Content.ToString().Contains("Create new connection")) { var dialog = new MyDialog(); if (dialog.ShowDialog() == true) { string newHostname = dialog.txtBoxNewDBHostname.Text; string newSID = dialog.txtBoxNewDBSID.Text; string newUsername = dialog.txtBoxNewDBUsername.Text; string newPassword = dialog.txtBoxNewDBPassword.Text; // Shoud save to xml file containing all connections. Later!!! } } }
private void DeleteButton_Click(object sender, RoutedEventArgs e) { System.Windows.Controls.Button button = sender as System.Windows.Controls.Button; Appointment user = button.DataContext as Appointment; if (System.Windows.MessageBox.Show("Are you sure you want to cancel this appointment" + " " + " ?", "Confirmation", MessageBoxButton.YesNo) == MessageBoxResult.Yes) { var dialog = new MyDialog(); if (dialog.ShowDialog() == true) { if (dialog.notify == true) { Messenger.Send(App.amApp, "Your appointment with" + _practitionerList.First(x => x.Id == user.Practitioner).Practice + " on:" + user.Dated + " During:" + user.StartTime + ": " + user.EndTime + "has been cancelled because " + dialog.ResponseText, _patientList.First(x => x.Id == user.Patient.ToString()).Phone); } user.Delete(user.Id.ToString()); Refresh(); } } else { return; } }
public void CommonDialogPropertyTag () { MyDialog md = new MyDialog (); object s = "MyString"; Assert.AreEqual (null, md.Tag, "A1"); md.Tag = s; Assert.AreSame (s, md.Tag, "A2"); }
void OnOpen(object sender, EventArgs e) { // create the dialog MyDialog dlg = new MyDialog(); // initialize the input box with a sample string dlg.UserFile = "Math.dll"; if (dlg.ShowDialog(this) == DialogResult.OK) { // If the dialog was dismissed with the OK button, // extract the user input and open the .dll file dllFileName = dlg.UserFile; dllLoaded = true; // set the flag to change the form #region Reflection Stuff Assembly a = Assembly.LoadFrom(dllFileName); Type type = a.GetType(dllFileName); Console.WriteLine(a); Console.WriteLine(type); foreach(Type className in a.GetExportedTypes()) { // we use a dynamic object to get the classes inside the .dll dynamic c = Activator.CreateInstance(className); Console.WriteLine(c); classCount++; classList[classCount] = c.ToString(); // we're looking for these exact methods // maybe later on, look into dynamically listing all methods Console.WriteLine(className.GetMethod("addition")); Console.WriteLine(className.GetMethod("subtraction")); Console.WriteLine(className.GetMethod("multiplication")); Console.WriteLine(className.GetMethod("division")); //Console.WriteLine(myMethodInfo); } #endregion Invalidate(); CalcForm calc = new CalcForm(); //Invalidate(); } }