Пример #1
0
        /// <summary>
        /// Обработка команды контроллера внутри логики модели.
        /// </summary>
        /// <param name="parCommand">Команда.</param>
        protected override void HandleCommand(ModelCommand parCommand)
        {
            _stateMachine.ChangeState(parCommand);
            SelectedMenuItem = _stateMachine.SelectedMenuItem;
            MenuHeader       = _stateMachine.MenuHeader;
            switch (_stateMachine.CurrentCommand)
            {
            case ModelStateMachineCommand.LoadMenu:
                LoadAnotherModel?.Invoke(GameModelType.Menu);
                break;

            case ModelStateMachineCommand.LoadLevel:
                LoadAnotherModel?.Invoke(GameModelType.Level, _stateMachine.SelectedMenuItem);
                break;

            case ModelStateMachineCommand.LoadFirstLevel:
                int firstLevelID = LevelLoader.CheckAvailableLevels().Min();
                LoadAnotherModel?.Invoke(GameModelType.Level, firstLevelID);
                break;

            case ModelStateMachineCommand.LoadLastLevel:
                int lastLevelID = SaveFile.GetInstance().LevelToLoad;
                LoadAnotherModel?.Invoke(GameModelType.Level, lastLevelID);
                break;

            case ModelStateMachineCommand.Exit:
                CloseApplication?.Invoke();
                break;
            }
        }
Пример #2
0
        public PostViewModel(Post p)
        {
            _post = p;

            IsSticky    = p.IsSticky;
            IsClosed    = p.IsClosed;
            IsMod       = p.IsMod;
            IsAdmin     = p.IsAdmin;
            IsDeveloper = p.IsDeveloper;
            FileDeleted = p.FileDeleted;

            Subject     = p.Subject;
            AuthorName  = p.DisplayName;
            HtmlComment = new HtmlDocument();
            if (p.Comment != null)
            {
                HtmlComment.LoadHtml(p.Comment.Replace("<wbr>", ""));
            }

            if (Subject != null)
            {
                SimpleComment = Subject;
            }
            else
            {
                SimpleComment = WebUtility.HtmlDecode(HtmlComment.DocumentNode.InnerText).Replace("&#039;", "'").Replace("&#44;", ",");
            }

            PrettyTime = p.PrettyTime;

            CapCode = p.CapCode;

            ThumbHeight = p.ThumbHeight;
            ThumbWidth  = p.RenamedFileName != 0 ? 100 : 0;

            RenamedFileName = p.RenamedFileName;
            ImageWidth      = p.ImageWidth;
            ImageHeight     = p.ImageHeight;

            string posts  = p.PostCount != 1 ? "posts" : "post";
            string images = p.ImageCount != 1 ? "images" : "image";

            CounterText          = p.PostCount + " " + posts + " and " + p.ImageCount + " " + images + ".";
            TruncatedCounterText = p.PostCount + " / " + p.ImageCount;

            Number       = p.Number;
            NumberQuotes = p.Number + (p.Quotes.Count == 0 ? "" : " (" + p.Quotes.Count + ")");
            LongNumber   = p.LongNumber;

            HasImage = _post.RenamedFileName != 0;
            if (HasImage)
            {
                ThumbnailSrc = p.ThumbnailSrc;
                ImageSrc     = p.ImageSrc;
            }

            ThreadNavigated = new ModelCommand(DoThreadNavigated);
            ImageNavigated  = new ModelCommand(DoImageNavigated);
            CopyToClipboard = new ModelCommand(DoCopyToClipboard);
        }
Пример #3
0
 /// <summary>
 /// Получение команды от контроллера.
 /// </summary>
 /// <param name="parCommand">Команда.</param>
 /// <param name="parBeginCommand">Флаг начала команды (true, если начата).</param>
 public override void ReceiveCommand(ModelCommand parCommand, bool parBeginCommand)
 {
     if (parBeginCommand)
     {
         HandleCommand(parCommand);
     }
 }
Пример #4
0
        //private donutCRUD DonutService = new donutCRUD();

        public AddEditCustomerViewModel()
        {
            AddCustomerCommand  = new ModelCommand(AddCustomer);
            EditCustomerCommand = new ModelCommand(EditCustomer);
            currentCustomer     = CustomerViewModel.RetriveCustomer();
            newCustomer         = new CustomerModel();
        }
Пример #5
0
        public void Model_Execute_ReturnsEmpty()
        {
            var command       = new ModelCommand(_console, LoggerMock.GetLogger <ModelCommand>().Object);
            var resultMessage = command.Execute();

            Assert.Equal("", resultMessage);
        }
Пример #6
0
        /// <summary>
        /// Изменение состояния согласно команде извне.
        /// </summary>
        /// <param name="parCommand">Команда.</param>
        public override void ChangeState(ModelCommand parCommand)
        {
            CurrentCommand = ModelStateMachineCommand.None;
            if ((_model.UIItems != null) && (_model.UIItems.Count > 0))
            {
                if (_menuDisplayed)
                {
                    switch (parCommand)
                    {
                    case ModelCommand.Up:
                        SelectPrevMenuItem();
                        break;

                    case ModelCommand.Down:
                        SelectNextMenuItem();
                        break;

                    case ModelCommand.OK:
                        AcceptAction();
                        break;
                    }
                }
                if (parCommand == ModelCommand.Escape)
                {
                    CancelAction();
                }
            }
        }
Пример #7
0
 /// <summary>
 /// Creates an instance of <see cref="BlueprintManagerDialogModel"/>
 /// </summary>
 public BlueprintManagerDialogModel()
 {
     DeleteCommand          = new ModelCommand(Delete, false);
     RenameCommand          = new ModelCommand(Rename, false);
     OpenFolderCommand      = new ModelCommand(OpenFolder, false);
     CopyToClipboardCommand = new ModelCommand(CopyToClipboard, false);
 }
Пример #8
0
 public EnginesViewModel()
 {
     CreateNewEngineCommand = new ModelCommand(CreateNewEngine);
     DeleteEngineCommand    = new ModelCommand(DeleteEngine);
     BrowseEngineCommand    = new ModelCommand(BrowseEngine, () => SelectedEngine != null);
     ReloadEngineCommand    = new ModelCommand(ReloadEngine, () => SelectedEngine != null && EngineCommand != null && File.Exists(EngineCommand));
 }
Пример #9
0
 public BuyDonutViewModel()
 {
     this.RefreshDonuts();
     this.RefreshCustomers();
     BuyDonutCommand     = new ModelCommand(BuyDonut);
     RefreshDonutCommand = new ModelCommand(RefreshEverythink);
 }
Пример #10
0
        //private donutCRUD DonutService = new donutCRUD();

        public AddEditViewModel()
        {
            AddDonutCommand  = new ModelCommand(AddDonut);
            EditDonutCommand = new ModelCommand(EditDonut);
            currentDonut     = DonutViewModel.RetriveDonut();
            NewDonut         = new DonutModel();
            //new donut();
        }
Пример #11
0
 //private donutCRUD DonutService = new donutCRUD() ;
 public DonutViewModel()
 {
     this.RefreshDonuts();
     AddDonutCommand     = new ModelCommand(AddDonut);
     EditDonutCommand    = new ModelCommand(EditDonut);
     DeleteDonutCommand  = new ModelCommand(DeleteDonuts);
     RefreshDonutCommand = new ModelCommand(RefreshDonuts);
 }
    public MyClass()
    {
        var closure = new < > c__DisplayClass1 {
            _this = this
        };

        OkCommand = new ModelCommand(new Action <object>(closure.b__0));
    }
Пример #13
0
 public CustomerViewModel()
 {
     AddCustomerCommand     = new ModelCommand(AddCustomer);
     EditCustomerCommand    = new ModelCommand(EditCustomer);
     DeleteCustomerCommand  = new ModelCommand(DeleteCustomer);
     RefreshCustomerCommand = new ModelCommand(RefreshCustomers);
     RefreshCustomers();
 }
Пример #14
0
 public PostsPageViewModel()
 {
     ReloadCaptcha = new ModelCommand(async() =>
     {
         CaptchaText = "";
         CaptchaFocused(this, null);
         await DoLoadCaptcha();
     });
 }
Пример #15
0
        public PostViewModel(Post p)
        {
            _post = p;

            IsSticky = p.IsSticky;
            IsClosed = p.IsClosed;
            IsMod = p.IsMod;
            IsAdmin = p.IsAdmin;
            IsDeveloper = p.IsDeveloper;
            FileDeleted = p.FileDeleted;

            Subject = p.Subject;
            AuthorName = p.DisplayName;
            HtmlComment = new HtmlDocument();
            if (p.Comment != null) HtmlComment.LoadHtml(p.Comment.Replace("<wbr>", ""));

            if (Subject != null)
            {
                SimpleComment = Subject;
            }
            else
            {
                SimpleComment = WebUtility.HtmlDecode(HtmlComment.DocumentNode.InnerText).Replace("&#039;", "'").Replace("&#44;", ",");
            }

            PrettyTime = p.PrettyTime;

            CapCode = p.CapCode;

            ThumbHeight = p.ThumbHeight;
            ThumbWidth = p.RenamedFileName != 0 ? 100 : 0;

            RenamedFileName = p.RenamedFileName;
            ImageWidth = p.ImageWidth;
            ImageHeight = p.ImageHeight;

            string posts = p.PostCount != 1 ? "posts" : "post";
            string images = p.ImageCount != 1 ? "images" : "image";
            CounterText = p.PostCount + " " + posts + " and " + p.ImageCount + " " + images + ".";
            TruncatedCounterText = p.PostCount + " / " + p.ImageCount;

            Number = p.Number;
            NumberQuotes = p.Number + (p.Quotes.Count == 0 ? "" : " (" + p.Quotes.Count + ")");
            LongNumber = p.LongNumber;

            HasImage = _post.RenamedFileName != 0;
            if (HasImage)
            {
                ThumbnailSrc = p.ThumbnailSrc;
                ImageSrc = p.ImageSrc;
            }

            ThreadNavigated = new ModelCommand(DoThreadNavigated);
            ImageNavigated = new ModelCommand(DoImageNavigated);
            CopyToClipboard = new ModelCommand(DoCopyToClipboard);
        }
Пример #16
0
 public NewThreadPageViewModel()
 {
     MoreDetails = new ModelCommand(() => HasMoreDetails = true);
     ReloadCaptcha = new ModelCommand(async () =>
     {
         CaptchaText = "";
         ElementFocused(this, NewThreadFocusResult.Captcha);
         await DoLoadCaptcha();
     });
 }
Пример #17
0
 public NewThreadPageViewModel()
 {
     MoreDetails   = new ModelCommand(() => HasMoreDetails = true);
     ReloadCaptcha = new ModelCommand(async() =>
     {
         CaptchaText = "";
         ElementFocused(this, NewThreadFocusResult.Captcha);
         await DoLoadCaptcha();
     });
 }
Пример #18
0
 public GameViewModel()
 {
     QueueNextGameCommand = new ModelCommand(QueueNextGame);
     EngineGoCommand      = new ModelCommand(EngineGo);
     EngineStopCommand    = new ModelCommand(EngineStop);
     whitePlayerLog       = new List <string>();
     blackPlayerLog       = new List <string>();
     whitePlayerInfo      = new Dictionary <string, string>();
     blackPlayerInfo      = new Dictionary <string, string>();
 }
Пример #19
0
        public ImageViewerPostViewModel(Post p)
        {
            Number = p.Number;
            RenamedFileName = p.RenamedFileName;
            ThumbnailSrc = p.ThumbnailSrc;
            ImageSrc = p.ImageSrc;
            AspectRatio = p.ImageWidth / (double)p.ImageHeight;
            FileType = p.FileType;

            UpdateProgress = new ModelCommand<int>(DoUpdateProgress);
            IsDownloading = true;
        }
Пример #20
0
        public ImageViewerPostViewModel(Post p)
        {
            Number          = p.Number;
            RenamedFileName = p.RenamedFileName;
            ThumbnailSrc    = p.ThumbnailSrc;
            ImageSrc        = p.ImageSrc;
            AspectRatio     = p.ImageWidth / (double)p.ImageHeight;
            FileType        = p.FileType;

            UpdateProgress = new ModelCommand <int>(DoUpdateProgress);
            IsDownloading  = true;
        }
Пример #21
0
 /// <summary>
 /// Получение команды.
 /// </summary>
 /// <param name="parCommand">Команда.</param>
 /// <param name="parBeginCommand">Флаг начала команды (true, если начата).</param>
 public void ReceiveCommand(ModelCommand parCommand, bool parBeginCommand)
 {
     if (parBeginCommand)
     {
         if (!_activeCommands.Contains(parCommand))
         {
             _activeCommands.Add(parCommand);
         }
     }
     else
     {
         _activeCommands.Remove(parCommand);
     }
 }
Пример #22
0
        public BoardViewModel(Board b)
        {
            _board      = b;
            Name        = b.Name;
            DisplayName = "/" + b.Name + "/";
            Description = DisplayName + " - " + b.Description;
            WideURI     = b.WideURI;
            IconURI     = b.IconURI;
            IsNSFW      = b.IsNSFW;

            AddToFavorites      = new ModelCommand(DoAddToFavorites);
            RemoveFromFavorites = new ModelCommand(DoRemoveFromFavorites);
            PinToStart          = new ModelCommand(async() => await DoPinToStart());
            Navigated           = new ModelCommand(DoNavigated);
        }
Пример #23
0
        /// <summary>
        /// Получение команды от контроллера.
        /// </summary>
        /// <param name="parCommand">Команда.</param>
        /// <param name="parBeginCommand">Флаг начала команды (true, если начата).</param>
        public override void ReceiveCommand(ModelCommand parCommand, bool parBeginCommand)
        {
            if (parBeginCommand)
            {
                HandleCommand(parCommand);
            }
            PlayerLogic logic = _model.PlayerLogics;

            if ((_stateMachine.MenuHeader.Equals("")) &&
                (logic != null) &&
                (parCommand <= ModelCommand.Down))
            {
                logic.ReceiveCommand(parCommand, parBeginCommand);
            }
        }
Пример #24
0
        public SchedulerViewModel()
        {
            MasterState.Instance.RegisterAction(MasterState.EventEnginesChanged, () => NotifyChanged(() => Engines));
            MasterState.Instance.RegisterAction(MasterState.EventTimeSettingsChanged, () => NotifyChanged(() => TimeSettings));
            MasterState.Instance.RegisterAction(MasterState.EventScheduledMatchesChanged, () => NotifyChanged(() => ScheduledMatches));

            InsertMatchesCommand           = new ModelCommand(InsertMatches);
            ReloadScheduledMatchesCommand  = new ModelCommand(ReloadScheduledMatches);
            DeletedSelectedMatchesCommand  = new ModelCommand(DeletedSelectedMatches);
            DeletedScheduledMatchesCommand = new ModelCommand(DeletedScheduledMatches);

            MatchCount = 1;
            PlayWhite  = true;
            PlayBlack  = true;
        }
Пример #25
0
        /// <summary>
        /// Обработка команды контроллера внутри логики модели.
        /// </summary>
        /// <param name="parCommand">Команда.</param>
        protected override void HandleCommand(ModelCommand parCommand)
        {
            _stateMachine.ChangeState(parCommand);
            SelectedMenuItem = _stateMachine.SelectedMenuItem;
            MenuHeader       = _stateMachine.MenuHeader;
            ShadowLevel      = _stateMachine.ShadowLevel;
            switch (_stateMachine.CurrentCommand)
            {
            case ModelStateMachineCommand.Pause:
                this.Pause();
                break;

            case ModelStateMachineCommand.Resume:
                this.Resume();
                break;

            case ModelStateMachineCommand.LoadMenu:
                this.Stop();
                LoadAnotherModel?.Invoke(GameModelType.Menu);
                break;

            case ModelStateMachineCommand.LoadLevel:
                this.Stop();
                LoadAnotherModel?.Invoke(GameModelType.Level, _model.LevelID);
                break;

            case ModelStateMachineCommand.LoadNextLevel:
                this.Stop();
                try
                {
                    List <int> levels        = LevelLoader.CheckAvailableLevels().OrderBy(x => x).ToList();
                    int        currentNumber = levels.FindIndex(x => x == _model.LevelID);
                    int        nextLevelID   = levels[currentNumber + 1];
                    LoadAnotherModel?.Invoke(GameModelType.Level, nextLevelID);
                }
                catch
                {
                    LoadAnotherModel?.Invoke(GameModelType.Menu);
                }
                break;
            }
        }
Пример #26
0
        /// <summary>
        ///     Adds the help command to the controller.
        /// </summary>
        /// <param name="controller">The controller.</param>
        /// <returns>The Controller.</returns>
        public static Controller AddHelp(this Controller controller)
        {
            if (controller.ModelMap.Commands.ContainsKey("Help"))
            {
                return(controller);
            }

            controller.TemplateParser.AddTypeTemplate <ModelOption>("  [c:white]-{Name}[/] : {Description}");
            controller.TemplateParser.AddTypeTemplate <ModelCommand>("  [c:white]{Name}[/] : {Description}");
            controller.TemplateParser.AddTypeTemplate <Version>(
                "[c:white]{Major}[/].[c:white]{Minor}[/][if:Build].[c:white]{Build}[if:Revision].[c:white]{Revision}[/][/][/][/]");

            controller.TemplateParser.AddTypeTemplate <UsageDetails>(
                "Usage : {Name}[if:Arguments][foreach:Arguments] [[{Name}][/]"
                + "[br/][br/]Arguments:[br/][foreach:Arguments] {}[br/][/][/]");
            controller.TemplateParser.AddTypeTemplate <ArgumentDetails>(
                "<[c:white]{Name}[/]:{Type}> [if:DisplayName]({DisplayName})[/] [if:Optional](Default : '{DefaultValue}') [/][if:Description][br/]  {Description}[/]");

            controller.TemplateParser.AddTypeTemplate <HelpDetails>(
                "[if:ModelName][c:white]{ModelName}[/][/][if:ModelVersion] ({ModelVersion})[/][br/]"
                + "[if:Description]{Description}[br/][/]" + "[if:Usage]{Usage}[br/][/][br/]"
                + "[if:Options][c:white]Options[/][hr/][foreach:Options]{}[br/][/][hr/]"
                + "[/][if:Commands][c:white]Commands[/][hr/][foreach:Commands]{}[br/][/][hr/][/]");

            var name = Assembly.GetEntryAssembly()?.GetName().Name;

            var helpGenerator = new HelpGenerator(controller);
            var method        = helpGenerator.GetType().GetMethod("Help");
            var helpAction    = new ModelCommand("Help", method, helpGenerator)
            {
                Description =
                    $"Show command line help. '{name} Help [Topic]' for more information on a command or option.",
                DisplayName = "Help"
            };

            controller.ModelMap.AddCommand(helpAction);

            return(controller);
        }
Пример #27
0
        /// <summary>
        /// Executes the .ExportAll command.
        /// </summary>
        internal void ExportAll(ValidationMode mode)
        {
            if (this.Application.ActivePage == null)
            {
                return;
            }

            ModelCommand command = new ModelCommand()
            {
                Operation = ModelOperation.ExportAll,
                Document  = this.Application.ActiveDocument,
            };

            try
            {
                CommandExecute(command, mode);
            }
            catch (Exception ex)
            {
                ExceptionMessageBox.Show("Unhandled exception: ExportAll", ex);
            }
        }
Пример #28
0
        /// <summary>
        /// Изменение состояния согласно команде извне.
        /// </summary>
        /// <param name="parCommand">Команда.</param>
        public override void ChangeState(ModelCommand parCommand)
        {
            if ((_model.UIItems != null) && (_model.UIItems.Count > 0))
            {
                switch (parCommand)
                {
                case ModelCommand.Up:
                    SelectPrevMenuItem();
                    break;

                case ModelCommand.Down:
                    SelectNextMenuItem();
                    break;

                case ModelCommand.OK:
                    AcceptAction();
                    break;

                case ModelCommand.Escape:
                    CancelAction();
                    break;
                }
            }
        }
Пример #29
0
 public AddBoardPageViewModel()
 {
     AddBoard = new ModelCommand(DoAddBoard);
 }
Пример #30
0
 public ReplyPageViewModelBase()
 {
     ReloadCaptcha = new ModelCommand(async () => await DoLoadCaptcha());
     SelectImage = new ModelCommand(() => DoSelectImage());
 }
Пример #31
0
 /// <summary>
 /// Изменение состояния согласно команде извне.
 /// </summary>
 /// <param name="parCommand">Команда.</param>
 public abstract void ChangeState(ModelCommand parCommand);
Пример #32
0
 public PostsPageViewModel()
 {
     ReloadCaptcha = new ModelCommand(async () =>
     {
         CaptchaText = "";
         CaptchaFocused(this, null);
         await DoLoadCaptcha();
     });
 }
Пример #33
0
        static void Main(string[] args)
        {
            /*
             *
             */
            CommandLine options = new CommandLine();

            if (options.Parse(args) == false)
            {
                Environment.Exit(1001);
                return;
            }

            if (options.Help == true)
            {
                options.HelpShow();
                Environment.Exit(1002);
                return;
            }

            _options = options;


            /*
             *
             */
            string[] files = Yttrium.Glob.Do(options.FilePatterns.ToArray());

            if (files == null || files.Length == 0)
            {
                Console.WriteLine("error: no matching files.");
                Environment.Exit(2);
            }


            /*
             *
             */
            Console.WriteLine("~ mode: '{0}'", _options.Mode);


            /*
             *
             */
            Microsoft.Office.Interop.Visio.Application visio = null;
            bool anyError = false;

            try
            {
                /*
                 *
                 */
                ModelExporter exporter = new ModelExporter();
                exporter.PageStart += new EventHandler <PageEventArgs>(OnPageStart);
                exporter.PageEnd   += new EventHandler <PageEventArgs>(OnPageEnd);
                exporter.StepStart += new EventHandler <PageStepEventArgs>(OnStepStart);
                exporter.StepEnd   += new EventHandler <PageStepEventArgs>(OnStepEnd);

                /*
                 *
                 */
                visio = new Microsoft.Office.Interop.Visio.Application();
                visio.AlertResponse = 1;
                visio.Visible       = false;

                foreach (string file in files)
                {
                    /*
                     *
                     */
                    Console.Write("+ opening '{0}'...", Path2.RelativePath(file));
                    FileInfo fileInfo = new FileInfo(file);

                    if (fileInfo.Exists == false)
                    {
                        ConsoleFail();
                        Console.WriteLine(" - file does not exist");

                        anyError = true;
                        continue;
                    }


                    /*
                     * Open the document: if the document is not a valid/compatible Visio
                     * document, this will fail.
                     */
                    Microsoft.Office.Interop.Visio.Document document;

                    try
                    {
                        document = visio.Documents.Open(fileInfo.FullName);
                        ConsoleOk();
                    }
                    catch (Exception ex)
                    {
                        ConsoleFail();

                        if (options.Verbose == true)
                        {
                            ConsoleDump(ex);
                        }

                        anyError = true;
                        continue;
                    }


                    /*
                     * Settings
                     */
                    ModelExportSettings exportSettings = new ModelExportSettings();
                    exportSettings.Program = "ModelExport";
                    exportSettings.Mode    = options.Mode;
                    exportSettings.Path    = options.OutputDirectory ?? fileInfo.DirectoryName;

                    exporter.Settings = exportSettings;


                    /*
                     * Export.
                     */
                    ModelCommandResult result = null;

                    ModelCommand command = new ModelCommand();
                    command.Document  = document;
                    command.Operation = ModelOperation.ExportAll;

                    if (options.ValidateOnly == true)
                    {
                        command.Operation = ModelOperation.ValidateAll;
                    }


                    try
                    {
                        result = exporter.Execute(command);
                    }
                    catch (Exception ex)
                    {
                        anyError = true;

                        if (options.Verbose == true)
                        {
                            ConsoleDump(ex);
                        }
                    }
                    finally
                    {
                        document.Close();
                    }

                    if (result == null)
                    {
                        continue;
                    }


                    /*
                     *
                     */
                    Console.WriteLine("");
                    Console.WriteLine("execution summary");
                    Console.WriteLine("-------------------------------------------------------------------------");

                    foreach (ModelCommandPageResult pageResult in result.Pages)
                    {
                        Console.Write(pageResult.Name);

                        if (pageResult.Success == true)
                        {
                            ConsoleOk();
                        }
                        else
                        {
                            ConsoleFail();
                        }

                        foreach (ModelResultItem item in pageResult.Items)
                        {
                            string marker;

                            switch (item.ItemType)
                            {
                            case ModelResultItemType.Error:
                                Console.ForegroundColor = ConsoleColor.DarkRed;
                                marker = "!";
                                break;

                            case ModelResultItemType.Warning:
                                Console.ForegroundColor = ConsoleColor.DarkYellow;
                                marker = "W";
                                break;

                            default:
                                marker = " ";
                                break;
                            }

                            if (item.VisioShapeId == null)
                            {
                                Console.WriteLine("{0} [page] {1}#{2}: {3}", marker, item.Actor, item.Code, item.Description);
                            }
                            else
                            {
                                Console.WriteLine("{0} [{1}] {2}#{3}: {4}", marker, item.VisioShapeId, item.Actor, item.Code, item.Description);
                            }

                            Console.ResetColor();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ConsoleDump(ex);
            }
            finally
            {
                // This _needs_ to be performed here: in case an exception is caught,
                // make sure that Visio is closed or otherwise a zombie process will
                // be left running on the machine.
                if (visio != null)
                {
                    visio.Quit();
                }
            }


            /*
             *
             */
            if (anyError == true)
            {
                Environment.Exit(3);
            }
            else
            {
                Environment.Exit(0);
            }
        }
Пример #34
0
 public EditViewModel()
 {
     ExportCommand   = new ModelCommand(x => Export());
     LinesByLanguage = new Dictionary <string, List <SubtitleLine> >();
 }
Пример #35
0
 /// <summary>
 /// Получение команды от контроллера.
 /// </summary>
 /// <param name="parCommand">Команда.</param>
 /// <param name="parBeginCommand">Флаг начала команды (true, если начата).</param>
 public abstract void ReceiveCommand(ModelCommand parCommand, bool parBeginCommand);
Пример #36
0
 /// <summary>
 /// Обработка команды контроллера внутри логики модели.
 /// </summary>
 /// <param name="parCommand">Команда.</param>
 protected abstract void HandleCommand(ModelCommand parCommand);