private void SaveCSSFile() { string stylesheetDirectory = StyleSheetProvider.StylesheetDirectory; if (!string.IsNullOrEmpty(this.TextBox_Filename.Text)) { string extension = System.IO.Path.GetExtension(this.TextBox_Filename.Text); if (!extension.Equals(".css", System.StringComparison.OrdinalIgnoreCase)) { TextBox expr_3D = this.TextBox_Filename; expr_3D.Text += ".css"; } this.FileName = stylesheetDirectory + this.TextBox_Filename.Text; } else { this.FileName = stylesheetDirectory + this.newStyle + ".css"; int num = 1; while (System.IO.File.Exists(this.FileName)) { this._logger.Trace("Saving: File " + this.FileName + " already exists. Incrementing filename."); this.FileName = string.Concat(new object[] { stylesheetDirectory, this.newStyle, " (", num, ").css" }); num++; } } if (string.IsNullOrEmpty(this.FileName)) { return; } string directoryName = System.IO.Path.GetDirectoryName(this.FileName); if (directoryName != null && !System.IO.Directory.Exists(directoryName)) { try { System.IO.Directory.CreateDirectory(directoryName); } catch (System.Exception exception) { this._logger.ErrorException("Error creating directory for CSS save.", exception); } } try { this.Editor.Save(this.FileName); this.OriginalDocument = this.Editor.Text; this.IsNewFile = false; } catch (System.Exception exception2) { MessageBoxHelper.ShowErrorMessageBox(LocalizationProvider.GetLocalizedString("CssFileSaveErrorMessage", true, "MarkdownPadStrings") + this.FileName, LocalizationProvider.GetLocalizedString("CssFileSaveErrorTitle", false, "MarkdownPadStrings"), exception2, ""); } }
private void OnFinished(SimplePechkin converter, bool success) { if (!success) { PdfExporter._logger.Error("PDF export failed to: " + this.OutputFilename); MessageBox.Show(LocalizationProvider.GetLocalizedString("PdfExportFailedMessage", true, "MarkdownPadStrings") + this.OutputFilename, LocalizationProvider.GetLocalizedString("PdfExportFailedTitle", false, "MarkdownPadStrings"), MessageBoxButton.OK, MessageBoxImage.Hand); return; } PdfExporter._logger.Trace("Exported PDF document to: " + this.OutputFilename); if (!this._settings.IO_OpenPdfFileAfterExport) { return; } BackgroundWorker backgroundWorker = new BackgroundWorker(); backgroundWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(this.worker_RunWorkerCompleted); backgroundWorker.DoWork += delegate(object param0, DoWorkEventArgs param1) { int num = 1; while (!System.IO.File.Exists(this.OutputFilename) && num <= 10) { PdfExporter._logger.Trace(string.Concat(new object[] { "Try #", num, " ", System.IO.File.Exists(this.OutputFilename) })); num++; System.Threading.Thread.Sleep(300); } }; backgroundWorker.RunWorkerAsync(); }
protected virtual OrderShippingMethodViewModel GetShippingMethodViewModel(Shipment shipment, CreateOrderDetailViewModelParam param) { if (param.Order.Cart.Shipments == null) { throw new ArgumentNullException("param.Order.Cart.Shipments"); } if (shipment == null) { return(new OrderShippingMethodViewModel()); } var shippingMethodVm = ViewModelMapper.MapTo <OrderShippingMethodViewModel>(shipment.FulfillmentMethod, param.CultureInfo); if (param.Order.Cart.FulfillmentCost == 0) { var freeLabel = LocalizationProvider.GetLocalizedString(new GetLocalizedParam { Category = "ShoppingCart", Key = "L_Free", CultureInfo = param.CultureInfo }); shippingMethodVm.Cost = freeLabel; } shippingMethodVm.Taxable = shipment.IsShippingTaxable(); return(shippingMethodVm); }
public static void PopulateComboBoxWithMarkdownProcessors(ComboBox comboBox, MarkdownProcessorType selectedProcessor, Window window = null) { comboBox.ItemsSource = MarkdownProcessorProvider.AvailableMarkdownProcessors; comboBox.SelectedItem = MarkdownProcessorProvider.MarkdownProcessorMap[selectedProcessor]; comboBox.SelectionChanged += delegate(object sender, SelectionChangedEventArgs args) { object obj = args.AddedItems[0]; string text = string.Empty; if (obj is GitHubFlavoredMarkdownProcessor || obj is GitHubFlavoredMarkdownOffline) { text = LocalizationProvider.GetLocalizedString("Pro_GfmSupport", false, "MarkdownPadStrings"); } else { if (obj is MarkdownExtraProcessor) { text = LocalizationProvider.GetLocalizedString("Pro_MarkdownTables", false, "MarkdownPadStrings"); } } if (!string.IsNullOrEmpty(text) && !LicenseHelper.ValidateLicense(text, window)) { comboBox.SelectedItem = args.RemovedItems[0]; args.Handled = true; } }; }
private void ToggleSyntaxHighlighting(bool enable) { if (!enable) { this.Editor.SyntaxHighlighting = null; return; } IHighlightingDefinition syntaxHighlighting = null; switch (this.CodeType) { case CodeEditor.CodeDocumentType.Css: try { XmlTextReader xmlTextReaderFromResourceStream = XmlUtilities.GetXmlTextReaderFromResourceStream("MarkdownPad2.SyntaxRules.css.xshd"); syntaxHighlighting = HighlightingLoader.Load(xmlTextReaderFromResourceStream, HighlightingManager.Instance); } catch (System.Exception exception) { this._logger.ErrorException("Error loading syntax file: " + this.CodeType, exception); MessageBoxHelper.ShowErrorMessageBox(LocalizationProvider.GetLocalizedString("Error_LoadingSyntaxHighlighterMessage", false, "MarkdownPadStrings"), LocalizationProvider.GetLocalizedString("Error_LoadingSyntaxHighlighterTitle", false, "MarkdownPadStrings"), exception, ""); } break; case CodeEditor.CodeDocumentType.Html: syntaxHighlighting = HighlightingManager.Instance.GetDefinition("HTML"); break; } this.Editor.SyntaxHighlighting = syntaxHighlighting; }
protected virtual SearchPageViewModel GetPreviousPage(CreateSearchPaginationParam <TParam> param) { var searchCriteria = param.SearchParameters.Criteria; var previousPage = new SearchPageViewModel { DisplayName = LocalizationProvider .GetLocalizedString(new GetLocalizedParam { Category = "List-Search", Key = "B_Previous", CultureInfo = searchCriteria.CultureInfo }) }; if (param.CurrentPageIndex > 1) { searchCriteria.Page = param.CurrentPageIndex - 1; previousPage.Url = GenerateUrl(param); } else { previousPage.IsCurrentPage = true; } return(previousPage); }
protected virtual SearchPageViewModel GetNextPage(CreateSearchPaginationParam <TParam> param) { var searchCriteria = param.SearchParameters.Criteria; var nextPage = new SearchPageViewModel { DisplayName = LocalizationProvider .GetLocalizedString(new GetLocalizedParam { Category = "List-Search", Key = "B_Next", CultureInfo = searchCriteria.CultureInfo }) }; if (param.CurrentPageIndex < param.TotalNumberOfPages) { searchCriteria.Page = param.CurrentPageIndex + 1; nextPage.Url = GenerateUrl(param); } else { nextPage.IsCurrentPage = true; } return(nextPage); }
public void PrintMarkdown() { PrintDialog printDialog = new PrintDialog(); if (printDialog.ShowDialog() != true) { return; } FlowDocument flowDocument = this.CreateFlowDocument(this.Editor); flowDocument.PageHeight = printDialog.PrintableAreaHeight; flowDocument.PageWidth = printDialog.PrintableAreaWidth; flowDocument.PagePadding = new Thickness(72.0); flowDocument.ColumnGap = 0.0; flowDocument.ColumnWidth = flowDocument.PageWidth - flowDocument.ColumnGap - flowDocument.PagePadding.Left - flowDocument.PagePadding.Right; IDocumentPaginatorSource documentPaginatorSource = flowDocument; try { printDialog.PrintDocument(documentPaginatorSource.DocumentPaginator, "MarkdownPad Document"); } catch (System.Exception exception) { MarkdownEditor._logger.ErrorException("Exception while attempting to print Markdown plain text", exception); MessageBoxHelper.ShowErrorMessageBox(LocalizationProvider.GetLocalizedString("Error_PrintMarkdownMessage", false, "MarkdownPadStrings"), LocalizationProvider.GetLocalizedString("Error_PrintMarkdownTitle", false, "MarkdownPadStrings"), exception, ""); } }
internal static bool ValidateLicense(string featureDescription, Window owner) { Settings @default = Settings.Default; LicenseEngine licenseEngine = new LicenseEngine(); bool flag = licenseEngine.VerifyLicense(@default.App_LicenseKey, @default.App_LicenseEmail); if (!flag) { string localizedString = LocalizationProvider.GetLocalizedString("Pro_OneOfManyFeatures", false, "MarkdownPadStrings"); string localizedString2 = LocalizationProvider.GetLocalizedString("Pro_LearnMore", false, "MarkdownPadStrings"); string localizedString3 = LocalizationProvider.GetLocalizedString("Pro_OnlyAvailableInPro", false, "MarkdownPadStrings"); MessageBoxResult messageBoxResult = CustomMessageBox.ShowYesNo(string.Concat(new string[] { featureDescription, " ", localizedString, StringUtilities.GetNewLines(2), localizedString2 }), localizedString3, LocalizationProvider.GetLocalizedString("Yes", false, "MarkdownPadStrings"), LocalizationProvider.GetLocalizedString("No", false, "MarkdownPadStrings"), MessageBoxImage.Asterisk); if (messageBoxResult == MessageBoxResult.Yes) { UpgradeProWindow upgradeProWindow = new UpgradeProWindow { Owner = owner }; upgradeProWindow.ShowDialog(); } } return(flag); }
public void WriteBuiltInStylesheetsToAppData(bool overwriteExisting = false) { System.Collections.Generic.List <string> builtInStylesheets = StyleSheetProvider.GetBuiltInStylesheets(); foreach (string current in builtInStylesheets) { string str = current.Replace("MarkdownPad2.Stylesheets.", ""); if (!overwriteExisting && System.IO.File.Exists(StyleSheetProvider.StylesheetDirectory + str)) { StyleSheetProvider._logger.Trace("Style already exists in AppData, skipping: " + str); } else { System.Reflection.Assembly executingAssembly = System.Reflection.Assembly.GetExecutingAssembly(); using (System.IO.StreamReader streamReader = new System.IO.StreamReader(executingAssembly.GetManifestResourceStream(current))) { StyleSheetProvider._logger.Trace("Writing file to " + str); try { if (!System.IO.Directory.Exists(StyleSheetProvider.StylesheetDirectory)) { StyleSheetProvider._logger.Trace("Stylesheet directory doesn't exist, creating it"); System.IO.Directory.CreateDirectory(StyleSheetProvider.StylesheetDirectory); } System.IO.File.WriteAllText(StyleSheetProvider.StylesheetDirectory + str, streamReader.ReadToEnd()); } catch (System.Exception exception) { StyleSheetProvider._logger.ErrorException("Error writing stylesheet to AppData: " + current, exception); MessageBoxHelper.ShowErrorMessageBox(LocalizationProvider.GetLocalizedString("Error_WritingStylesheetToFileMessage", true, "MarkdownPadStrings") + str, LocalizationProvider.GetLocalizedString("Error_WritingStylesheetToFileTitle", false, "MarkdownPadStrings"), exception, ""); } } } } }
public void SaveDocument(string fileName) { System.Text.UTF8Encoding encoding = this._settings.IO_ExportTextWithBom ? new System.Text.UTF8Encoding(true) : new System.Text.UTF8Encoding(false); using (System.IO.TextWriter textWriter = new System.IO.StreamWriter(fileName, false, encoding)) { string text = this.Editor.Text; if (this._settings.IO_UseUnixStyleEol) { textWriter.NewLine = "\n"; text = text.ConvertTextToUnixEol(); } else { textWriter.NewLine = "\r\n"; } try { textWriter.Write(text); this.Filename = fileName; this.OnPropertyChanged("Filename"); this.FileLastModified = System.DateTime.Now; MarkdownEditor._logger.Trace("Saved file: " + fileName); this.OriginalDocument = this.Editor.Text; this.OnPropertyChanged("HasChanges"); this.StatusMessage = string.Format(LocalizationProvider.GetLocalizedString("FileSavedNotification", false, "MarkdownPadStrings"), System.IO.Path.GetFileName(fileName), System.DateTime.Now); } catch (System.Exception exception) { MarkdownEditor._logger.ErrorException("Exception while saving text", exception); throw; } } }
public static void MoveFile(string file, string destination) { try { if (System.IO.File.Exists(destination)) { FileUtils._logger.Info("Overwriting existing file: " + destination); System.IO.File.Delete(destination); } System.IO.File.Move(file, destination); } catch (System.Exception exception) { FileUtils._logger.ErrorException(string.Format("Unable to move file from source ({0}) to destination ({1})", file, destination), exception); MessageBoxHelper.ShowErrorMessageBox(string.Concat(new string[] { LocalizationProvider.GetLocalizedString("Error_MovingFile_Message", false, "MarkdownPadStrings"), StringUtilities.GetNewLines(2), LocalizationProvider.GetLocalizedString("Error_MovingFileSource", true, "MarkdownPadStrings"), file, StringUtilities.GetNewLines(2), LocalizationProvider.GetLocalizedString("Error_MovingFileDestination", true, "MarkdownPadStrings"), destination }), LocalizationProvider.GetLocalizedString("Error_MovingFile_Title", false, "MarkdownPadStrings"), exception, ""); } }
public bool VerifyLicense(string licenseKey, string email) { this.LicenseProcessed = true; return(true); bool result; try { } catch (System.FormatException exception) { LicenseEngine._logger.ErrorException("Bad license format", exception); MessageBoxHelper.ShowWarningMessageBox(LocalizationProvider.GetLocalizedString("License_BadFormat", false, "MarkdownPadStrings") + StringUtilities.GetNewLines(2) + LocalizationProvider.GetLocalizedString("License_PleaseVerify", false, "MarkdownPadStrings"), LocalizationProvider.GetLocalizedString("License_ErrorTitle", false, "MarkdownPadStrings")); result = false; } catch (OpenSslException exception2) { LicenseEngine._logger.ErrorException("Error decrypting license", exception2); MessageBoxHelper.ShowWarningMessageBox(LocalizationProvider.GetLocalizedString("License_ErrorMessage", false, "MarkdownPadStrings") + StringUtilities.GetNewLines(2) + LocalizationProvider.GetLocalizedString("License_PleaseVerify", false, "MarkdownPadStrings"), LocalizationProvider.GetLocalizedString("License_ErrorTitle", false, "MarkdownPadStrings")); result = false; } catch (System.Exception exception3) { LicenseEngine._logger.ErrorException("Error processing license: " + licenseKey, exception3); MessageBoxHelper.ShowErrorMessageBox(LocalizationProvider.GetLocalizedString("License_ErrorMessage", false, "MarkdownPadStrings") + StringUtilities.GetNewLines(2) + LocalizationProvider.GetLocalizedString("License_PleaseVerify", false, "MarkdownPadStrings"), LocalizationProvider.GetLocalizedString("License_ErrorTitle", false, "MarkdownPadStrings"), exception3, ""); result = false; } return(result); }
public void Render(bool doBlockingRender) { if (!this._settings.App_LivePreviewEnabled) { return; } if (!this.Renderer.IsLoaded) { EditorRenderer._logger.Warn("Tried to render but Renderer wasn't loaded"); return; } if (!this.Editor.MarkdownProcessor.BackgroundRenderingAllowed || doBlockingRender) { string text = this.Editor.MarkdownText; string text2 = this.LoadSupplementalMarkdownFromFile(); if (!string.IsNullOrEmpty(text2)) { text = text + StringUtilities.GetNewLines(2) + text2; } string content = this.Editor.MarkdownProcessor.ConvertMarkdownToHTML(text); this.InsertHtmlIntoRenderer(content); return; } BackgroundWorker backgroundWorker = new BackgroundWorker { WorkerSupportsCancellation = true }; backgroundWorker.DoWork += delegate(object sender, DoWorkEventArgs args) { if (args.Argument == null) { args.Cancel = true; return; } string text3 = args.Argument.ToString(); string text4 = this.LoadSupplementalMarkdownFromFile(); if (!string.IsNullOrEmpty(text4)) { text3 = text3 + StringUtilities.GetNewLines(2) + text4; } string result = this.Editor.MarkdownProcessor.ConvertMarkdownToHTML(text3); args.Result = result; }; backgroundWorker.RunWorkerCompleted += delegate(object sender, RunWorkerCompletedEventArgs args) { if (args.Error != null) { EditorRenderer._logger.ErrorException("Error processing Markdown - received in RunWorkerCompleted", args.Error); MessageBoxHelper.ShowErrorMessageBox(LocalizationProvider.GetLocalizedString("Error_ProcessingMarkdownMessage", false, "MarkdownPadStrings"), LocalizationProvider.GetLocalizedString("Error_ProcessingMarkdownTitle", false, "MarkdownPadStrings"), args.Error, ""); return; } string content2 = args.Result.ToString(); this.InsertHtmlIntoRenderer(content2); }; string markdownText = this.Editor.MarkdownText; backgroundWorker.RunWorkerAsync(markdownText); }
protected virtual string GetOrderStatusDisplayName(CreateOrderDetailViewModelParam param) { return(LocalizationProvider.GetLocalizedString(new GetLocalizedParam { Category = "General", Key = $"L_OrderStatus_{param.Order.OrderStatus}", CultureInfo = param.CultureInfo })); }
protected virtual string GetOrderStatusDisplayName(OrderItem rawOrder, GetOrderHistoryViewModelParam param) { return(LocalizationProvider.GetLocalizedString(new GetLocalizedParam { Category = "General", Key = $"L_OrderStatus_{rawOrder.OrderStatus}", CultureInfo = param.CultureInfo })); }
protected virtual string LocalizeString(string category, string key, CultureInfo cultureInfo) { return(LocalizationProvider.GetLocalizedString(new GetLocalizedParam { Category = category, Key = key, CultureInfo = cultureInfo })); }
protected virtual string GetFreeShippingPriceLabel(CultureInfo cultureInfo) { return(LocalizationProvider.GetLocalizedString(new GetLocalizedParam { Category = "ShoppingCart", Key = "L_Free", CultureInfo = cultureInfo })); }
private void Button_Browse_Click(object sender, RoutedEventArgs e) { string localizedString = LocalizationProvider.GetLocalizedString("Pro_ImageUploader", false, "MarkdownPadStrings"); if (!LicenseHelper.ValidateLicense(localizedString, this)) { return; } this.BrowseAndUploadImage(); }
protected virtual string GetOpeningTimeFormat(CultureInfo cultureInfo) { var openingTimeFormat = LocalizationProvider.GetLocalizedString(new GetLocalizedParam { Category = "Store", Key = "OpeningHourFormat", CultureInfo = cultureInfo }); return(string.IsNullOrWhiteSpace(openingTimeFormat) ? "{0:t}" : openingTimeFormat); }
private void LoadTextFile(string fileName) { try { this.Editor.Load(fileName); } catch (System.Exception exception) { this._logger.ErrorException("Error opening file: " + fileName, exception); MessageBoxHelper.ShowErrorMessageBox(LocalizationProvider.GetLocalizedString("ErrorWhileOpeningFileMessage", true, "MarkdownPadStrings") + fileName, LocalizationProvider.GetLocalizedString("ErrorWhileOpeningFileTitle", false, "MarkdownPadStrings"), exception, ""); } }
protected virtual string GetStoreMetaDescription(GetStorePageHeaderViewModelParam param, StoreViewModel store) { var template = LocalizationProvider.GetLocalizedString(new GetLocalizedParam { Category = "Store", CultureInfo = param.CultureInfo, Key = "M_Description" }); return(!string.IsNullOrWhiteSpace(template) && template.Contains("{0}") ? string.Format(template, store.LocalizedDisplayName) : template); }
protected virtual string GetFormattedAddressPhoneNumber(string phoneNumber, CultureInfo cultureInfo) { var localFormattingString = LocalizationProvider.GetLocalizedString(new GetLocalizedParam { Category = "Store", Key = "PhoneNumberFormat", CultureInfo = cultureInfo }); return(localFormattingString != null && long.TryParse(phoneNumber, out long phoneNumberAsInt) ? string.Format(cultureInfo, localFormattingString, phoneNumberAsInt) : phoneNumber); }
protected virtual string GetPageTitle(GetPageHeaderParam param) { var templateTitle = LocalizationProvider.GetLocalizedString(new GetLocalizedParam { Category = "List-Search", Key = "L_SearchResultsForBreadcrumb", CultureInfo = ComposerContext.CultureInfo }); var pageTitle = templateTitle + " \"" + param.Keywords + "\""; return(pageTitle); }
private void Renderer_OpenExternalLink(object sender, OpenExternalLinkEventArgs e) { if (e.Url.StartsWith("local://base_request.html/")) { string str = e.Url.Replace("local://base_request.html/", ""); EditorRenderer._logger.Trace("Found local resource request: " + str); this.Editor.StatusMessage = LocalizationProvider.GetLocalizedString("InternalNavigationDisabledInLivePreview", false, "MarkdownPadStrings"); return; } string url = e.Url; url.TryStartDefaultProcess(); }
public void ExportHtml() { string text = this.Filename; if (string.IsNullOrEmpty(text)) { text = this.Title; } SaveFileDialog saveFileDialog = new SaveFileDialog { Filter = this.SaveHtmlFileTypes, FileName = System.IO.Path.GetFileNameWithoutExtension(text), RestoreDirectory = true }; bool? flag = saveFileDialog.ShowDialog(); string fileName = saveFileDialog.FileName; if (!flag.Value || string.IsNullOrEmpty(fileName)) { return; } EditorRenderer._logger.Trace("Exporting HTML document: " + fileName); string text2 = this.HtmlTemplate.GenerateHtmlTemplate(false); System.Text.Encoding encoding = new System.Text.UTF8Encoding(this._settings.IO_ExportHtmlWithBom); using (System.IO.TextWriter textWriter = new System.IO.StreamWriter(fileName, false, encoding)) { if (this._settings.IO_UseUnixStyleEol) { textWriter.NewLine = "\n"; text2 = text2.ConvertTextToUnixEol(); } else { textWriter.NewLine = "\r\n"; } try { textWriter.Write(text2); } catch (System.Exception exception) { EditorRenderer._logger.ErrorException("Exception while exporting HTML", exception); MessageBoxHelper.ShowErrorMessageBox(LocalizationProvider.GetLocalizedString("Error_ExportingHtmlMessage", true, "MarkdownPadStrings") + fileName, LocalizationProvider.GetLocalizedString("Error_ExportingHtmlTitle", false, "MarkdownPadStrings"), exception, ""); } } if (System.IO.File.Exists(fileName) && this._settings.IO_OpenHtmlFileAfterExport) { fileName.TryStartDefaultProcess(); } }
protected virtual List <PreferredLanguageViewModel> GetPreferredLanguageViewModel(CultureInfo currentCulture, string customerLanguage) { var allcultures = CultureService.GetAllSupportedCultures(); CultureInfo customerCultureInfo = null; var languages = (from culture in allcultures let displayName = LocalizationProvider.GetLocalizedString(new GetLocalizedParam { CultureInfo = currentCulture, Category = "General", Key = culture.DisplayName }) select new PreferredLanguageViewModel { DisplayName = displayName, IsoCode = culture.Name, IsSelected = customerLanguage == culture.Name }).ToList(); if (!languages.Any(item => item.IsSelected)) { try { customerCultureInfo = CultureInfo.GetCultureInfo(customerLanguage); } catch (Exception ex) { var errorMessage = string.Format("Culture not found: {0}", customerLanguage); Log.ErrorException(errorMessage, ex); } if (customerCultureInfo != null) { var affinityCultureName = CultureService.GetAffinityCulture(customerCultureInfo)?.Name; if (string.IsNullOrEmpty(affinityCultureName)) { return(languages); } var affinityLanguage = languages.FirstOrDefault(item => affinityCultureName == item.IsoCode); if (affinityLanguage != null) { affinityLanguage.IsSelected = true; } } } return(languages); }
protected virtual StorePaginationViewModel BuildPagination(int totalCount, GetStoresParam param) { StorePageViewModel prevPage = null, nextPage = null; if (param.PageSize * param.PageNumber < totalCount) { nextPage = new StorePageViewModel { DisplayName = LocalizationProvider.GetLocalizedString(new GetLocalizedParam { Category = "Store", Key = "B_PaginationNext", CultureInfo = param.CultureInfo }), Url = StoreUrlProvider.GetStoresDirectoryUrl(new GetStoresDirectoryUrlParam { BaseUrl = param.BaseUrl, CultureInfo = param.CultureInfo, Page = param.PageNumber + 1 }) }; } if (param.PageNumber > 1) { prevPage = new StorePageViewModel { DisplayName = LocalizationProvider.GetLocalizedString(new GetLocalizedParam { Category = "Store", Key = "B_PaginationPrev", CultureInfo = param.CultureInfo }), Url = StoreUrlProvider.GetStoresDirectoryUrl(new GetStoresDirectoryUrlParam { BaseUrl = param.BaseUrl, CultureInfo = param.CultureInfo, Page = param.PageNumber - 1 }) }; } var pager = new StorePaginationViewModel { PreviousPage = prevPage, NextPage = nextPage }; return(pager); }
public static void TryStartSpecificProcess(this string fileLocation, string process, string argument) { if (string.IsNullOrEmpty(fileLocation)) { return; } try { Process.Start(process, argument + fileLocation); } catch (System.Exception exception) { ProcessUtilities._logger.ErrorException("Exception trying to start process", exception); MessageBoxHelper.ShowErrorMessageBox(LocalizationProvider.GetLocalizedString("Error_OpeningDefaultApplicationMessage", true, "MarkdownPadStrings") + fileLocation, LocalizationProvider.GetLocalizedString("Error_OpeningDefaultApplicationTitle", false, "MarkdownPadStrings"), exception, ""); } }
public static void ShowErrorMessageBox(string message, string title, System.Exception exception = null, string exceptionDetails = "") { string localizedString = LocalizationProvider.GetLocalizedString("OK", false, "MarkdownPadStrings"); string localizedString2 = LocalizationProvider.GetLocalizedString("Button_ReportBug", false, "MarkdownPadStrings"); if (exception != null) { message = message + StringUtilities.GetNewLines(2) + exception.Message; } message = message + StringUtilities.GetNewLines(2) + LocalizationProvider.GetLocalizedString("IfBugPersists", false, "MarkdownPadStrings"); MessageBoxResult messageBoxResult = CustomMessageBox.ShowYesNo(message, title, localizedString, localizedString2, MessageBoxImage.Hand); if (messageBoxResult != MessageBoxResult.No) { return; } BugReportHelper.ShowBugReport(exception, exceptionDetails); }