private void RunUntappd(string filePath) { FileStatus fileStatus = FileHelper.Check(filePath, Extensions.GetSupportExtensions()); if (!EnumsHelper.IsValidFileStatus(fileStatus)) { interactionRequestService.ShowMessage(Properties.Resources.Warning, CommunicationHelper.GetFileStatusMessage(fileStatus, filePath)); return; } try { string untappdUserName = String.Empty; if (FileHelper.GetExtensionWihtoutPoint(filePath).Equals(Extensions.CSV)) { if (!interactionRequestService.AskReplaceText(Properties.Resources.UntappdUserNameCaption, ref untappdUserName)) { return; } } untappdService.Initialize(filePath, untappdUserName); } catch (ArgumentException ex) { interactionRequestService.ShowError(Properties.Resources.Error, StringHelper.GetFullExceptionMessage(ex)); return; } settingService.SetRecentFilePaths(FileHelper.AddFilePath(settingService.GetRecentFilePaths(), filePath, settingService.GetMaxRecentFilePaths())); moduleManager.LoadModule(typeof(MainModule).Name); ActivateView(RegionNames.RootRegion, typeof(Main)); interactionRequestService.ShowMessageOnStatusBar(filePath); }
private async void CheckAccessTokenAsync(string token) { AccessToken = null; webApiClient.Initialize(token); try { AccessToken = await Task.Run(() => webApiClient.Check()); } catch (Exception ex) { interactionRequestService.ShowError(Properties.Resources.Error, StringHelper.GetFullExceptionMessage(ex)); } finally { LoadingChangeActivity(false); } }
private void CheckinsProjectReport() { try { string reportPath = reportingService.CreateAllCheckinsReport(untappdService.GetCheckins(), untappdService.GetReportsDirectory(), untappdService.Untappd.UserName); System.Diagnostics.Process.Start(reportPath); } catch (Exception ex) { interactionRequestService.ShowError(Properties.Resources.Error, StringHelper.GetFullExceptionMessage(ex)); } }
private async void UpdateCheckinPhotoAsunc(Checkin checkin, string photoPath) { try { CheckinPhoto = await Task.Run(() => GetCheckinPhoto(checkin, photoPath)); } catch (Exception ex) { interactionRequestService.ShowError(Properties.Resources.Error, StringHelper.GetFullExceptionMessage(ex)); } finally { LoadingChangeActivity(false); } }
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); } }