Beispiel #1
0
 public AboutViewModel(IUntappdService untappdService)
 {
     this.untappdService = untappdService;
     Version             = CommunicationHelper.GetTitle();
     if (untappdService.IsUNTPProject())
     {
         ImagePaths = GetImagePaths();
     }
 }
        private void Activate()
        {
            Title = CommunicationHelper.GetTitle();
            bool   isUsedArgument = false;
            string filePath;

            if (argumentsProvider.Arguments.Count > 0)
            {
                filePath       = argumentsProvider.Arguments[0];
                isUsedArgument = true;
            }
            else
            {
                filePath = FileHelper.GetFirstFileItemPath(settingService.GetRecentFilePaths());
            }

            FileStatus fileStatus = FileHelper.Check(filePath, Extensions.GetSupportExtensions());

            if (EnumsHelper.IsValidFileStatus(fileStatus))
            {
                try
                {
                    untappdService.Initialize(filePath);
                    if (isUsedArgument)
                    {
                        settingService.SetRecentFilePaths(FileHelper.AddFilePath(settingService.GetRecentFilePaths(), filePath, settingService.GetMaxRecentFilePaths()));
                    }

                    moduleManager.LoadModule(typeof(MainModule).Name);
                }
                catch (ArgumentException ex)
                {
                    interactionRequestService.ShowError(Properties.Resources.Error, StringHelper.GetFullExceptionMessage(ex));
                    moduleManager.LoadModule(typeof(WelcomeModule).Name);
                }
            }
            else
            {
                if (fileStatus != FileStatus.IsEmptyPath)
                {
                    interactionRequestService.ShowMessage(Properties.Resources.Warning, CommunicationHelper.GetFileStatusMessage(fileStatus, filePath));
                }

                moduleManager.LoadModule(typeof(WelcomeModule).Name);
            }
        }
 private void UpdateTitle()
 {
     Title = CommunicationHelper.GetTitle();
 }
 private void UpdateTitle(string untappdUserName)
 {
     Title = CommunicationHelper.GetTitle(untappdUserName);
 }