Ejemplo n.º 1
0
        void OpenAnalyseProject(AnalyseProjectSummaryViewModel p)
        {
            var cw = ProjectWindowList.FirstOrDefault(v => (v.DataContext as ProjectViewModelBase).TargetSummaryVM == p);

            if (cw != null)
            {
                cw.Activate();
                return;
            }
            var w  = new AnalyseProjectWindow();
            var dc = new AnalyseProjectViewModel(p.TargetProject)
            {
                TargetSummaryVM = p, OpenView = w.OpenDocument
            };

            w.DataContext             = dc;
            w.helper.projectViewModel = dc;
            w.Closed += W_Closed;
            ProjectWindowList.Add(w);
            w.Show();
            if (p.TargetProject.Status == ProjectStatus.Running)
            {
                dc.StartObserveViewModel();
            }
        }
Ejemplo n.º 2
0
        public static void W_Closed(object sender, EventArgs e)
        {
            var w = sender as System.Windows.Window;

            if (w == null)
            {
                return;
            }
            w.Closed -= W_Closed;
            if (ProjectWindowList.Contains(w))
            {
                ProjectWindowList.Remove(w);
            }
        }
Ejemplo n.º 3
0
 void Delete(ProjectSummaryViewModelBase project)
 {
     if (MessageBox.Show("Confirm delete? Press OK to delete selected item.", "Confirm", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
     {
         if (project != null && ProjectList.Contains(project))
         {
             var w = ProjectWindowList.FirstOrDefault(v => (v.DataContext as ProjectViewModelBase).TargetSummaryVM == project);
             if (w != null)
             {
                 if (MessageBox.Show("Project still open! Press OK to close project and delete, or press cancel to active project window.", "Confirm", MessageBoxButton.OKCancel) == MessageBoxResult.Cancel)
                 {
                     w.Activate();
                     return;
                 }
                 else
                 {
                     //ProjectWindowList.Remove(w);
                     w.Close();
                 }
             }
             ProjectList.Remove(project);
         }
     }
 }