//买跌检测 private void CommandBinding_Executed_RecordRealWeight(object sender, System.Windows.Input.ExecutedRoutedEventArgs e) { ManagementViewModel vm = DataContext as ManagementViewModel; MarketOrderData selectedOrder = (e.OriginalSource as DataGridRow).DataContext as MarketOrderData; vm.RecordRealWeight(selectedOrder); }
public override void ExecutedCommand(object sender, System.Windows.Input.ExecutedRoutedEventArgs e) { if (e.Command == ViCommands.AddExistingItem) { // 1、弹出文件选择对话框; // 2、判断目标文件在哪,如果不在当前目录下,则复制目标文件(复制文件待定,因为还需要考虑依赖项); // 3、加载目标文件; base.AddExistingItem(); } else if (e.Command == ApplicationCommands.Delete) { if (ViMessageBox.Show("确定要删除该项目吗?", "Delete Project", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.Yes) { Dispatcher.BeginInvoke(new Action(() => { this.TheSolution.RemoveProject(this); })); } } else if (e.Command == ViCommands.Rename) { String newName = e.Parameter as String; if (String.IsNullOrEmpty(newName)) { return; } //this.RenameProject(newName); } base.ExecutedCommand(sender, e); }
private void SaveCommand(object sender, System.Windows.Input.ExecutedRoutedEventArgs e) { if (MainTabControl.Items.Count == 0) { MessageBox.Show("No tab opened.", "Information", MessageBoxButton.OK, MessageBoxImage.Information); } else { ITabItem current = (ITabItem)MainTabControl.SelectedContent; string text = current.GetPlainText(); Console.WriteLine(text); SaveFileDialog saveDialog = new SaveFileDialog(); saveDialog.Filter = "Encrypted File (*.*)|*.*|Plain File (*.*)|*.*"; saveDialog.Title = "Save As"; saveDialog.FileName = ((TabItem)MainTabControl.Items[MainTabControl.SelectedIndex]).Header as string; if (saveDialog.ShowDialog() == true) { try { if (saveDialog.FilterIndex == 1) { Crypt.EncryptToFile(saveDialog.FileName, text, FDF1Checkbox.IsChecked, GetSelectedKeyIndex()); } else { File.WriteAllText(saveDialog.FileName, text); } } catch (Exception ex) { MessageBox.Show("Something went wrong.\n" + ex, "Error", MessageBoxButton.OK, MessageBoxImage.Warning); } } } }
public override void ExecutedCommand(object sender, System.Windows.Input.ExecutedRoutedEventArgs e) { if (e.Command == ViCommands.OpenLocalFolder) { if (Directory.Exists(this.FolderPath)) { System.Diagnostics.Process.Start(this.FolderPath); } return; } else if (e.Command == ViCommands.AddNewItem) { this.AddNewItem(); return; } else if (e.Command == ViCommands.AddExistingItem) { this.AddExistingItem(); return; } else if (e.Command == ViCommands.Build) { //this.Build(false); } else if (e.Command == ViCommands.Rebuild) { //this.Build(true); } else if (e.Command == ViCommands.Clean) { //this.BuildClean(); } base.ExecutedCommand(sender, e); }
private void OpenCommand_Executed(object sender, System.Windows.Input.ExecutedRoutedEventArgs e) { // Configure open file dialog box Microsoft.Win32.OpenFileDialog openFileDialog = new Microsoft.Win32.OpenFileDialog(); openFileDialog.FileName = ""; openFileDialog.DefaultExt = "*.wma;*.wav;*mp3"; openFileDialog.Filter = "Media files|*.mp3;*.m4a;*.wma;*.wav|MP3 (*.mp3)|*.mp3|M4A (*.m4a)|*.m4a|Windows Media Audio (*.wma)|*.wma|Wave files (*.wav)|*.wav|All files|*.*"; // Show open file dialog box bool?result = openFileDialog.ShowDialog(); // Load the selected song if (result == true) { songIdComboBox.IsEnabled = false; Song s = GetSongDetails(openFileDialog.FileName); if (s != null) { titleTextBox.Text = s.Title; artistTextBox.Text = s.Artist; albumTextBox.Text = s.Album; genreTextBox.Text = s.Genre; lengthTextBox.Text = s.Length; filenameTextBox.Text = s.Filename; mediaPlayer.Open(new Uri(s.Filename)); addButton.IsEnabled = true; } } }
private void WebcamRecorder_Executed(object sender, ExecutedRoutedEventArgs e) { var webcam = new Webcam(); Hide(); var result = webcam.ShowDialog(); if (result.HasValue && result.Value) { // If Close Environment.Exit(0); } else if (result.HasValue) { #region If Backbutton or Stop Clicked if (webcam.ExitArg == ExitAction.Recorded) { var editor = new Editor { ListFrames = webcam.ListFrames }; GenericShowDialog(editor); return; } Show(); #endregion } }
private void OpenFolderOrFile(object sender, ExecutedRoutedEventArgs e) { var dialog = new Microsoft.Win32.OpenFileDialog { CheckFileExists = true, CheckPathExists = true, Multiselect = false }; if (lastAddedPath != null) { dialog.FileName = lastAddedPath; } var ret = dialog.ShowDialog(this); if (ret.HasValue && ret.Value) { lastAddedPath = dialog.FileName; string filename = null; if (File.Exists(lastAddedPath)) { filename = lastAddedPath; lastAddedPath = Path.GetDirectoryName(lastAddedPath); } DirectoryController.Scan(lastAddedPath); DirectoryController.SelectFile(filename); ShowFile(); } }
private void ExecutedRemove(object sender, ExecutedRoutedEventArgs e) { var item = SelectedItem; Adapter.Portfolios.Remove(item.Item1); _items.Remove(item); }
// Hide columns with cost price information private void HideColumns(object sender, System.Windows.Input.ExecutedRoutedEventArgs e) { if (productsGrid.Columns[2].Visibility == Visibility.Visible) { productsGrid.Columns[2].Visibility = Visibility.Hidden; productsGrid.Columns[4].Visibility = Visibility.Hidden; clientsGrid.Columns[3].Visibility = Visibility.Hidden; clientsGrid.Columns[4].Visibility = Visibility.Hidden; clientsGrid.Columns[5].Visibility = Visibility.Hidden; clientsGrid.Columns[6].Visibility = Visibility.Hidden; InfoGroupBox.Visibility = Visibility.Hidden; PaymentsGroupBox.Visibility = Visibility.Hidden; Row4.Height = new GridLength(0); } else { productsGrid.Columns[2].Visibility = Visibility.Visible; productsGrid.Columns[4].Visibility = Visibility.Visible; clientsGrid.Columns[3].Visibility = Visibility.Visible; clientsGrid.Columns[4].Visibility = Visibility.Visible; clientsGrid.Columns[5].Visibility = Visibility.Visible; clientsGrid.Columns[6].Visibility = Visibility.Visible; InfoGroupBox.Visibility = Visibility.Visible; PaymentsGroupBox.Visibility = Visibility.Visible; Row4.Height = new GridLength(201); } }
/// <summary> /// ファイル読み込み /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void FileLoad_Execute(object sender, System.Windows.Input.ExecutedRoutedEventArgs e) { var dialog = new OpenFileDialog(); dialog.Title = "ファイルを開く"; dialog.Filter = "CSVファイル(*.csv)|*.csv"; if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { try { using (var sr = new System.IO.StreamReader(dialog.FileName, System.Text.Encoding.UTF8)) { mViewModel.Items.Clear(); while (!sr.EndOfStream) { mViewModel.Items.Add(ViewModel.Item.Parse(sr.ReadLine())); } } } catch (SystemException exception) { System.Windows.MessageBox.Show(exception.Message); } } }
private void CommandBinding_PlayVideo(object sender, ExecutedRoutedEventArgs e) { Window parentWindow = Window.GetWindow(this); object obj = e.Parameter; if (obj == null) return; try { if (obj.GetType() == typeof(VideoDetailedVM)) { VideoDetailedVM vid = obj as VideoDetailedVM; bool force = true; if (vid.VideoLocal_ResumePosition > 0) { AskResumeVideo ask = new AskResumeVideo(vid.VideoLocal_ResumePosition); ask.Owner = Window.GetWindow(this); if (ask.ShowDialog() == true) force = false; } MainWindow.videoHandler.PlayVideo(vid,force); this.Close(); } } catch (Exception ex) { Utils.ShowErrorMessage(ex); } }
private void CommandBinding_PlayEpisode(object sender, ExecutedRoutedEventArgs e) { Window parentWindow = Window.GetWindow(this); try { AnimeEpisodeVM ep = this.DataContext as AnimeEpisodeVM; if (ep.FilesForEpisode.Count > 0) { bool force = true; if (MainWindow.videoHandler.DefaultPlayer.Player.ToString() != Enum.GetName(typeof(VideoPlayer), VideoPlayer.WindowsDefault)) { if (ep.FilesForEpisode[0].VideoLocal_ResumePosition > 0) { AskResumeVideo ask = new AskResumeVideo(ep.FilesForEpisode[0].VideoLocal_ResumePosition); ask.Owner = Window.GetWindow(this); if (ask.ShowDialog() == true) force = false; } } MainWindow.videoHandler.PlayVideo(ep.FilesForEpisode[0], force); } } catch (Exception ex) { Utils.ShowErrorMessage(ex); } }
private void CommandBinding_Executed_Cancel(object sender, System.Windows.Input.ExecutedRoutedEventArgs e) { ManagementViewModel vm = DataContext as ManagementViewModel; PendingOrderData selectedOrder = (e.OriginalSource as DataGridRow).DataContext as PendingOrderData; vm.RevocationPendingOrder(selectedOrder); }
private void SaveMediumCommand_Executed(object sender, System.Windows.Input.ExecutedRoutedEventArgs e) { EditMediumModel context = this.DataContext as EditMediumModel; SqlMethods.SqlConnect(out SQLiteConnection con); SQLiteCommand selectCommand = con.CreateCommand(); selectCommand.CommandText = $"SELECT MediumId, Name FROM Mediums WHERE Name=@Name"; selectCommand.Parameters.AddWithValue("Name", context.Name); SQLiteDataReader r = selectCommand.ExecuteReader(); selectCommand.Parameters.Clear(); if (!r.Read()) { // to add new medium if (context.Id == 0) { SQLiteCommand insertCommand = con.CreateCommand(); insertCommand.CommandText = $"INSERT INTO Mediums (Name) VALUES (@Name)"; insertCommand.Parameters.AddWithValue("Name", context.Name); insertCommand.ExecuteNonQuery(); insertCommand.Parameters.Clear(); } // to update medium's name else { SQLiteCommand updateCommand = con.CreateCommand(); updateCommand.CommandText = $"UPDATE Mediums SET Name=@Name WHERE MediumId=@Id"; updateCommand.Parameters.AddWithValue("Name", context.Name); updateCommand.Parameters.AddWithValue("Id", context.Id); updateCommand.ExecuteNonQuery(); updateCommand.Parameters.Clear(); } } else { // to update medium's name if (context.Id != 0) { SQLiteCommand updateCommand = con.CreateCommand(); updateCommand.CommandText = $"UPDATE Mediums SET Name=@Name WHERE MediumId=@Id"; updateCommand.Parameters.AddWithValue("Name", context.Name); updateCommand.Parameters.AddWithValue("Id", context.Id); updateCommand.ExecuteNonQuery(); updateCommand.Parameters.Clear(); } else { string message = Application.Current.FindResource("EditMeidum.CodeBehind.ErrorSave.Message").ToString(); string caption = Application.Current.FindResource("EditMeidum.CodeBehind.ErrorSave.Caption").ToString(); CustomMessageBox.ShowOK(message, caption, CustomMessageBoxButton.OK, MessageBoxImage.Error); //MessageBox.Show(message, caption, MessageBoxButton.OK, MessageBoxImage.Error); } } r.Close(); con.Close(); ClearEntries(context); GetMedium(); }
private void SaveAsCommand_Executed(object sender, System.Windows.Input.ExecutedRoutedEventArgs e) { if (tabControl1.SelectedValue is MyTab tab) { SaveAsFile(tab); } }
private void CloseCommitDetails_Executed(object sender, ExecutedRoutedEventArgs e) { try { if (e.Parameter == null) { var animationDuration = TimeSpan.FromSeconds(.2); var animation = new DoubleAnimation(this.ActualWidth + 200, new Duration(animationDuration)); animation.EasingFunction = new CubicEase() { EasingMode = EasingMode.EaseIn }; animation.Completed += (o, _) => this.details.Visibility = Visibility.Collapsed; this.details.RenderTransform.BeginAnimation(TranslateTransform.XProperty, animation); } else { var animationDuration = TimeSpan.FromSeconds(.2); var animation = new DoubleAnimation(-this.ActualWidth, new Duration(animationDuration)); animation.EasingFunction = new CubicEase() { EasingMode = EasingMode.EaseIn }; animation.Completed += (o, _) => this.pendingChanges.Visibility = Visibility.Collapsed; this.pendingChanges.RenderTransform.BeginAnimation(TranslateTransform.XProperty, animation); } } catch (Exception ex) { Log.WriteLine("MainWindow.CloseCommitDetails_Executed: {0}", ex.ToString()); } }
private async void RemoveMediumCommand_Executed(object sender, System.Windows.Input.ExecutedRoutedEventArgs e) { var removingItems = MediumList.SelectedItems; if (MediumList.SelectedIndex != -1) { SqlMethods.SqlConnect(out SQLiteConnection con); var tr = con.BeginTransaction(); SQLiteCommand removeCommand = con.CreateCommand(); removeCommand.Transaction = tr; await Task.Run(async() => { for (int i = removingItems.Count - 1; i >= 0; i--) { Medium temp = removingItems[i] as Medium; removeCommand.CommandText = $"DELETE FROM Mediums WHERE Name=@Name"; removeCommand.Parameters.AddWithValue("Name", temp.Name); await removeCommand.ExecuteNonQueryAsync(); removeCommand.Parameters.Clear(); } tr.Commit(); con.Close(); }); GetMedium(); } ClearEntries(this.DataContext as EditMediumModel); }
private void CommandBindingViewAudioAnalysis_Executed(object sender, System.Windows.Input.ExecutedRoutedEventArgs e) { if (e.OriginalSource is FrameworkElement fe && fe.DataContext is Track track) { (this.DataContext as ViewModelLoggedIn).ViewAudioAnalysis(track); } }
private void CommandBindingSwitchToTab_Executed(object sender, System.Windows.Input.ExecutedRoutedEventArgs e) { if (e.OriginalSource is FrameworkElement fe && fe.DataContext is LoggedInWindowTabItem tabitem) { (this.DataContext as ViewModelLoggedIn).SelectedTabItem = tabitem; } }
private void CommandBindingSetDeviceAsActive_Executed(object sender, System.Windows.Input.ExecutedRoutedEventArgs e) { if (e.OriginalSource is FrameworkElement fe && fe.DataContext is Device device) { (this.DataContext as ViewModelLoggedIn).Session.SetActiveDevice(device.Id); } }
private void cmdNew(object sender, System.Windows.Input.ExecutedRoutedEventArgs e) { try { var view = new selectUserWindow(); // Hide(); view.ShowDialog(); if (view.result != null) { var acl = vm.item._acl.ToList(); acl.Add(new ace() { _id = view.result._id, name = view.result.name, deny = false, Delete = true, Read = true, Invoke = true, Update = true }); vm.item._acl = acl.ToArray(); } reload(); } catch (Exception ex) { Log.Error(ex.ToString()); MessageBox.Show("CmdTest: " + ex.Message); } finally { } }
private void AddUser_Executed(object sender, ExecutedRoutedEventArgs e) { this.userTask.save(this.user); e.Handled = true; Window currentForm = this; currentForm.Close(); }
private void ExecuteStartVoice(object sender, ExecutedRoutedEventArgs e) { _isAnyVoiceChatActive = true; this.IsChatting = true; if (App.Settings.Current.Voice.UseStun) { var stun = new StunUdpClient(App.Settings.Current.Voice.StunServer, App.Settings.Current.Voice.AltStunServer); stun.BeginGetClient((ar) => { UdpClient client = null; try { client = stun.EndGetClient(ar, out _publicEndPoint); } catch (StunException ex) { System.Diagnostics.Debug.WriteLine("STUN error: " + ex.Message); } this.Dispatcher.BeginInvoke((Action)(() => this.Start(client))); }); } else { this.Start(); } }
private void dataGridSections_PreviewExecuted(object sender, ExecutedRoutedEventArgs e) { if (e.Command == DataGrid.DeleteCommand) { MessageBoxButton button = MessageBoxButton.YesNo; if (MessageBox.Show("Czy napewno chcesz usunąć?", "Usuwanie", button) == MessageBoxResult.Yes) { try { SectionPresenter sectionPresenter = (SectionPresenter)this.DataContext; var section = (FixedAssetsApp.FixedAssetsWebService.Section)this.dataGridSections.SelectedItem; if (section != null) { sectionPresenter.DeleteSection((FixedAssetsApp.FixedAssetsWebService.Section)section); e.Handled = false; } } catch (Exception ex) { MessageBox.Show(ex.Message); e.Handled = true; } } else { e.Handled = true; } } }
private void CommandBinding_Executed_ModifyPassword(object sender, ExecutedRoutedEventArgs e) { ManagementViewModel vm = DataContext as ManagementViewModel; vm.ModifyPassword(); }
private void ExecutedAddStrategy(object sender, ExecutedRoutedEventArgs e) { if (SelectedStrategy != null) new CloneStrategyCommand(SelectedStrategy).SyncProcess(this); else new AddStrategyCommand(SelectedStrategyInfo, SessionType.Battle).SyncProcess(this); }
private void NewGameSinglePlayerCommand_Executed(object sender, ExecutedRoutedEventArgs e) { gameController = new SinglePlayerGameController(gameGrid, gameOptions.SelectedIconSet); gameController.StartGame(); }
private void CommandBindingPreviousPage(object sender, ExecutedRoutedEventArgs e) { if (NavigationService != null) { NavigationService.Navigate(new Uri(@"Pages\Step12.xaml", UriKind.Relative)); } }
private void Close_Executed(object sender, ExecutedRoutedEventArgs e) { // Configure the message box to be displayed string messageBoxText = "你确定要退出?"; string caption = "提示框"; MessageBoxButton button = MessageBoxButton.YesNoCancel; MessageBoxImage icon = MessageBoxImage.Warning; // Display message box MessageBoxResult result = MessageBox.Show(messageBoxText, caption, button, icon); // Process message box results switch (result) { case MessageBoxResult.Yes: // User pressed Yes button // ... this.Close(); break; case MessageBoxResult.No: // User pressed No button // ... break; case MessageBoxResult.Cancel: // User pressed Cancel button // ... break; } }
/// <summary> /// 确定 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void CommandBinding_Executed_Ok(object sender, ExecutedRoutedEventArgs e) { if (this.ComitEvent != null) { ComitEvent.Invoke(); } }
private void CompareCommits_Executed(object sender, ExecutedRoutedEventArgs e) { try { this.details.RenderTransform.SetValue(TranslateTransform.XProperty, this.ActualWidth); this.details.Visibility = Visibility.Visible; var animationDuration = TimeSpan.FromSeconds(.5); var animation = new DoubleAnimation(0, new Duration(animationDuration)); animation.EasingFunction = new CubicEase() { EasingMode = EasingMode.EaseOut }; loading.Visibility = Visibility.Visible; animation.Completed += (_, x) => { var ids = e.Parameter as string[]; this.details.Show(this.gitViewModel.Tracker, ids[0], ids[1]); loading.Visibility = Visibility.Collapsed; }; this.details.RenderTransform.BeginAnimation(TranslateTransform.XProperty, animation); } catch (Exception ex) { Log.WriteLine("MainWindow.CompareCommits_Executed {0}", ex.ToString()); } }
private void dataGridKinds_PreviewExecuted(object sender, ExecutedRoutedEventArgs e) { if (e.Command == DataGrid.DeleteCommand) { MessageBoxButton button = MessageBoxButton.YesNo; if (MessageBox.Show("Czy napewno chcesz usunąć?", "Usuwanie", button) == MessageBoxResult.Yes) { try { KindPresenter kindPresenter = (KindPresenter)this.DataContext; var kind = (Kind)this.dataGridKinds.SelectedItem; if (kind != null) { kindPresenter.DeleteKind((Kind)kind); e.Handled = false; } } catch (Exception ex) { MessageBox.Show(ex.Message); e.Handled = true; } } else { e.Handled = true; } } }
private void CommandBinding_Executed_Delete(object sender, ExecutedRoutedEventArgs e) { ManagementViewModel vm = DataContext as ManagementViewModel; ExperienceInformation exp = (e.OriginalSource as DataGridRow).DataContext as ExperienceInformation; if( vm.DelExperience(exp.Id)) Query(); }
/// <summary> /// Executes the collapse all folds command (which folds all text foldings but the first). /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private static void PrintDocument(object sender, ExecutedRoutedEventArgs e) { EdiTextEditor edi = sender as EdiTextEditor; if (edi == null) return; string filename = null; try { if (e != null) { if (e.Parameter != null) { filename = e.Parameter as string; if (filename != null) { int MaxLen = 52; // Work with elipses if string is too long if (filename.Length > (MaxLen + 8)) filename = filename.Substring(0, 5) + "..." + filename.Substring((filename.Length - MaxLen), MaxLen); } } } } catch { } edi.PrintPreviewDocument(filename); }
static void OnExecute(object sender, ExecutedRoutedEventArgs e) { var wbView = Helper.FindChild<WorkbookView>(sender as DependencyObject); if (wbView == null) return; // NOTE: Must acquire a workbook set lock. wbView.GetLock(); try { var param = e.Parameter as string; if (param == "Top") wbView.RangeSelection.VerticalAlignment = SpreadsheetGear.VAlign.Top; else if (param == "Center") wbView.RangeSelection.VerticalAlignment = SpreadsheetGear.VAlign.Center; else if (param == "Bottom") wbView.RangeSelection.VerticalAlignment = SpreadsheetGear.VAlign.Bottom; else wbView.RangeSelection.VerticalAlignment = SpreadsheetGear.VAlign.Bottom; } catch { } finally { // NOTE: Must release the workbook set lock wbView.ReleaseLock(); } }
private void ExecutedOpenLogDirectory(object sender, ExecutedRoutedEventArgs e) { var fileListener = ConfigManager.GetService<LogManager>().Listeners.OfType<FileLogListener>().FirstOrDefault(); if (fileListener != null) Process.Start(fileListener.LogDirectory); }
protected override void ListEditExecuted(object sender, ExecutedRoutedEventArgs e) { var id = (int) e.Parameter; var deliveryType = ((ForeignDeliveryListVM) VM).GetDeliveryType(id); var p = new ForeignDeliveryPoolDetail(PageMode.EditMode, deliveryType, id); RedirectTo(p); }
void SaveCommandBinding_Executed(object sender, ExecutedRoutedEventArgs e) { if (MySQLHandler.JuniorSubjectSelection.Default.saveChanges()) MessageBox.Show("Saved"); else MessageBox.Show("Not Saved"); }
private void NewCommand(object sender, ExecutedRoutedEventArgs e) { var dlog = new NewDocument { Owner = this }; var result = dlog.ShowDialog(); if (!result.HasValue || !result.Value) { return; } var bmp = new WriteableBitmap( dlog.ViewModel.Width, dlog.ViewModel.Height, 96, 96, PixelFormats.Bgr32, null); _picture = new Picture(dlog.ViewModel.Name, bmp); Title = _picture.Name; ViewModel.Document = new ReversibleDocument<IPicture>(_picture); ViewModel.AccessPolicy = new PictureAccessPolicy(_picture); _image.Source = bmp; _image.Stretch = Stretch.None; RenderOptions.SetBitmapScalingMode(_image, BitmapScalingMode.NearestNeighbor); RenderOptions.SetEdgeMode(_image, EdgeMode.Aliased); }
// �����Ϳ��� �̺�Ʈ �ڵ鷯 (���� IO�κ�) // ������ ������� ���̴� Deserialize�� Serialize �κ� void OpenOnExecuted(object sender, ExecutedRoutedEventArgs args) { OpenFileDialog dlg = new OpenFileDialog(); // ���Ͽ��� ���̾�α� ��ü ���� dlg.Filter = strFilter; // ǥ�õǴ� �������� ���� (�������ĺκ�) Person pers; // PersonŬ���� ��ü ���� if ((bool)dlg.ShowDialog(this)) // ���Ͽ��� ���̾�αװ� ����������? { try { // �����̸� ���ڿ��� �д� ��Ʈ�� ���� ��ü ���� StreamReader reader = new StreamReader(dlg.FileName); // ��Ʈ������ ��ü�� �籸�� �ؼ� Person ��ü�� ���� pers = (Person) xml.Deserialize(reader); reader.Close(); } catch (Exception exc) { MessageBox.Show("������ �����ھ�� �� _�� : " + exc.Message, Title, MessageBoxButton.OK, MessageBoxImage.Exclamation); return; } // DataContext�� ��Ұ� ���ε��� ���Ǵ� ������ �ҽ��� ���� ���� �� ��� �� // ���ε��� ��Ÿ Ư���� �θ� ��ҷκ��� ��� �� �� �ֵ��� �ϴ� ����. pnlPerson.DataContext = pers; } }
private void AppendCommand_Executed(object sender, ExecutedRoutedEventArgs e) { MainWindow mv = VisualHelp.FindVisualParentRoot(this) as MainWindow; if (mv != null) mv.AddImportTab(((DatasetViewModel)datasetView.SelectedItem).Dataset, Convert.ToInt32(e.Parameter), ImportType.Append); }
private void CommandBinding_Executed(object sender, ExecutedRoutedEventArgs e) { feedback.Content = "Pre loading data..."; //need to move to a loction that will update window before action starts Mouse.OverrideCursor = Cursors.Wait; if (wPosts != null) { wPosts = null; } //todo: replace with a switch, but can't native switch() on an ICommand... if (e.Command == CommandSQLPostsR1) { selectedRadioButton = SOXMLDataType.SQLPostsR1; wPosts = GetPosts(0, 30); } else if (e.Command == CommandSQLPostsR2) { selectedRadioButton = SOXMLDataType.SQLPostsR2; wPosts = GetPosts(0, 120); } else if (e.Command == CommandSQLPostsR3) { selectedRadioButton = SOXMLDataType.SQLPostsR3; wPosts = GetPosts(0, 250); } Mouse.OverrideCursor = null; }
private void CommandBinding_Executed(object sender, ExecutedRoutedEventArgs e) { CollectionViewSource source = this.FindResource("source") as CollectionViewSource; //source.View.SortDescriptions.Add(new System.ComponentModel.SortDescription("Title",new System.ComponentModel.ListSortDirection())); XmlDataProvider p = this.FindResource("xmlDataProvider") as XmlDataProvider; }
private static void HandlePreviewExecutedEvent(object sender, ExecutedRoutedEventArgs e) { if (e.Command == ApplicationCommands.Paste) { e.Handled = IsInvalid((string)Clipboard.GetDataObject().GetData(typeof(string))); } }
private void SaveCommand_Executed(object sender, ExecutedRoutedEventArgs e) { if (MySQLHandler.StudentMarksEntry.Default.saveChanges()) MessageBox.Show("Saved"); else MessageBox.Show("Not Saved"); }
private void ToolsCheckForNewVersionExecuted(object sender, System.Windows.Input.ExecutedRoutedEventArgs e) { CheckNewVersionAvailable(true); if (OfferNewVersion()) { Environment.Exit(0); } }
private void BackCommand_Executed(object sender, System.Windows.Input.ExecutedRoutedEventArgs e) { if (_browsingHistoryManager.CanBack()) { _browsingHistoryManager.aheadHistoryStackPush(_pageTabControl.GetCurrentStatus()); _pageTabControl.ChangeToStatus(_browsingHistoryManager.backHistoryStackPop(), this); } }
private void CommandSave_Executed(object sender, System.Windows.Input.ExecutedRoutedEventArgs e) { string datetime = startDate.Text + " " + starttime.Text; DateTime dt = DateTime.Parse(datetime); NewDateTime = dt; this.Close(); }
public override void ExecutedCommand(object sender, System.Windows.Input.ExecutedRoutedEventArgs e) { if (e.Command == ViCommands.AddExistingItem) { // 1、弹出文件选择对话框; // 2、判断目标文件在哪,如果不在当前目录下,则复制目标文件(复制文件待定,因为还需要考虑依赖项); // 3、加载目标文件; base.AddExistingItem(); } else if (e.Command == ApplicationCommands.Delete) { if (MessageBox.Show("确定要删除该项目吗?", "Delete Project", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.Yes) { Dispatcher.BeginInvoke(new Action(() => { this.TheSolution.RemoveProject(this); })); } return; } else if (e.Command == ViCommands.Rename) { String newName = e.Parameter as String; if (String.IsNullOrEmpty(newName)) { return; } //this.RenameProject(newName); } else if (e.Command == ViCommands.Build || e.Command == ViCommands.Rebuild || e.Command == ViCommands.Clean) { bool?rebuild = null; if (e.Command == ViCommands.Rebuild) { rebuild = true; } else if (e.Command == ViCommands.Build) { rebuild = false; } this.TheFactory.BuildProjects(new List <string>() { this.ProjectFile }, rebuild); return; } else if (e.Command == ViCommands.GitDiff) { this.TheSolution.GitManager.ShowLog(this.FolderPath); } base.ExecutedCommand(sender, e); }
private void CloseCommandBinding_Executed(object sender, System.Windows.Input.ExecutedRoutedEventArgs e) // [2] { // Uncomment line below to get a message box asking if you really want to close the window. // if (MessageBox.Show("Close?", "Close", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes) // { close_serial_port(); this.Close(); // } }
/// <summary> /// 指定アイテムを消化 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void DoneItem_Execute(object sender, System.Windows.Input.ExecutedRoutedEventArgs e) { var item = e.Parameter as ViewModel.Item; if (item != null) { item.Done(); } }
private void TextBox_MaxTextSizePreviewExecuted(object sender, System.Windows.Input.ExecutedRoutedEventArgs e) { TextBox tb = sender as TextBox; if (e.Command == ApplicationCommands.Paste) { e.Handled = !new Regex("[0-9]").IsMatch(tb.Text); } }
private void ViewErrorsExecuted(object sender, System.Windows.Input.ExecutedRoutedEventArgs e) { ViewErrorsDialog dlg = new ViewErrorsDialog(MainWindow.Exceptions); dlg.Owner = MainWindow.Window; dlg.HorizontalAlignment = System.Windows.HorizontalAlignment.Center; dlg.VerticalAlignment = System.Windows.VerticalAlignment.Center; dlg.ShowDialog(); }
/// <summary> /// コピーした項目を貼り付け /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void PasteItem_Execute(object sender, System.Windows.Input.ExecutedRoutedEventArgs e) { // クリップボードの文字列をItemにパースして追加 System.Windows.IDataObject data = System.Windows.Clipboard.GetDataObject(); if (data.GetDataPresent(System.Windows.DataFormats.CommaSeparatedValue)) { string str = (string)data.GetData(System.Windows.DataFormats.CommaSeparatedValue); mViewModel.Items.Add(ViewModel.Item.Parse(str)); } }
private void Find_Executed(object sender, System.Windows.Input.ExecutedRoutedEventArgs e) { if (_findwin == null) { _findwin = new Findwindow(this); _findwin.Owner = this; } _findwin.Show(); }
private void SaveCommand_Executed(object sender, System.Windows.Input.ExecutedRoutedEventArgs e) { try { this.Save(true); } catch (Exception ex) { App.HandleException(ex); } }
private void ExitCommand_Executed(object sender, System.Windows.Input.ExecutedRoutedEventArgs e) { try { App.Current.Shutdown(); } catch (Exception ex) { App.HandleException(ex); } }
// Prevent any possible way of cheating private void UserInput_PreviewExecuted(object sender, System.Windows.Input.ExecutedRoutedEventArgs e) { if (e.Command == ApplicationCommands.Copy || e.Command == ApplicationCommands.Cut || e.Command == ApplicationCommands.Paste || e.Command == ApplicationCommands.Undo || e.Command == ApplicationCommands.Redo || e.Command == ApplicationCommands.Delete) { e.Handled = true; } }
private void CommandBindingViewItem_Executed(object sender, System.Windows.Input.ExecutedRoutedEventArgs e) { SpotifyBaseObject baseObject = null; if (e.OriginalSource is FrameworkElement fe) { if (fe.DataContext is SpotifyBaseObject sbo) { baseObject = sbo; } else if (fe.DataContext is AggregationSearchTrackItem agri) { baseObject = agri.Track; } ViewModelLoggedIn vm = this.DataContext as ViewModelLoggedIn; /* unfortunately, the generic method doesnt recognize the derived type of the SpotifyBaseObject. * This turns in to a problem if the user tries to reload the view tab (because all derived properties will not be return from DataLoader.GetItemByHref<T>()). * Because of that every type has to be handled explicit*/ switch (baseObject) { case null: break; case Playlist playlist: vm.ViewSpotifyBaseObject(playlist); break; case Album album: vm.ViewSpotifyBaseObject(album); break; case User user: vm.ViewSpotifyBaseObject(user); break; case Artist artist: vm.ViewSpotifyBaseObject(artist); break; /* not sure yet whether to implement a view for track or not */ //case Track track: // vm.ViewSpotifyBaseObject(track); // break; default: throw new Exception($"A object with the type {baseObject.GetType().ToString()} cannot be displayed"); } } }
private async void CommandBindingAddToQueue_Executed(object sender, System.Windows.Input.ExecutedRoutedEventArgs e) { if (e.OriginalSource is FrameworkElement fe) { if (fe.DataContext is SpotifyBaseObject sbo) { await(this.DataContext as ViewModelLoggedIn).Session.AddItemToQueue(sbo); } else if (fe.DataContext is AggregationSearchTrackItem asti) { await(this.DataContext as ViewModelLoggedIn).Session.AddItemToQueue(asti.Track); } } }