Beispiel #1
0
 void BackgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
 {
     try
     {
         if (Program.DebugMode || Program.IsWexflowWindowsServiceRunning())
         {
             try
             {
                 _wexflowServiceClient = new WexflowServiceClient(WexflowWebServiceUri);
                 _workflows            = _wexflowServiceClient.GetWorkflows();
             }
             catch (Exception ex)
             {
                 _exception = ex;
             }
         }
         else if (!Program.DebugMode && !Program.IsWexflowWindowsServiceRunning())
         {
             _exception = new Exception();
         }
         else
         {
             _workflows       = new WorkflowInfo[] { };
             textBoxInfo.Text = "";
         }
     }
     catch (Exception)
     {
         ShowError();
     }
 }
Beispiel #2
0
 public Login()
 {
     InitializeComponent();
     txtPassword.PasswordChar  = '*';
     lnkForgotPassword.Visible = File.Exists(ForgotPasswordPage);
     _wexflowServiceClient     = new WexflowServiceClient(WexflowWebServiceUri);
 }
Beispiel #3
0
        private void BackgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
        {
            try
            {
                if (Program.DebugMode || Program.IsWexflowWindowsServiceRunning())
                {
                    try
                    {
                        _wexflowServiceClient = new WexflowServiceClient(WexflowWebServiceUri);

                        var keyword = textBoxSearch.Text.ToUpper();
                        _workflows = _wexflowServiceClient.Search(keyword, Login.Username, Login.Password);
                    }
                    catch (Exception ex)
                    {
                        _exception = ex;
                    }
                }
                else if (!Program.DebugMode && !Program.IsWexflowWindowsServiceRunning())
                {
                    _exception = new Exception();
                }
                else
                {
                    _workflows       = new WorkflowInfo[] { };
                    textBoxInfo.Text = "";
                }
            }
            catch (Exception)
            {
                ShowError();
            }
        }
Beispiel #4
0
        public bool Delete(int id)
        {
            // Delete a workflow
            var client  = new WexflowServiceClient(_configs.WexflowWebServiceUri);
            var deleted = client.DeleteWorkflow(_configs.Username, _configs.Password, id);

            return(deleted);
        }
Beispiel #5
0
        public bool Update(int id, string payload)
        {
            // Update Code
            var client  = new WexflowServiceClient(_configs.WexflowWebServiceUri);
            var updated = client.UpdateWorkflow(_configs.Username, _configs.Password, payload);

            return(updated);
        }
Beispiel #6
0
        /// <summary>
        /// Get a workflow by ID
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public WorkflowInfo Get(int id)
        {
            var client = new WexflowServiceClient(_configs.WexflowWebServiceUri);

            var workflows = client.Search(string.Empty, _configs.Username, _configs.Password);

            return(workflows.FirstOrDefault(p => p.Id == id));
        }
Beispiel #7
0
 void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
 {
     if (Program.DebugMode || Program.IsWexflowWindowsServiceRunning())
     {
         _wexflowServiceClient = new WexflowServiceClient(WexflowWebServiceUri);
         _workflows            = _wexflowServiceClient.GetWorkflows();
     }
     else
     {
         _workflows       = new WorkflowInfo[] { };
         textBoxInfo.Text = "";
     }
 }
Beispiel #8
0
 private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
 {
     if (Program.DEBUG_MODE || Program.IsWexflowWindowsServiceRunning())
     {
         this._wexflowServiceClient = new WexflowServiceClient();
         this._workflows            = _wexflowServiceClient.GetWorkflows();
     }
     else
     {
         this._workflows       = new WorkflowInfo[] { };
         this.textBoxInfo.Text = "";
     }
 }
Beispiel #9
0
        /// <summary>
        /// Create Workflow in WexFlow
        /// </summary>
        /// <param name="payload"></param>
        /// <returns></returns>
        public int Create(string payload)
        {
            var client = new WexflowServiceClient(_configs.WexflowWebServiceUri);

            var created = client.CreateWorkflow(_configs.Username, _configs.Password, payload);

            // return workflowId
            if (created)
            {
                var o  = JObject.Parse(payload);
                var wi = o.Value <JObject>("WorkflowInfo");
                var id = wi.Value <int>("Id");
                return(id);
            }

            return(-1);
        }
Beispiel #10
0
        WorkflowInfo GetWorkflow(int id)
        {
            if (Program.DebugMode || Program.IsWexflowWindowsServiceRunning())
            {
                if (_windowsServiceWasStopped)
                {
                    _wexflowServiceClient     = new WexflowServiceClient(WexflowWebServiceUri);
                    _windowsServiceWasStopped = false;
                    backgroundWorker1.RunWorkerAsync();
                }
                return(_wexflowServiceClient.GetWorkflow(id));
            }

            _windowsServiceWasStopped = true;
            HandleNonRunningWindowsService();

            return(null);
        }
Beispiel #11
0
        private WorkflowInfo GetWorkflow(int id)
        {
            if (Program.DEBUG_MODE || Program.IsWexflowWindowsServiceRunning())
            {
                if (this._windowsServiceWasStopped)
                {
                    this._wexflowServiceClient = new WexflowServiceClient();
                    this.backgroundWorker1.RunWorkerAsync();
                    this._windowsServiceWasStopped = false;
                }
                return(this._wexflowServiceClient.GetWorkflow(id));
            }
            else
            {
                this._windowsServiceWasStopped = true;
                HandleNonRunningWindowsService();
            }

            return(null);
        }
Beispiel #12
0
        static void Main(string[] args)
        {
            try
            {
                IConfiguration config = new ConfigurationBuilder()
                                        .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
                                        .Build();

                var wexflowServiceUri = config["WexflowWebServiceUri"];
                var username          = config["Username"];
                var password          = config["Password"];

                var client = new WexflowServiceClient(wexflowServiceUri);

                // Test create
                var res = client.CreateWorkflow(username, password, createPayload);
                Console.WriteLine("Create result: {0}", res);

                // Test update
                res = client.UpdateWorkflow(username, password, updatedPayload);
                Console.WriteLine("Update result: {0}", res);

                // Test read
                var xml = client.ReadWorkflow(username, password, 999);
                Console.WriteLine("Read result: {0}", xml);

                // Test delete
                res = client.DeleteWorkflow(username, password, 999);
                Console.WriteLine("Delete result: {0}", res);
            }
            catch (Exception e)
            {
                Console.WriteLine("Error: {0}", e);
            }
            Console.WriteLine("Press any key to exit...");
            Console.ReadKey();
        }
Beispiel #13
0
        public override TaskStatus Run()
        {
            Info("Task started.");
            bool success           = true;
            bool atLeastOneSucceed = false;

            foreach (var id in WorkflowIds)
            {
                WexflowServiceClient client = new WexflowServiceClient(WexflowWebServiceUri);
                WorkflowInfo         wfInfo = client.GetWorkflow(id);
                switch (Action)
                {
                case WorkflowAction.Start:
                    if (wfInfo.IsRunning)
                    {
                        success = false;
                        ErrorFormat("Can't start the workflow {0} because it's already running.", Workflow.Id);
                    }
                    else
                    {
                        client.StartWorkflow(id, Username, Password);
                        InfoFormat("Workflow {0} started.", id);
                        if (!atLeastOneSucceed)
                        {
                            atLeastOneSucceed = true;
                        }
                    }
                    break;

                case WorkflowAction.Suspend:
                    if (wfInfo.IsRunning)
                    {
                        client.SuspendWorkflow(id, Username, Password);
                        InfoFormat("Workflow {0} suspended.", id);
                        if (!atLeastOneSucceed)
                        {
                            atLeastOneSucceed = true;
                        }
                    }
                    else
                    {
                        success = false;
                        ErrorFormat("Can't suspend the workflow {0} because it's not running.", Workflow.Id);
                    }
                    break;

                case WorkflowAction.Resume:
                    if (wfInfo.IsPaused)
                    {
                        client.ResumeWorkflow(id, Username, Password);
                        InfoFormat("Workflow {0} resumed.", id);
                        if (!atLeastOneSucceed)
                        {
                            atLeastOneSucceed = true;
                        }
                    }
                    else
                    {
                        success = false;
                        ErrorFormat("Can't resume the workflow {0} because it's not suspended.", Workflow.Id);
                    }
                    break;

                case WorkflowAction.Stop:
                    if (wfInfo.IsRunning)
                    {
                        client.StopWorkflow(id, Username, Password);
                        InfoFormat("Workflow {0} stopped.", id);
                        if (!atLeastOneSucceed)
                        {
                            atLeastOneSucceed = true;
                        }
                    }
                    else
                    {
                        success = false;
                        ErrorFormat("Can't stop the workflow {0} because it's not running.", Workflow.Id);
                    }
                    break;

                case WorkflowAction.Approve:
                    if (wfInfo.IsApproval && wfInfo.IsWaitingForApproval)
                    {
                        client.ApproveWorkflow(id, Username, Password);
                        InfoFormat("Workflow {0} approved.", id);
                        if (!atLeastOneSucceed)
                        {
                            atLeastOneSucceed = true;
                        }
                    }
                    else
                    {
                        success = false;
                        ErrorFormat("Can't approve the workflow {0} because it's not waiting for approval.", Workflow.Id);
                    }
                    break;

                case WorkflowAction.Disapprove:
                    if (wfInfo.IsApproval && wfInfo.IsWaitingForApproval)
                    {
                        client.DisapproveWorkflow(id, Username, Password);
                        InfoFormat("Workflow {0} disapproved.", id);
                        if (!atLeastOneSucceed)
                        {
                            atLeastOneSucceed = true;
                        }
                    }
                    else
                    {
                        success = false;
                        ErrorFormat("Can't disapprove the workflow {0} because it's not waiting for approval.", Workflow.Id);
                    }
                    break;
                }
            }
            Info("Task finished.");
            var status = Core.Status.Success;

            if (!success && atLeastOneSucceed)
            {
                status = Core.Status.Warning;
            }
            else if (!success)
            {
                status = Core.Status.Error;
            }

            return(new TaskStatus(status));
        }
Beispiel #14
0
        public override TaskStatus Run()
        {
            Info("Task started.");
            bool success           = true;
            bool atLeastOneSucceed = false;

            foreach (var id in WorkflowIds)
            {
                try
                {
                    WexflowServiceClient client = new WexflowServiceClient(WexflowWebServiceUri);
                    WorkflowInfo         wfInfo = client.GetWorkflow(Username, Password, id);
                    switch (Action)
                    {
                    case WorkflowAction.Start:
                        if (wfInfo.IsRunning)
                        {
                            success = false;
                            ErrorFormat("Can't start the workflow {0} because it's already running.", id);
                        }
                        else
                        {
                            var instanceId = client.StartWorkflow(id, Username, Password);
                            if (Jobs.ContainsKey(id))
                            {
                                Jobs[id] = instanceId;
                            }
                            else
                            {
                                Jobs.Add(id, instanceId);
                            }
                            InfoFormat("Workflow {0} started.", id);
                            if (!atLeastOneSucceed)
                            {
                                atLeastOneSucceed = true;
                            }
                        }
                        break;

                    case WorkflowAction.Suspend:
                        if (wfInfo.IsRunning)
                        {
                            var jobId = Workflow.WexflowEngine.GetWorkflow(id).Jobs.Select(j => j.Key).FirstOrDefault();
                            if (jobId != null)
                            {
                                client.SuspendWorkflow(id, jobId, Username, Password);
                                InfoFormat("Workflow {0} suspended.", id);
                                if (!atLeastOneSucceed)
                                {
                                    atLeastOneSucceed = true;
                                }
                            }
                            else
                            {
                                success = false;
                                ErrorFormat("Can't suspend the workflow {0} because it's not running.", id);
                            }
                        }
                        else
                        {
                            success = false;
                            ErrorFormat("Can't suspend the workflow {0} because it's not running.", id);
                        }
                        break;

                    case WorkflowAction.Resume:
                        if (wfInfo.IsPaused)
                        {
                            var jobId = Workflow.WexflowEngine.GetWorkflow(id).Jobs.Select(j => j.Key).FirstOrDefault();
                            if (jobId != null)
                            {
                                client.ResumeWorkflow(id, jobId, Username, Password);
                                InfoFormat("Workflow {0} resumed.", id);
                                if (!atLeastOneSucceed)
                                {
                                    atLeastOneSucceed = true;
                                }
                            }
                            else
                            {
                                success = false;
                                ErrorFormat("Can't resume the workflow {0} because it's not suspended.", id);
                            }
                        }
                        else
                        {
                            success = false;
                            ErrorFormat("Can't resume the workflow {0} because it's not suspended.", id);
                        }
                        break;

                    case WorkflowAction.Stop:
                        if (wfInfo.IsRunning)
                        {
                            var jobId = Workflow.WexflowEngine.GetWorkflow(id).Jobs.Select(j => j.Key).FirstOrDefault();
                            if (jobId != null)
                            {
                                client.StopWorkflow(id, jobId, Username, Password);
                                InfoFormat("Workflow {0} stopped.", id);
                                if (!atLeastOneSucceed)
                                {
                                    atLeastOneSucceed = true;
                                }
                            }
                            else
                            {
                                success = false;
                                ErrorFormat("Can't stop the workflow {0} because it's not running.", id);
                            }
                        }
                        else
                        {
                            success = false;
                            ErrorFormat("Can't stop the workflow {0} because it's not running.", id);
                        }
                        break;

                    case WorkflowAction.Approve:
                        if (wfInfo.IsApproval && wfInfo.IsWaitingForApproval)
                        {
                            var jobId = Workflow.WexflowEngine.GetWorkflow(id).Jobs.Select(j => j.Key).FirstOrDefault();
                            if (jobId != null)
                            {
                                client.ApproveWorkflow(id, jobId, Username, Password);
                                InfoFormat("Workflow {0} approved.", id);
                                if (!atLeastOneSucceed)
                                {
                                    atLeastOneSucceed = true;
                                }
                            }
                            else
                            {
                                success = false;
                                ErrorFormat("Can't approve the workflow {0} because it's not waiting for approval.", id);
                            }
                        }
                        else
                        {
                            success = false;
                            ErrorFormat("Can't approve the workflow {0} because it's not waiting for approval.", id);
                        }
                        break;

                    case WorkflowAction.Reject:
                        if (wfInfo.IsApproval && wfInfo.IsWaitingForApproval)
                        {
                            var jobId = Workflow.WexflowEngine.GetWorkflow(id).Jobs.Select(j => j.Key).FirstOrDefault();
                            if (jobId != null)
                            {
                                client.RejectWorkflow(id, jobId, Username, Password);
                                InfoFormat("Workflow {0} rejected.", id);
                                if (!atLeastOneSucceed)
                                {
                                    atLeastOneSucceed = true;
                                }
                            }
                            else
                            {
                                success = false;
                                ErrorFormat("Can't reject the workflow {0} because it's not waiting for approval.", id);
                            }
                        }
                        else
                        {
                            success = false;
                            ErrorFormat("Can't reject the workflow {0} because it's not waiting for approval.", id);
                        }
                        break;
                    }
                }
                catch (Exception e)
                {
                    success = false;
                    ErrorFormat("An error occured while processing the workflow {0}", e, id);
                }
            }
            Info("Task finished.");
            var status = Core.Status.Success;

            if (!success && atLeastOneSucceed)
            {
                status = Core.Status.Warning;
            }
            else if (!success)
            {
                status = Core.Status.Error;
            }

            return(new TaskStatus(status));
        }
Beispiel #15
0
        public static void Main(string[] args)
        {
            try
            {
                Config = new ConfigurationBuilder()
                         .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
                         .Build();

                int port = int.Parse(Config["WexflowServicePort"]);

                XmlDocument log4NetConfig = new XmlDocument();
                log4NetConfig.Load(File.OpenRead("log4net.config"));
                var repo = LogManager.CreateRepository(Assembly.GetEntryAssembly(), typeof(log4net.Repository.Hierarchy.Hierarchy));
                XmlConfigurator.Configure(repo, log4NetConfig["log4net"]);

                string wexflowSettingsFile = Config["WexflowSettingsFile"];
                WexflowEngine = new WexflowEngine(wexflowSettingsFile
                                                  , Config["WorkiomAuthUrl"]
                                                  , Config["CreateRecordUrl"]
                                                  , Config["UpdateRecordUrl"]
                                                  , Config["NotifyUserUrl"]);

                WexflowEngine.Run();

                var uri       = Config["CloudAmpqUrl"];
                var queueName = Config["QueueName"];
                var factory   = new ConnectionFactory()
                {
                    Uri = new Uri(uri)
                };
                //var factory = new ConnectionFactory() { HostName = "localhost" };
                //var wexflowWebServiceUri = string.Format("http://localhost:{0}/wexflow/", port);
                var wexflowWebServiceUri = Config["WexflowWebServiceUri"];
                var client   = new WexflowServiceClient(wexflowWebServiceUri);
                var username = Config["Username"];
                var password = Config["Password"];
                using (var connection = factory.CreateConnection())
                    using (var channel = connection.CreateModel())
                    {
                        channel.QueueDeclare(queue: queueName,
                                             durable: true,
                                             exclusive: false,
                                             autoDelete: false,
                                             arguments: null);

                        var consumer = new EventingBasicConsumer(channel);
                        consumer.Received += (model, ea) =>
                        {
                            try
                            {
                                var body    = ea.Body;
                                var message = Encoding.UTF8.GetString(body);
                                Logger.InfoFormat("Received: {0}", message);

                                var o          = JObject.Parse(message);
                                var workflowId = o.Value <int>("workflowId");
                                var payload    = o.Value <JObject>("payload");

                                var parameters =
                                    "[" +
                                    "{\"ParamName\":\"Payload\",\"ParamValue\":" + (payload == null ? "\"\"" : payload.ToString()) + "}" +
                                    "]";

                                var started = client.StartWorkflow(workflowId, username, password, parameters);

                                if (started)
                                {
                                    Logger.InfoFormat("Workflow {0} started.", workflowId);
                                }
                                else
                                {
                                    Logger.ErrorFormat("Workflow {0} not started. Error: Unauthorized.", workflowId);
                                }
                            }
                            catch (Exception e)
                            {
                                Logger.Error("An error occured while consuming queue message.", e);
                            }
                        };
                        channel.BasicConsume(queue: queueName,
                                             autoAck: true,
                                             consumer: consumer);

                        var host = new WebHostBuilder()
                                   .UseContentRoot(Directory.GetCurrentDirectory())
                                   .UseKestrel((context, options) =>
                        {
                            options.ListenAnyIP(port);
                        })
                                   .UseStartup <Startup>()
                                   .Build();

                        host.Run();
                    }
            }
            catch (Exception e)
            {
                Logger.Error("An error occured while starting Wexflow server.", e);
            }

            Console.WriteLine();
            Console.Write("Press any key to stop Wexflow server...");
            Console.ReadKey();
        }
Beispiel #16
0
        public Form1()
        {
            ClientSize = new Size(792, 566);
            Title      = "Wexflow";

            _startButton = new Button(StartClick)
            {
                Text = "Start", Width = 75, Enabled = false
            };
            _suspendButton = new Button(SuspendClick)
            {
                Text = "Suspend", Width = 75, Enabled = false
            };
            _resumeButton = new Button(ResumeClick)
            {
                Text = "Resume", Width = 75, Enabled = false
            };
            _stopButton = new Button(StopClick)
            {
                Text = "Stop", Width = 75, Enabled = false
            };

            _buttonsLayout = new DynamicLayout {
                Padding = new Padding(10)
            };
            _buttonsLayout.BeginVertical();
            _buttonsLayout.BeginHorizontal();
            _buttonsLayout.Add(_startButton);
            _buttonsLayout.Add(_suspendButton);
            _buttonsLayout.Add(_resumeButton);
            _buttonsLayout.Add(_stopButton);
            _buttonsLayout.EndHorizontal();
            _buttonsLayout.EndVertical();

            _buttonsPixelLayout = new PixelLayout();
            _buttonsPixelLayout.Add(_buttonsLayout, 0, 0);

            var layout = new DynamicLayout();

            layout.BeginVertical();
            layout.BeginHorizontal();
            layout.Add(_buttonsPixelLayout);
            layout.EndHorizontal();
            layout.BeginHorizontal();

            _txtInfo = new TextBox {
                ReadOnly = true
            };
            var txtInfoLayout = new DynamicLayout {
                Padding = new Padding(10, 0, 10, 10)
            };

            txtInfoLayout.BeginVertical();
            txtInfoLayout.BeginHorizontal();
            txtInfoLayout.Add(_txtInfo);
            txtInfoLayout.EndHorizontal();
            txtInfoLayout.EndVertical();

            layout.Add(txtInfoLayout);
            layout.EndHorizontal();
            layout.BeginHorizontal();

            _gvWorkflows = new GridView();
            _gvWorkflows.SelectionChanged += GvSelectionChanged;
            _gvWorkflows.CellDoubleClick  += GvCellDoubleClick;

            var gvWorkflowsLayout = new DynamicLayout {
                Padding = new Padding(10, 0, 10, 10)
            };

            gvWorkflowsLayout.BeginVertical();
            gvWorkflowsLayout.BeginHorizontal();
            gvWorkflowsLayout.Add(_gvWorkflows);
            gvWorkflowsLayout.EndHorizontal();
            gvWorkflowsLayout.EndVertical();

            layout.Add(gvWorkflowsLayout);
            layout.EndVertical();

            Content = layout;

            _wexflowServiceClient = new WexflowServiceClient(WexflowWebServiceUri);
            BindGridView();
        }
Beispiel #17
0
        static void Main(string[] args)
        {
            try
            {
                IConfiguration config = new ConfigurationBuilder()
                                        .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
                                        .Build();

                var parser = new Parser(cfg => cfg.CaseInsensitiveEnumValues = true);
                var res    = parser.ParseArguments <Options>(args)
                             .WithParsed(o =>
                {
                    var client   = new WexflowServiceClient(config["WexflowWebServiceUri"]);
                    var username = config["Username"];
                    var password = config["Password"];

                    var workflows = client.Search(string.Empty, username, password);
                    if (!workflows.Any(w => w.Id == o.WorkflowId))
                    {
                        Console.WriteLine("Workflow id {0} is incorrect.", o.WorkflowId);
                        return;
                    }

                    WorkflowInfo workflow;
                    switch (o.Operation)
                    {
                    case Operation.Start:
                        var instanceId = client.StartWorkflow(o.WorkflowId, username, password);
                        Console.WriteLine("JobId: {0}", instanceId);

                        if (o.Wait)
                        {
                            Thread.Sleep(1000);
                            workflow      = client.GetWorkflow(username, password, o.WorkflowId);
                            var isRunning = workflow.IsRunning;
                            while (isRunning)
                            {
                                Thread.Sleep(100);
                                workflow  = client.GetWorkflow(username, password, o.WorkflowId);
                                isRunning = workflow.IsRunning;
                            }
                        }
                        break;

                    case Operation.Suspend:
                        workflow = client.GetWorkflow(username, password, o.WorkflowId);
                        if (!workflow.IsRunning)
                        {
                            Console.WriteLine("Workflow {0} is not running to be suspended.", o.WorkflowId);
                            return;
                        }
                        client.SuspendWorkflow(o.WorkflowId, Guid.Parse(o.JobId), username, password);
                        break;

                    case Operation.Stop:
                        workflow = client.GetWorkflow(username, password, o.WorkflowId);
                        if (!workflow.IsRunning)
                        {
                            Console.WriteLine("Workflow {0} is not running to be stopped.", o.WorkflowId);
                            return;
                        }
                        client.StopWorkflow(o.WorkflowId, Guid.Parse(o.JobId), username, password);
                        break;

                    case Operation.Resume:
                        workflow = client.GetWorkflow(username, password, o.WorkflowId);
                        if (!workflow.IsPaused)
                        {
                            Console.WriteLine("Workflow {0} is not suspended to be resumed.", o.WorkflowId);
                            return;
                        }
                        client.ResumeWorkflow(o.WorkflowId, Guid.Parse(o.JobId), username, password);
                        break;

                    case Operation.Approve:
                        workflow = client.GetWorkflow(username, password, o.WorkflowId);
                        if (!workflow.IsWaitingForApproval)
                        {
                            Console.WriteLine("Workflow {0} is not waiting for approval to be approved.", o.WorkflowId);
                            return;
                        }
                        client.ApproveWorkflow(o.WorkflowId, Guid.Parse(o.JobId), username, password);
                        break;

                    case Operation.Reject:
                        workflow = client.GetWorkflow(username, password, o.WorkflowId);
                        if (!workflow.IsWaitingForApproval)
                        {
                            Console.WriteLine("Workflow {0} is not waiting for approval to be rejected.", o.WorkflowId);
                            return;
                        }
                        client.RejectWorkflow(o.WorkflowId, Guid.Parse(o.JobId), username, password);
                        break;
                    }
                });

                res.WithNotParsed(errs =>
                {
                    var helpText = HelpText.AutoBuild(res, h => h, e =>
                    {
                        return(e);
                    });
                    Console.WriteLine(helpText);
                });
            }
            catch (Exception e)
            {
                Console.WriteLine("An error occured: {0}", e);
            }
        }
Beispiel #18
0
 public Login()
 {
     InitializeComponent();
     txtPassword.PasswordChar = '*';
     _wexflowServiceClient    = new WexflowServiceClient(WexflowWebServiceUri);
 }