예제 #1
0
        static void Main(string[] args)
        {
            Logger.LogAssemblyInfo(Assembly.GetExecutingAssembly());

            if (args.Length < 1)
            {
                Logger.LogUserMessage("Usage: DsmSuite.DsmViewer.Builder <settingsfile>");
            }
            else
            {
                FileInfo settingsFileInfo = new FileInfo(args[0]);
                if (!settingsFileInfo.Exists)
                {
                    BuilderSettings.WriteToFile(settingsFileInfo.FullName, BuilderSettings.CreateDefault());
                    Logger.LogUserMessage("Settings file does not exist. Default one created");
                }
                else
                {
                    BuilderSettings builderSettings = BuilderSettings.ReadFromFile(settingsFileInfo.FullName);
                    Logger.LoggingEnabled = builderSettings.LoggingEnabled;

                    if (!File.Exists(builderSettings.InputFilename))
                    {
                        Logger.LogUserMessage($"Input file '{builderSettings.InputFilename}' does not exist.");
                    }
                    else
                    {
                        DsmModel model   = new DsmModel("Builder", Assembly.GetExecutingAssembly());
                        Builder  builder = new Builder(model, builderSettings);
                        builder.BuildModel();
                        model.SaveModel(builderSettings.OutputFilename, builderSettings.CompressOutputFile);
                    }
                }
            }
        }
예제 #2
0
        private void MainWindow_OnLoaded(object sender, RoutedEventArgs e)
        {
            DsmModel       model       = new DsmModel("Viewer", Assembly.GetExecutingAssembly());
            DsmApplication application = new DsmApplication(model);

            application.ShowCycles                        = App.ShowCycles;
            _mainViewModel                                = new MainViewModel(application);
            _mainViewModel.ReportCreated                 += OnReportCreated;
            _mainViewModel.ElementsReportReady           += OnElementsReportReady;
            _mainViewModel.RelationsReportReady          += OnRelationsReportReady;
            _mainViewModel.ProgressViewModel.BusyChanged += OnProgressViewModelBusyChanged;

            _mainViewModel.ElementCreateStarted   += OnElementCreateStarted;
            _mainViewModel.ElementEditNameStarted += OnElementEditNameStarted;
            _mainViewModel.ElementEditTypeStarted += OnElementEditTypeStarted;

            _mainViewModel.RelationCreateStarted     += OnRelationCreateStarted;
            _mainViewModel.RelationEditWeightStarted += OnRelationEditWeightStarted;
            _mainViewModel.RelationEditTypeStarted   += OnRelationEditTypeStarted;

            _mainViewModel.SnapshotMakeStarted += OnSnapshotMakeStarted;

            _mainViewModel.ActionsVisible  += OnActionsVisible;
            _mainViewModel.SettingsVisible += OnSettingsVisible;

            _mainViewModel.ScreenshotRequested += OnScreenshotRequested;
            DataContext = _mainViewModel;

            OpenModelFile();
        }
예제 #3
0
        protected override void Action()
        {
            DsmModel       model       = new DsmModel("Builder", Assembly.GetExecutingAssembly());
            DsmApplication application = new DsmApplication(model);

            application.ImportModel(_builderSettings.InputFilename,
                                    _builderSettings.OutputFilename,
                                    _builderSettings.ApplyPartitioningAlgorithm,
                                    _builderSettings.RecordChanges,
                                    _builderSettings.CompressOutputFile,
                                    this);
        }
예제 #4
0
        public void DoProjectOpen(FileInfo dsmFile)
        {
            if (ConfirmModelSaved())
            {
                IDsmModel newModel = new DsmModel(null, null);
                ICommand  cmd      = new CommandOpen(newModel, dsmFile);

                CursorStateHelper csh = new CursorStateHelper(this, Cursors.WaitCursor);

                Refresh();

                ModelessMessageBox msg = new ModelessMessageBox("Loading project file");
                try
                {
                    cmd.Execute(msg.UpdateProgress);

                    if (cmd.Completed)
                    {
                        SetModel(newModel);
                        _matrixControl.Size = new Size(panel1.ClientSize.Width, panel1.ClientSize.Height);
                    }
                }
                catch (DsmException dsmEx)
                {
                    MessageBox.Show("Unable to load DSM fom file for the following reason: " +
                                    Environment.NewLine + Environment.NewLine + dsmEx,
                                    "Dependency Structure Matrix",
                                    MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
                catch (Exception ex)
                {
                    ErrorDialog.Show(ex.ToString());
                }
                finally
                {
                    msg.Dispose();
                    csh.Reset();
                }

                if ((newModel != null) && (newModel.ModelFilename != null))
                {
                    this.Text = "DSM Viewer - " + newModel.ModelFilename;
                }
            }
        }