Example #1
0
        public void GoToPimClass(PIMClass pimClass)
        {
            ElementDiagramDependencies dependentDiagrams = ElementDiagramDependencies.FindElementDiagramDependencies(MainWindow.CurrentProject, new[] { pimClass }, null);

            if (dependentDiagrams.Count == 1)
            {
                if (dependentDiagrams[pimClass].Count == 1)
                {
                    ActivateDiagramWithElement(dependentDiagrams[pimClass][0], pimClass);
                }
                else
                {
                    SelectItemsDialog d = new SelectItemsDialog();
                    d.ToStringAction = diagram => ((Diagram)diagram).Caption;
                    d.SetItems(dependentDiagrams[pimClass]);
                    if (d.ShowDialog() == true)
                    {
                        foreach (Diagram diagram in d.selectedObjects.Cast <Diagram>())
                        {
                            ActivateDiagramWithElement(diagram, pimClass);
                        }
                    }
                }
            }
            else if (dependentDiagrams.Count == 0)
            {
                XCaseYesNoBox.ShowOK("PIM class not used in diagrams", "PIM class is not used in any diagram. You can edit it via Navigator window. ");
            }
        }
Example #2
0
        private void Delete_Click(object sender, RoutedEventArgs e)
        {
            Version version = cbBranches.SelectedValue as Version;

            if (version != null && versionManager != null && versionManager.Versions.Count > 1 &&
                XCaseYesNoBox.Show("Remove version", string.Format("Do you really want to remove version {0}?\r\nThis action can not be undone.", version)) == MessageBoxResult.Yes)
            {
                UnbindProject();
                versionManager.DeleteVersion(version);
                BindToProject(versionManager.LatestVersion);
                cbBranches.SelectedItem      = versionManager.LatestVersion.Version;
                MainWindow.HasUnsavedChanges = true;

                #if DEBUG
                Tests.ModelIntegrity.ModelConsistency.CheckEverything(project);
                //Tests.ModelIntegrity.ModelConsistency.CheckElementSchema(ElementWatcher.CreatedElements, project.Schema, null);

                Tests.ModelIntegrity.VersionsConsistency.CheckVersionsConsistency(versionManager);
                foreach (Element element in ElementWatcher.CreatedElements)
                {
                    if (element.Version == null && !(element is InstantiatedProperty) && !(element is StereotypeInstance))
                    {
                        System.Diagnostics.Debug.WriteLine(String.Format("{0} element without version", element));
                    }
                }
                #endif
            }
        }
Example #3
0
 public static MessageBoxResult ShowOK(string messageText, string messageQuestion)
 {
     msgBox = new XCaseYesNoBox(true, false, false, false);
     msgBox.messageText.Text     = messageText;
     msgBox.messageQuestion.Text = messageQuestion;
     msgBox.ShowDialog();
     return(msgBox.result);
 }
Example #4
0
        private void lCheckForUpdates_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            Updater.Updater      updater = new Updater.Updater();
            IEnumerable <string> files   = Directory.GetFiles(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "*.dll").Concat(Directory.GetFiles(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "*.exe"));

            Dictionary <string, Version> clientVersions = new Dictionary <string, Version>();

            foreach (string file in files)
            {
                Version clientVersion = AssemblyName.GetAssemblyName(file).Version;
                clientVersions[Path.GetFileName(file)] = clientVersion;
            }

            Dictionary <string, Version> newAvailableVersions;

            if (updater.AreNewVersionsAvailable(clientVersions, out newAvailableVersions) && XCaseYesNoBox.ShowYesNoCancel("New version available", "New version is available. \r\nDo you wish to update?") == MessageBoxResult.Yes)
            {
                System.Diagnostics.ProcessStartInfo info = new System.Diagnostics.ProcessStartInfo("Updater.exe");
                info.UseShellExecute = true;
                this.Close();
                (Application.Current.MainWindow as MainWindow).Close();
                System.Diagnostics.Process.Start(info);
            }
        }