/// <summary> /// Configures the decision expression. /// Travis.Frisinger - Developed for new Decision Wizard /// </summary> void ConfigureDecisionExpression(ConfigureDecisionExpressionMessage args) { var condition = ConfigureActivity <DsfFlowDecisionActivity>(args.ModelItem, GlobalConstants.ConditionPropertyText, args.IsNew); if (condition == null) { return; } var expression = condition.Properties[GlobalConstants.ExpressionPropertyText]; var ds = DataListConstants.DefaultStack; if (expression != null && expression.Value != null) { //we got a model, push it in to the Model region ;) // but first, strip and extract the model data ;) var eval = Dev2DecisionStack.ExtractModelFromWorkflowPersistedData(expression.Value.ToString()); if (!string.IsNullOrEmpty(eval)) { ds = JsonConvert.DeserializeObject <Dev2DecisionStack>(eval); } } var displayName = args.ModelItem.Properties[GlobalConstants.DisplayNamePropertyText]; if (displayName != null && displayName.Value != null) { ds.DisplayText = displayName.Value.ToString(); } var val = JsonConvert.SerializeObject(ds); // Now invoke the Wizard ;) _callBackHandler = StartDecisionWizard(args.EnvironmentModel, val); // Wizard finished... try { string tmp = WebHelper.CleanModelData(_callBackHandler); var dds = JsonConvert.DeserializeObject <Dev2DecisionStack>(tmp); if (dds == null) { return; } ActivityHelper.SetArmTextDefaults(dds); ActivityHelper.InjectExpression(dds, expression); ActivityHelper.SetArmText(args.ModelItem, dds); ActivityHelper.SetDisplayName(args.ModelItem, dds); // PBI 9220 - 2013.04.29 - TWR } catch { _popupController.Show(GlobalConstants.DecisionWizardErrorString, GlobalConstants.DecisionWizardErrorHeading, MessageBoxButton.OK, MessageBoxImage.Error, null); } }
void DoneButton_OnClick(object sender, RoutedEventArgs e) { bool valid = true; var content = ControlContentPresenter.Content as ActivityDesignerTemplate; if (content == null) { valid = ValidateSwitchCase(true); } else { var dataContext = content.DataContext as DecisionDesignerViewModel; if (dataContext != null) { dataContext.Validate(); if (dataContext.Errors != null) { PopupController.Show(dataContext.Errors[0].Message, "Decision Error", MessageBoxButton.OK, MessageBoxImage.Error, "", false, true, false, false, false, false); valid = false; } } } if (valid) { DialogResult = true; Close(); } }
public void QuickDebug() { if (DebugOutputViewModel.IsProcessing) { StopExecution(); } if (WorkflowDesignerViewModel.ValidatResourceModel(ContextualResourceModel.DataList)) { if (!ContextualResourceModel.IsWorkflowSaved && !_workspaceSaved) { var successfuleSave = Save(ContextualResourceModel, true); if (!successfuleSave) { return; } } } else { _popupController.Show(StringResources.Debugging_Error, StringResources.Debugging_Error_Title, MessageBoxButton.OK, MessageBoxImage.Error, "", false, true, false, false, false, false); SetDebugStatus(DebugStatus.Finished); return; } var inputDataViewModel = SetupForDebug(ContextualResourceModel, true); inputDataViewModel.LoadWorkflowInputs(); inputDataViewModel.Save(); }
public static string ConfigureSwitchExpression(ConfigureSwitchExpressionMessage args) { OldSwitchValue = string.Empty; var expression = ConfigureActivity <DsfFlowSwitchActivity>(args.ModelItem, GlobalConstants.SwitchExpressionPropertyText, args.IsNew); if (expression == null) { return(null); } var expressionText = expression.Properties[GlobalConstants.SwitchExpressionTextPropertyText]; var modelProperty = args.ModelItem.Properties[GlobalConstants.DisplayNamePropertyText]; if (modelProperty?.Value != null) { _callBackHandler = StartSwitchDropWizard(expression, modelProperty.Value.ToString()); } if (_callBackHandler != null) { try { var modelData = _callBackHandler.ModelData; var resultSwitch = JsonConvert.DeserializeObject <Dev2Switch>(modelData); var expr = ActivityHelper.InjectExpression(resultSwitch, expressionText); ActivityHelper.SetDisplayName(args.ModelItem, resultSwitch); // MUST use args.ModelItem otherwise it won't be visible! return(expr); } catch { PopupController.Show(GlobalConstants.SwitchWizardErrorString, GlobalConstants.SwitchWizardErrorHeading, MessageBoxButton.OK, MessageBoxImage.Error, null, false, true, false, false, false, false); } } return(null); }
public void OpenMoreLink(IDebugLineItem item) { if (item == null) { Dev2Logger.Log.Debug("Debug line item is null, did not proceed"); return; } if (string.IsNullOrEmpty(item.MoreLink)) { Dev2Logger.Log.Debug("Link is empty"); } else { try { string debugItemTempFilePath = FileHelper.GetDebugItemTempFilePath(item.MoreLink); Dev2Logger.Log.Debug(string.Format("Debug file path is [{0}]", debugItemTempFilePath)); ProcessController = new ProcessController(Process.Start(new ProcessStartInfo(debugItemTempFilePath))); } catch (Exception ex) { Dev2Logger.Log.Error(ex); if (ex.Message.Contains("The remote name could not be resolved")) { _popup.Show("Warewolf was unable to download the debug output values from the remote server. Please insure that the remote server is accessible.", "Failed to retrieve remote debug items", MessageBoxButton.OK, MessageBoxImage.Error, ""); } else { throw; } } } }
public static void ShowExampleWorkflow(string activityName, IEnvironmentModel environment, IPopupController popupController) { var resourceID = GetExampleID(activityName); var resource = environment.ResourceRepository .FindSingle(r => r.ID.Equals(resourceID)); if (resource == null) { if (popupController == null) { var message = string.Format( StringResources.ExampleWorkflowNotFound, GetExampleName(activityName)); MessageBox.Show(message, "Information", MessageBoxButton.OK, MessageBoxImage.Information); } else { popupController.Buttons = MessageBoxButton.OK; popupController.Description = string.Format(StringResources.ExampleWorkflowNotFound, resourceID); popupController.Header = "Example Workflow Not Found"; popupController.ImageType = MessageBoxImage.Information; popupController.Show(); } } else { resource.ResourceType = ResourceType.WorkflowService; EditResource(resource, EventPublishers.Aggregator); } }
public void QuickDebug() { if (DebugOutputViewModel.IsProcessing) { StopExecution(); Thread.Sleep(500); } if (WorkflowDesignerViewModel.ValidatResourceModel(ContextualResourceModel.DataList)) { var successfuleSave = Save(ContextualResourceModel, true); if (!successfuleSave) { return; } } else { _popupController.Show("Please resolve all variable errors, before debugging." + System.Environment.NewLine, "Error Debugging", MessageBoxButton.OK, MessageBoxImage.Error, "true"); SetDebugStatus(DebugStatus.Finished); return; } SetDebugStatus(DebugStatus.Configure); var inputDataViewModel = SetupForDebug(ContextualResourceModel, true); inputDataViewModel.LoadWorkflowInputs(); inputDataViewModel.Save(); }
public async Task <IExplorerItem> Load(bool reloadCatalogue, IPopupController popupController) { if (!Connection.IsConnected) { ShowServerDisconnectedPopup(); return(new ServerExplorerItem()); } var comsController = CommunicationControllerFactory.CreateController("FetchExplorerItemsService"); comsController.AddPayloadArgument("ReloadResourceCatalogue", reloadCatalogue.ToString()); if (Connection.IsLocalHost) { var result = await comsController.ExecuteCompressedCommandAsync <IExplorerItem>(Connection, GlobalConstants.ServerWorkspaceID).ConfigureAwait(true); return(result); } else { var fetchExplorerTask = comsController.ExecuteCompressedCommandAsync <IExplorerItem>(Connection, GlobalConstants.ServerWorkspaceID); var delayTask = Task.Delay(60000).ContinueWith((t) => { if (fetchExplorerTask.Status != TaskStatus.RanToCompletion) { popupController?.Show(string.Format(ErrorResource.ServerBusyError, Connection.DisplayName), ErrorResource.ServerBusyHeader, MessageBoxButton.OK, MessageBoxImage.Warning, "", false, false, true, false, false, false); } }, System.Threading.Tasks.TaskScheduler.FromCurrentSynchronizationContext()); var result = await fetchExplorerTask.ConfigureAwait(true); return(result); } }
public void DeleteCommand(IExplorerTreeItem parent, IExplorerRepository explorerRepository, ExplorerItemViewModel explorerItemViewModel, IPopupController popupController, IServer server) { try { if (explorerItemViewModel.IsResourceVersion) { DeleteVersionCommand(explorerRepository, explorerItemViewModel, parent, explorerItemViewModel.ResourceName); } else { var messageBoxResult = popupController.Show(popupController.GetDeleteConfirmation(explorerItemViewModel.ResourceName)); if (server != null && messageBoxResult == MessageBoxResult.Yes) { _shellViewModel.CloseResource(explorerItemViewModel.ResourceId, server.EnvironmentID); var deletedFileMetadata = explorerRepository.Delete(explorerItemViewModel); if (deletedFileMetadata.IsDeleted) { if (explorerItemViewModel.ResourceType == @"ServerSource" || explorerItemViewModel.IsServer) { server.UpdateRepository.FireServerSaved(explorerItemViewModel.ResourceId, true); } parent?.RemoveChild(explorerItemViewModel); } } } } catch (Exception ex) { explorerItemViewModel.ShowErrorMessage(ex.Message, @"Delete not allowed"); } }
public void ShowInvalidDataPopupMessage() { _popupController.Show(StringResources.DataInput_Error, StringResources.DataInput_Error_Title, MessageBoxButton.OK, MessageBoxImage.Error, string.Empty, false, true, false, false, false, false); IsInError = true; }
void ProcessControllerHasError(Exception ex) { if (ex.Message.Contains("The remote name could not be resolved")) { _popup.Show( string.Format(Warewolf.Studio.Resources.Languages.Core.DebugCouldNotGetRemoteDebugItemsError, Environment.NewLine), Warewolf.Studio.Resources.Languages.Core.DebugCouldNotGetRemoteDebugItemsErrorHeader, MessageBoxButton.OK, MessageBoxImage.Error, "", false, true, false, false, false, false); } else { _popup.Show( string.Format(Warewolf.Studio.Resources.Languages.Core.DebugCouldNotGetDebugItemsError, Environment.NewLine), Warewolf.Studio.Resources.Languages.Core.DebugCouldNotGetDebugItemsErrorHeader, MessageBoxButton.OK, MessageBoxImage.Error, "", false, true, false, false, false, false); } }
public IDisposable Bind(AuthenticationModel model) { model.SetProxyCommand = ReactiveCommand.Create( () => _popupController.Show(new ProxyPopupContext()), null, RxApp.MainThreadScheduler); return(model.SetProxyCommand); }
public AuthenticationModel( IFactory <ProxyPopupModel> proxyPopupModelFactory, IAuthenticator authenticator, IPopupController popupController ) { _modelDisposable = new CompositeDisposable(); SetProxyCommand = ReactiveCommand.Create(() => { var popupModel = proxyPopupModelFactory.Create(); popupController.Show(popupModel); }); var canSendCode = this .WhenAnyValue(x => x.PhoneNumber) .Select(phone => !string.IsNullOrWhiteSpace(phone)); SendCodeCommand = ReactiveCommand.CreateFromObservable( () => authenticator.SetPhoneNumber(PhoneNumber), canSendCode, RxApp.MainThreadScheduler); var canCheckCode = this .WhenAnyValue(x => x.ConfirmCode) .Select(code => !string.IsNullOrWhiteSpace(code)); CheckCodeCommand = ReactiveCommand.CreateFromObservable( () => authenticator.CheckCode(ConfirmCode, FirstName, LastName), canCheckCode, RxApp.MainThreadScheduler); var canCheckPassword = this .WhenAnyValue(x => x.Password) .Select(password => !string.IsNullOrWhiteSpace(password)); CheckPasswordCommand = ReactiveCommand.CreateFromObservable( () => authenticator.CheckPassword(Password), canCheckPassword, RxApp.MainThreadScheduler); var stateObservable = authenticator .ObserveState() .ObserveOn(RxApp.MainThreadScheduler); stateObservable .OfType <TdApi.AuthorizationState.AuthorizationStateWaitPhoneNumber>() .Subscribe(state => OnWaitingPhoneNumber()) .DisposeWith(_modelDisposable); stateObservable .OfType <TdApi.AuthorizationState.AuthorizationStateWaitCode>() .Subscribe(state => OnWaitingConfirmCode(!state.IsRegistered)) .DisposeWith(_modelDisposable); stateObservable .OfType <TdApi.AuthorizationState.AuthorizationStateWaitPassword>() .Subscribe(state => OnWaitingPassword()) .DisposeWith(_modelDisposable); }
internal static void IntellisenseTextBoxTabInsertedEvent(object sender, RoutedEventArgs e) { Application.Current.Dispatcher.BeginInvoke(new Action(() => { IPopupController popup = CustomContainer.Get <IPopupController>(); popup.Show("You have pasted text which contins tabs into a textbox on the design surface. Tabs are not allowed in textboxes on the design surface and will be replaced with spaces. " + Environment.NewLine + Environment.NewLine + "Please note that tabs are fully supported but the runtime, in variables and when reading from files.", "Tabs Pasted", MessageBoxButton.OK, MessageBoxImage.Information, GlobalConstants.Dev2MessageBoxDesignSurfaceTabPasteDialog); }), null); }
static void ValidatePayload(IEnvironmentConnection connection, StringBuilder payload, IPopupController popupController) { if ((payload == null || payload.Length == 0) && connection.HubConnection != null && popupController != null && connection.HubConnection.State == ConnectionStateWrapped.Disconnected && Application.Current != null) { Application.Current.Dispatcher.Invoke(() => { popupController.Show(ErrorResource.ServerconnectionDropped + Environment.NewLine + ErrorResource.EnsureConnectionToServerWorking , ErrorResource.ServerDroppedErrorHeading, MessageBoxButton.OK, MessageBoxImage.Information, "", false, false, true, false, false, false); }); } }
public static IDisposable BindProxySettings( this AuthenticationModel model, IPopupController popupController) { model.SetProxyCommand = ReactiveCommand.Create( () => popupController.Show(new ProxyPopupContext()), null, RxApp.MainThreadScheduler); return(Disposable.Empty); }
public bool DoDeactivate(bool showMessage) { if (showMessage) { ViewModel.UpdateHelpDescriptor(string.Empty); if (ViewModel.IsDirty) { var result = _popupController.Show(string.Format(StringResources.ItemSource_NotSaved), $"Save {ViewModel.DisplayName.Replace("*", "")}?", MessageBoxButton.YesNoCancel, MessageBoxImage.Information, "", false, false, true, false, false, false); switch (result) { case MessageBoxResult.Cancel: case MessageBoxResult.None: return(false); case MessageBoxResult.No: return(true); case MessageBoxResult.Yes: TrySave(); break; case MessageBoxResult.OK: break; default: return(true); } if (result == MessageBoxResult.Yes && ViewModel.HasDuplicates()) { return(false);//dont close the tab } } } else { ViewModel.UpdateHelpDescriptor(string.Empty); if (ViewModel.CanSave) { ViewModel.Save(); } } return(true); }
void DeleteCommand(IExplorerTreeItem parent, IExplorerRepository explorerRepository, ExplorerItemViewModel explorerItemViewModel, IPopupController popupController, IServer server) { var messageBoxResult = popupController.Show(popupController.GetDeleteConfirmation(explorerItemViewModel.ResourceName)); if (server != null && messageBoxResult == MessageBoxResult.Yes) { _shellViewModel.CloseResource(explorerItemViewModel.ResourceId, server.EnvironmentID); var deletedFileMetadata = explorerRepository.TryDelete(explorerItemViewModel); if (deletedFileMetadata.IsDeleted) { if (explorerItemViewModel.ResourceType == @"ServerSource" || explorerItemViewModel.IsServer) { server.UpdateRepository.FireServerSaved(explorerItemViewModel.ResourceId, true); } parent?.RemoveChild(explorerItemViewModel); } } }
static void IsConnectionValid(IEnvironmentConnection connection, IPopupController popupController) { if (connection != null) { try { if (!connection.IsConnecting) { popupController?.Show(string.Format(ErrorResource.ServerDisconnected, connection.DisplayName) + Environment.NewLine + ErrorResource.ServerReconnectForActions, ErrorResource.ServerDisconnectedHeader, MessageBoxButton.OK, MessageBoxImage.Information, "", false, false, true, false, false, false); } } catch (Exception e) { Dev2Logger.Error("Error popup", e, "Warewolf Error"); } } }
public bool DoDeactivate(bool showMessage) { if (showMessage) { ViewModel.UpdateHelpDescriptor(string.Empty); if (ViewModel.HasChanged) { var result = _popupController.Show(string.Format(StringResources.ItemSource_NotSaved), $"Save {ViewModel.Header.Replace("*", "")}?", MessageBoxButton.YesNoCancel, MessageBoxImage.Information, "", false, false, true, false, false, false); switch (result) { case MessageBoxResult.Cancel: case MessageBoxResult.None: return(false); case MessageBoxResult.No: return(true); case MessageBoxResult.Yes: if (ViewModel.CanSave()) { ViewModel.Save(); } break; } } } else { ViewModel.UpdateHelpDescriptor(String.Empty); if (ViewModel.CanSave()) { ViewModel.Save(); } } return(true); }
public IDeletedFileMetadata HasDependencies(IExplorerItemViewModel explorerItemViewModel, IDependencyGraphGenerator graphGenerator, IExecuteMessage dep) { var graph = graphGenerator.BuildGraph(dep.Message, "", 1000, 1000, 1); _popupController = CustomContainer.Get <IPopupController>(); if (graph.Nodes.Count > 1) { var result = _popupController.Show(string.Format(StringResources.Delete_Error, explorerItemViewModel.ResourceName), string.Format(StringResources.Delete_Error_Title, explorerItemViewModel.ResourceName), MessageBoxButton.OK, MessageBoxImage.Warning, "false", true, false, true, false, true, true); if (_popupController.DeleteAnyway) { return(new DeletedFileMetadata { IsDeleted = false, ResourceId = explorerItemViewModel.ResourceId, ShowDependencies = false, ApplyToAll = _popupController.ApplyToAll, DeleteAnyway = _popupController.DeleteAnyway }); } if (result == MessageBoxResult.OK) { return(BuildMetadata(explorerItemViewModel.ResourceId, false, false, _popupController.ApplyToAll, _popupController.DeleteAnyway)); } explorerItemViewModel.ShowDependencies(); return(BuildMetadata(explorerItemViewModel.ResourceId, false, true, _popupController.ApplyToAll, _popupController.DeleteAnyway)); } return(new DeletedFileMetadata { IsDeleted = true, ResourceId = explorerItemViewModel.ResourceId, ShowDependencies = false }); }
public async Task <bool> ConnectAsync(Guid id) { ID = id; try { if (!IsLocalHost) { if (HubConnection.State == (ConnectionStateWrapped)ConnectionState.Reconnecting) { HubConnection.Stop(new TimeSpan(0, 0, 0, 1)); } } if (HubConnection.State == (ConnectionStateWrapped)ConnectionState.Disconnected) { ServicePointManager.ServerCertificateValidationCallback = ValidateServerCertificate; await HubConnection.Start(); if (HubConnection.State == ConnectionStateWrapped.Disconnected) { if (!IsLocalHost) { ConnectionRetry(); } } } if (HubConnection.State == (ConnectionStateWrapped)ConnectionState.Connecting) { ServicePointManager.ServerCertificateValidationCallback = ValidateServerCertificate; await HubConnection.Start(); if (HubConnection.State == ConnectionStateWrapped.Disconnected) { if (!IsLocalHost) { ConnectionRetry(); } } IPopupController popup = CustomContainer.Get <IPopupController>(); popup.Show(ErrorResource.ErrorConnectingToServer + Environment.NewLine + ErrorResource.EnsureConnectionToServerWorking , ErrorResource.UnableToContactServer, MessageBoxButton.OK, MessageBoxImage.Information, "", false, false, true, false, false, false); } } catch (AggregateException aex) { aex.Flatten(); aex.Handle(ex => { if (ex.Message.Contains("1.4")) { throw new FallbackException(); } Dev2Logger.Error(this, aex); var hex = ex as HttpClientException; if (hex != null) { switch (hex.Response.StatusCode) { case HttpStatusCode.Unauthorized: case HttpStatusCode.Forbidden: UpdateIsAuthorized(false); throw new UnauthorizedAccessException(); } } throw new NotConnectedException(); }); } catch (NotConnectedException) { throw; } catch (Exception e) { IPopupController popup = CustomContainer.Get <IPopupController>(); popup.Show(ErrorResource.ErrorConnectingToServer + Environment.NewLine + ErrorResource.EnsureConnectionToServerWorking , ErrorResource.UnableToContactServer, MessageBoxButton.OK, MessageBoxImage.Information, "", false, false, true, false, false, false); HandleConnectError(e); return(false); } return(true); }
public static void ShowExampleWorkflow(string activityName, IEnvironmentModel environment, IPopupController popupController) { var resourceID = GetExampleID(activityName); var resource = environment.ResourceRepository .FindSingle(r => r.ID.Equals(resourceID)); if(resource == null) { if(popupController == null) { var message = string.Format( StringResources.ExampleWorkflowNotFound, GetExampleName(activityName)); MessageBox.Show(message, "Information", MessageBoxButton.OK, MessageBoxImage.Information); } else { popupController.Buttons = MessageBoxButton.OK; popupController.Description = string.Format(StringResources.ExampleWorkflowNotFound, resourceID); popupController.Header = "Example Workflow Not Found"; popupController.ImageType = MessageBoxImage.Information; popupController.Show(); } } else { resource.ResourceType = ResourceType.WorkflowService; EditResource(resource, EventPublishers.Aggregator); } }
MessageBoxResult IsDirtyPopup() => _popupController.Show(string.Format(StringResources.ItemSource_NotSaved), $"Save {ViewModel.Header.Replace("*", "")}?", MessageBoxButton.YesNoCancel, MessageBoxImage.Information, "", false, false, true, false, false, false);