static void HandleLog(string logString, string stackTrace, LogType type) { if (type != LogType.Exception) { return; } if (!IsPlasticStackTrace(stackTrace)) { return; } GUIActionRunner.RunGUIAction(delegate { mLog.ErrorFormat("[HandleLog] Unexpected error: {0}", logString); mLog.DebugFormat("Stack trace: {0}", stackTrace); string message = logString; if (ExceptionsHandler.DumpStackTrace()) { message += Environment.NewLine + stackTrace; } GuiMessage.ShowError(message); }); }
void AskCredentialsToUser.IGui.ShowSaveProfileErrorMessage(string message) { GUIActionRunner.RunGUIAction(delegate { GuiMessage.ShowError(string.Format( PlasticLocalization.GetString( PlasticLocalization.Name.CredentialsErrorSavingProfile), message)); }); }
public void AddElement( string element, IApplicationWindow window, IProgressControls progressControls) { if (string.IsNullOrEmpty(element)) { progressControls.ShowError( Localization.GetText( Localization.Name.ElementCantBeEmptyErrorMessage)); return; } progressControls.ShowProgress( Localization.GetText( Localization.Name.AddingElementProgressText, element)); IThreadWaiter waiter = ThreadWaiter.GetWaiter(); waiter.Execute( threadOperationDelegate: () => { DoHeavyWork(); if (mModel.Contains(element)) { throw new Exception( Localization.GetText( Localization.Name.ElementInTheListErrorMessage, element)); } mModel.Add(element); mModel.Sort(StringComparer.Ordinal); }, afterOperationDelegate: () => { progressControls.HideProgress(); if (waiter.Exception != null) { GuiMessage.ShowError( Localization.GetText(Localization.Name.ErrorTitle), waiter.Exception.Message); return; } window.UpdateItems(mModel); window.ClearInput(); }); }