コード例 #1
0
        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);
        }
コード例 #2
0
 private void OnShellClosing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     if (ViMessageBox.Show("是否需要退出应用程序?", "Closing", MessageBoxButton.OKCancel, MessageBoxImage.Question) == MessageBoxResult.OK)
     {
         this.TheSolution = null;
     }
     else
     {
         e.Cancel = true;
     }
 }