Exemplo n.º 1
0
        public bool SelectTypeSearchCombineFields()
        {
            RunForm.Click();
            driver.SwitchTo().Window(driver.WindowHandles.ToList().Last());
            var selectElementSaveSearch = new SelectElement(ComboboxSaveSearch);

            selectElementSaveSearch.SelectByValue("1038052");
            Thread.Sleep(0500);
            RandomChoiceField1();
            Thread.Sleep(0500);
            RandomTextField1();
            RandomChoiceField2();
            Thread.Sleep(0500);
            RandomTextField2();
            RandomChoiceField3();
            Thread.Sleep(0500);;
            RandomTextField3();
            var selectDestinationField = new SelectElement(iDestinationField);

            selectDestinationField.SelectByValue("EmailTo");
            BtnRun.Click();
            driver.Close();
            driver.SwitchTo().Window(driver.WindowHandles.ToList().First());

            return(true);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Run the optimisation
 /// this method switches to the OptimisationRunForm
 /// </summary>
 public void RunOptimisationClick()
 {
     RunForm.lblPercentage.Text = "Optimising trajectory";
     RunForm.lblTimeLeft.Text   = "estimating time left";
     RunForm.BringToFront();
     RunOptimisation(this, EventArgs.Empty);
 }
Exemplo n.º 3
0
        private void RunNoSave_Click(object sender, EventArgs e)
        {
            RunForm runform = new RunForm(Storage.sequenceData, RunForm.RunType.Run_Iteration_Zero, repeatCheckBox.Checked, false);

            runform.ShowDialog();
            runform.Dispose();
        }
Exemplo n.º 4
0
        private void runRandomList_Click(object sender, EventArgs e)
        {
            promptUserRegardingRepeats();
            RunForm runform = new RunForm(Storage.sequenceData, RunForm.RunType.Run_Random_Order_List, repeatCheckBox.Checked, true);

            runform.ShowDialog();
        }
        public bool SelectTypeSearch()
        {
            Thread.Sleep(0800);
            RunForm.Click();
            //cambia a la ultima ventana emergente abierta
            driver.SwitchTo().Window(driver.WindowHandles.ToList().Last());
            //Cambia a la primera ventana emergente
            //driver.SwitchTo().Window(driver.WindowHandles.ToList().First());
            //waitForPageUntilElementIsVisible(By.Id("searchId_dropDownList"), 10);
            var selectElementSaveSearch = new SelectElement(ComboboxSaveSearch);

            selectElementSaveSearch.SelectByValue("1038052");
            Thread.Sleep(0800);
            RandomField1();
            RandomField2();
            RandomField3();
            RandomField4();
            Delimiter.SendKeys("-");
            var selectElementFieldtoPopulate = new SelectElement(ComboboxFieldtoPopulate);

            selectElementFieldtoPopulate.SelectByValue("1042824");
            BtnRun.Click();
            driver.SwitchTo().Alert().Accept();
            driver.Close();
            driver.SwitchTo().Window(driver.WindowHandles.ToList().First());
            return(true);
        }
Exemplo n.º 6
0
        /// <summary>
        /// Initialize the Depth Camera
        /// </summary>
        /// <returns>An iterator</returns>
        private IEnumerator <ITask> ConnectDepthCamHandler()
        {
            Fault fault = null;

            yield return(Arbiter.Choice(
                             this.depthCamSensorPort.Subscribe(this.depthCamSensorNotify),
                             EmptyHandler,
                             f => fault = f));

            if (fault != null)
            {
                LogError(null, "Failed to subscribe to DepthCam", fault);
                yield break;
            }

            var runForm = new RunForm(this.CreateDepthCamForm);

            WinFormsServicePort.Post(runForm);

            yield return(Arbiter.Choice(runForm.pResult, EmptyHandler, e => fault = Fault.FromException(e)));

            if (fault != null)
            {
                LogError(null, "Failed to Create DepthCam window", fault);
                yield break;
            }

            yield break;
        }
Exemplo n.º 7
0
        private void backgroundRunUpdated(object o, EventArgs e)
        {
            if (!RunForm.backgroundIsRunning() && queuedNextSequence != null)
            {
                RunForm.beginBackgroundRunAsLoop(queuedNextSequence, RunForm.RunType.Run_Iteration_Zero, true, new EventHandler(backgroundRunUpdated));
                queuedNextSequence = null;
                backgroundRunUpdated(this, null);
                return;
            }

            if (this.InvokeRequired)
            {
                this.BeginInvoke(new EventHandler(backgroundRunUpdated), new object[] { this, null });
            }
            else
            {
                if (RunForm.backgroundIsRunning())
                {
                    bgRunButton.Text = "Queue as Loop in Background";
                }
                else
                {
                    bgRunButton.Text = "Run as Loop in Background (^F9)";
                }
            }
        }
Exemplo n.º 8
0
        IEnumerator <ITask> DoStart()
        {
            try
            {
                _utilities = DsspHttpUtilitiesService.Create(Environment);

                RunForm runForm = new RunForm(CreateForm);

                WinFormsServicePort.Post(runForm);
                yield return(Arbiter.Choice(
                                 runForm.pResult,
                                 EmptyHandler,
                                 EmptyHandler
                                 ));

                FormInvoke invoke = new FormInvoke(
                    delegate
                {
                    _form.Initialize(_state);
                }
                    );

                WinFormsServicePort.Post(invoke);
                yield return(Arbiter.Choice(
                                 invoke.ResultPort,
                                 EmptyHandler,
                                 EmptyHandler
                                 ));
            }
            finally
            {
                FinishStarting();
            }
        }
Exemplo n.º 9
0
        private void runCurrentButton_Click(object sender, EventArgs e)
        {
            RunForm runform = new RunForm(Storage.sequenceData, RunForm.RunType.Run_Current_Iteration, repeatCheckBox.Checked, true);

            runform.ShowDialog();
            runform.Dispose();
        }
Exemplo n.º 10
0
        private void continueListButton_Click(object sender, EventArgs e)
        {
            promptUserRegardingRepeats();
            RunForm runform = new RunForm(Storage.sequenceData, RunForm.RunType.Run_Continue_List, repeatCheckBox.Checked, true);

            runform.ShowDialog();
            runform.Dispose();
        }
Exemplo n.º 11
0
        public void PrepareVisualisationClick()
        {
            RunForm.Message          = "Preparing visualisation";
            RunForm.lblTimeLeft.Text = "";
            RunForm.CancelCallback   = CancelPreparation;
            RunForm.BringToFront();

            PrepareVisualisation(this, EventArgs.Empty);
        }
        private void RunNoSave_Click(object sender, EventArgs e)
        {
            RunForm runform = new RunForm(Storage.sequenceData, RunForm.RunType.Run_Iteration_Zero, repeatCheckBox.Checked, false);
            String  path    = Storage.SaveCiceroSettings(Storage.settingsData.SecondBackupFilePath, runform.FormCreationTime);

            if (UpdateBackupSavePath(path))
            {
                runform.ShowDialog();
            }
            runform.Dispose();
        }
Exemplo n.º 13
0
        protected void OptimisationForm_Load(object sender, EventArgs e)
        {
            base.MDIContainerForm_Load();

            SettingsForm.MdiParent = this;
            SettingsForm.Show();
            RunForm.MdiParent = this;
            RunForm.Show();
            CompletedForm.MdiParent = this;
            CompletedForm.Show();

            SettingsForm.BringToFront();
        }
Exemplo n.º 14
0
 private void PlayFile(string path)
 {
     if (File.Exists(path))
     {
         using (RunForm runForm = new RunForm())
         {
             runForm.Text    = Properties.strings.Play;
             runForm.Command = String.Concat("\"", Path.Combine(ffmpeg_path, Files.FFplay_Exe_Name), "\"");
             runForm.Args    = String.Concat(" -autoexit -i \"", path, "\"");
             runForm.ShowDialog();
         }
     }
 }
Exemplo n.º 15
0
        public virtual IEnumerator <ITask> ConfirmHandler(Confirm confirm)
        {
            PortSet <bool, Exception> result = new PortSet <bool, Exception>();
            ConfirmForm form = null;

            RunForm runForm = new RunForm(
                delegate()
            {
                form           = new ConfirmForm(result);
                form.Message   = confirm.Body.Message;
                form.Countdown = _defaultTimeout;

                return(form);
            }
                );

            WinFormsServicePort.Post(runForm);

            yield return(Arbiter.Choice(
                             runForm.pResult,
                             delegate(SuccessResult success) { },
                             delegate(Exception e)
            {
                result.Post(e);
            }
                             ));

            yield return(Arbiter.Choice(
                             result,
                             delegate(bool confirmed)
            {
                ConfirmResponse response = new ConfirmResponse();
                response.Confirmed = confirmed;

                confirm.ResponsePort.Post(response);

                if (form.Timeout)
                {
                    LogWarning("Confirm dialog cancelled due to timeout.");
                }
            },
                             delegate(Exception e)
            {
                Fault fault = Fault.FromException(e);
                LogError(null, "Error in Confirm Handler", fault);
                confirm.ResponsePort.Post(fault);
            }
                             ));
        }
Exemplo n.º 16
0
 private void FileInfo(string path)
 {
     if (File.Exists(path))
     {
         using (RunForm runForm = new RunForm())
         {
             runForm.Text    = Properties.strings.FileInformation;
             runForm.Pause   = true;
             runForm.Command = String.Concat("\"",
                                             Path.Combine(ffmpeg_path, Files.FFprobe_Exe_Name), "\"");
             runForm.Args = String.Concat(" -hide_banner -loglevel fatal -pretty -show_format -show_streams -show_entries stream=codec_type,r_frame_rate,width,height,sample_aspect_ratio:stream_disposition=:format_tags=timecode,company_name,product_name,product_version -i \"", path, "\"");
             runForm.ShowDialog();
         }
     }
 }
Exemplo n.º 17
0
        public void CalculateNoiseClick()
        {
            /*
             * //DEBUG
             * GoogleEarthForm.BringToFront();
             * GoogleEarthForm.Visualise("visualisation.kml");
             * return;
             */

            RunForm.Message        = "Calculating noise";
            RunForm.CancelCallback = CancelNoiseClick;
            RunForm.BringToFront();

            CalculateNoise(this, EventArgs.Empty);
        }
Exemplo n.º 18
0
 public override void OnInitialization()
 {
     tbl.Columns.Add("Col1", typeof(int));
     tbl.Columns.Add("Col2", typeof(double));
     tbl.Columns.Add("Col3", typeof(int));
     tbl.Columns.Add("Price", typeof(System.Decimal));
     DataColumn[] PrimaryKeyColumns = new DataColumn[1];
     PrimaryKeyColumns[0] = tbl.Columns["Price"];
     tbl.PrimaryKey = PrimaryKeyColumns;
     runForm = new RunForm();
     oThread = new Thread(new ThreadStart(runForm.startForm));
     oThread.Start();
     tThread = new Thread(new ThreadStart(startTimer));
     tThread.Start();
 }
        private void runCurrentButton_Click(object sender, EventArgs e)
        {
            if (MainClientForm.instance.sequencePage.AutoSetDwellWords)
            {
                SetDwellWordByChannelFinalValue();
            }

            RunForm runform = new RunForm(Storage.sequenceData, RunForm.RunType.Run_Current_Iteration, repeatCheckBox.Checked, true);
            String  path    = Storage.SaveCiceroSettings(Storage.settingsData.SecondBackupFilePath, runform.FormCreationTime);

            if (UpdateBackupSavePath(path))
            {
                runform.ShowDialog();
            }
            runform.Dispose();
        }
        private void runRandomList_Click(object sender, EventArgs e)
        {
            if (MainClientForm.instance.sequencePage.AutoSetDwellWords)
            {
                SetDwellWordByChannelFinalValue();
            }

            promptUserRegardingRepeats();
            String  path    = Storage.SaveCiceroSettings(Storage.settingsData.SecondBackupFilePath, DateTime.Now);
            RunForm runform = new RunForm(Storage.sequenceData, RunForm.RunType.Run_Random_Order_List, repeatCheckBox.Checked, true);

            if (UpdateBackupSavePath(path))
            {
                runform.ShowDialog();
            }
        }
Exemplo n.º 21
0
        public virtual IEnumerator <ITask> AlertHandler(Alert alert)
        {
            SuccessFailurePort result = new SuccessFailurePort();

            AlertForm form = null;

            RunForm runForm = new RunForm(
                delegate()
            {
                form           = new AlertForm(result);
                form.Message   = alert.Body.Message;
                form.Countdown = _defaultTimeout;

                return(form);
            }
                );

            WinFormsServicePort.Post(runForm);

            yield return(Arbiter.Choice(
                             runForm.pResult,
                             delegate(SuccessResult success){},
                             delegate(Exception e)
            {
                result.Post(e);
            }
                             ));

            yield return(Arbiter.Choice(
                             result,
                             delegate(SuccessResult success)
            {
                alert.ResponsePort.Post(DefaultSubmitResponseType.Instance);

                if (form.Timeout)
                {
                    LogWarning("Alert dialog timed out.");
                }
            },
                             delegate(Exception e)
            {
                Fault fault = Fault.FromException(e);
                LogError(null, "Error in Alert Handler", fault);
                alert.ResponsePort.Post(fault);
            }
                             ));
        }
Exemplo n.º 22
0
        private bool ConvertAudio(string sourceFile, string destFile, bool quoted = true)
        {
            bool result = false;

            if (!String.IsNullOrEmpty(destFile))
            {
                string dest_path = Path.GetDirectoryName(destFile);
                if (Directory.Exists(dest_path))
                {
                    StringBuilder command = new StringBuilder();
                    command.AppendFormat("-i {0} -y -v info",
                                         quoted ? String.Concat("\"", sourceFile, "\"") : sourceFile);

                    if (cbFormat.SelectedIndex == 1)
                    {
                        command.Append(" -acodec libvorbis");
                    }

                    command.Append(GetAudioFilters());

                    if (cbFormat.SelectedIndex == 0 || cbFormat.SelectedIndex == 1)
                    {
                        command.AppendFormat(" -ab {0} -ar {1}", cbQuality.Text, cbFreq.Text);
                    }

                    command.AppendFormat(" -threads 0 \"{0}\"", destFile);

                    using (RunForm runForm = new RunForm())
                    {
                        runForm.Command = String.Concat("\"", Path.Combine(ffmpeg_path, Files.FFmpeg_Exe_Name), "\"");
                        runForm.Args    = command.ToString();
                        runForm.ShowDialog();
                        result = !runForm.ErrorState;
                    }
                }
                else
                {
                    MessageBox.Show(String.Format(Properties.strings.FolderDoesNotExistParam, dest_path));
                }
            }
            return(result);
        }
Exemplo n.º 23
0
        private void bgRunButton_Click(object sender, EventArgs e)
        {
            if (!Storage.sequenceData.Lists.ListLocked)
            {
                MessageBox.Show("The current sequence does not have its lists locked, and thus cannot be run in the background. Please lock the lists (in the Variables tab).", "Lists not locked, unable to run in background.");
                return;
            }
            SequenceData sequenceCopy = (SequenceData)Common.createDeepCopyBySerialization(Storage.sequenceData);

            if (RunForm.backgroundIsRunning())
            {
                RunForm.bringBackgroundRunFormToFront();
                queuedNextSequence = sequenceCopy;
                RunForm.abortAtEndOfNextBackgroundRun();
            }
            else
            {
                RunForm.beginBackgroundRunAsLoop(sequenceCopy, RunForm.RunType.Run_Iteration_Zero, true, new EventHandler(backgroundRunUpdated));
            }
            backgroundRunUpdated(this, null);
        }
Exemplo n.º 24
0
        public IActionResult RunEntry(User user)
        {
            var User = this
                       .db
                       .Users
                       .Where(u => u.Username == user.Username)
                       .First();
            var games =
                new List <Game> {
                new Game {
                    name = "no selection"
                }
            }.Concat(
                this
                .db
                .Games
                .ToList()
                ).ToList();

            var difficulties =
                new List <Difficulty> {
                new Difficulty {
                    Name = "no selection"
                }
            }.Concat(
                this
                .db
                .Difficulty
                .Where(d => d.Id <= 4)
                .ToList()
                ).ToList();
            //string username = User.Username;
            var Form = new RunForm(user, games, difficulties);

            return(View(Form));
        }
Exemplo n.º 25
0
 private void runRandomList_Click(object sender, EventArgs e)
 {
     promptUserRegardingRepeats();
     RunForm runform = new RunForm(Storage.sequenceData, RunForm.RunType.Run_Random_Order_List, repeatCheckBox.Checked, true);
     runform.ShowDialog();
 }
Exemplo n.º 26
0
 private void RunNoSave_Click(object sender, EventArgs e)
 {
     RunForm runform = new RunForm(Storage.sequenceData, RunForm.RunType.Run_Iteration_Zero, repeatCheckBox.Checked, false);
     runform.ShowDialog();
     runform.Dispose();
 }
Exemplo n.º 27
0
 private void runListButton_Click(object sender, EventArgs e)
 {
     promptUserRegardingRepeats();
     RunForm runform = new RunForm(Storage.sequenceData, RunForm.RunType.Run_Full_List, repeatCheckBox.Checked, true);
     runform.ShowDialog();
     runform.Dispose();
 }
Exemplo n.º 28
0
 private void runCurrentButton_Click(object sender, EventArgs e)
 {
     RunForm runform = new RunForm(Storage.sequenceData,  RunForm.RunType.Run_Current_Iteration, repeatCheckBox.Checked, true);
     runform.ShowDialog();
     runform.Dispose();
 }
Exemplo n.º 29
0
        private bool ConvertVideo(string sourceFile, string destFile, bool quoted = true)
        {
            bool result = false;

            if (!String.IsNullOrEmpty(destFile))
            {
                string dest_path = Path.GetDirectoryName(destFile);
                if (Directory.Exists(dest_path))
                {
                    StringBuilder command = new StringBuilder();

                    if (cbFormat.SelectedIndex == 5)
                    {
                        // GIF
                        command.AppendFormat(
                            "-ss {0} -t {1} -i {2} -vf \"fps={3},scale={4}:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse\" -loop 0",
                            tbGIFStart.Text,
                            tbGIFDuration.Text,
                            quoted ? String.Concat("\"", sourceFile, "\"") : sourceFile,
                            tbGIFFPS.Text,
                            tbGIFWidth.Text
                            );
                        command.AppendFormat(" -stats -threads 0 \"{0}\"", destFile);
                    }
                    else
                    {
                        // input file and video codec
                        command.AppendFormat("-hwaccel auto -i {0} -y -v error -vcodec {1}",
                                             quoted ? String.Concat("\"", sourceFile, "\"") : sourceFile,
                                             videoCodec[cbVideoCodec.SelectedIndex]);

                        // TS format
                        if (cbFormat.SelectedIndex == 3)
                        {
                            command.Append(" -f mpegts ");
                            // copy
                            if (cbVideoCodec.SelectedIndex == 0)
                            {
                                command.Append(" -bsf:v h264_mp4toannexb");
                            }
                        }

                        // framerate
                        if (cbFramerate.SelectedIndex > 0)
                        {
                            command.Append(" -r ").Append(cbFramerate.Text);
                        }

                        // interlace
                        if (cbInterlaced.SelectedIndex > 0)
                        {
                            command.Append(interlaced[cbInterlaced.SelectedIndex - 1]);
                        }

                        // audio codec
                        switch (cbAudioCodec.SelectedIndex)
                        {
                        case 0:
                            command.Append(" -acodec copy");
                            break;

                        case 1:
                            command.AppendFormat(" -acodec libmp3lame -ab {0} -ar {1} -ac 2", cbQuality.Text, cbFreq.Text);
                            break;

                        case 2:
                            command.AppendFormat(" -acodec ac3 -ab {0} -ar {1}", cbQuality.Text, cbFreq.Text);
                            break;

                        case 3:
                            command.AppendFormat(" -acodec pcm_s16be -ar {0}", cbFreq.Text);
                            break;

                        default:
                            command.Append(" -an");
                            break;
                        }

                        // aspect
                        if (cbAspect.SelectedIndex > 0)
                        {
                            command.AppendFormat(" -aspect {0}", cbAspect.Text);
                        }

                        if (cbLines.SelectedIndex > 0 || cbHDR.SelectedIndex > 0)
                        {
                            string rows  = String.Empty;
                            string delim = String.Empty;

                            // scale
                            if (cbLines.SelectedIndex > 0)
                            {
                                rows = String.Format("scale=-1:{0}", cbLines.Text);
                            }

                            string hdr = String.Empty;
                            if (cbHDR.SelectedIndex == 1)
                            {
                                if (cbLines.SelectedIndex > 0)
                                {
                                    delim = ",";
                                }
                                hdr = "zscale=t=linear:npl=100,format=gbrpf32le,zscale=p=bt709,tonemap=tonemap=hable:desat=0,zscale=t=bt709:m=bt709:r=tv,format=yuv420p";
                            }

                            command.AppendFormat(" -vf {0}{1}{2}", rows, delim, hdr);
                        }

                        command.Append(GetAudioFilters());

                        // bitrate
                        if (cbBitrate.SelectedIndex > 0)
                        {
                            command.Append(bitRate[cbBitrate.SelectedIndex - 1]);
                        }

                        // select track
                        if (cbTrack.SelectedIndex > 0)
                        {
                            command.AppendFormat(" -map 0:v? -map 0:s? -map 0:a:{0}", (cbTrack.SelectedIndex - 1).ToString());
                        }
                        else
                        {
                            command.Append(" -map 0:v? -map 0:s? -map 0:a?");
                        }

                        // multithreads
                        command.AppendFormat(" -stats -scodec copy -threads 0 \"{0}\"", destFile);
                    }
                    // run ffmpeg
                    using (RunForm runForm = new RunForm())
                    {
                        runForm.Command = String.Concat("\"", Path.Combine(ffmpeg_path, Files.FFmpeg_Exe_Name), "\"");
                        runForm.Args    = command.ToString();
                        runForm.ShowDialog();
                        result = !runForm.ErrorState;
                    }
                }
                else
                {
                    MessageBox.Show(String.Format(Properties.strings.FolderDoesNotExistParam, dest_path));
                }
            }
            return(result);
        }
Exemplo n.º 30
0
        IEnumerator <ITask> InitializeCamera()
        {
            ServiceInfoType info  = null;
            Fault           fault = null;

            yield return(Arbiter.Choice(
                             _blobTrackerPort.DsspDefaultLookup(),
                             delegate(LookupResponse success)
            {
                info = success;
            },
                             delegate(Fault f)
            {
                fault = f;
            }
                             ));

            if (fault != null)
            {
                LogError(null, "Lookup failed on BlobTracker partner", fault);
                yield break;
            }

            PartnerType camera = FindPartner(
                new XmlQualifiedName("WebCam", bt.Contract.Identifier),
                info.PartnerList
                );

            if (camera == null ||
                string.IsNullOrEmpty(camera.Service))
            {
                LogError("No camera partner found for BlobTracker");
                yield break;
            }

            _webCamPort = ServiceForwarder <cam.WebCamOperations>(camera.Service);

            yield return(Arbiter.Choice(
                             _webCamPort.Subscribe(_webCamNotify, typeof(cam.UpdateFrame)),
                             delegate(SubscribeResponseType success) { },
                             delegate(Fault f)
            {
                fault = f;
            }
                             ));

            if (fault != null)
            {
                LogError(null, "Failed to subscribe to webcam", fault);
                yield break;
            }

            yield return(Arbiter.Choice(
                             _blobTrackerPort.Subscribe(_blobTrackerNotify),
                             delegate(SubscribeResponseType success) { },
                             delegate(Fault f)
            {
                fault = f;
            }
                             ));

            if (fault != null)
            {
                LogError(null, "Failed to subscribe to blob tracker", fault);
                yield break;
            }

            RunForm runForm = new RunForm(CreateVisualization);

            WinFormsServicePort.Post(runForm);

            yield return(Arbiter.Choice(
                             runForm.pResult,
                             delegate(SuccessResult success) { },
                             delegate(Exception e)
            {
                fault = Fault.FromException(e);
            }
                             ));

            if (fault != null)
            {
                LogError(null, "Failed to Create Visualization window", fault);
                yield break;
            }

            base.MainPortInterleave.CombineWith(
                Arbiter.Interleave(
                    new TeardownReceiverGroup(),
                    new ExclusiveReceiverGroup(
                        Arbiter.Receive <cam.UpdateFrame>(true, _webCamNotify, CameraUpdateFrameHandler),
                        Arbiter.Receive <bt.ImageProcessed>(true, _blobTrackerNotify, BlobTrackerImageProcessedHandler),
                        Arbiter.Receive <Shutdown>(true, _shutdownPort, ShutdownHandler)
                        ),
                    new ConcurrentReceiverGroup(
                        Arbiter.Receive <bt.DeleteBin>(true, _blobTrackerNotify, EmptyHandler),
                        Arbiter.Receive <bt.InsertBin>(true, _blobTrackerNotify, EmptyHandler),
                        Arbiter.Receive <bt.UpdateBin>(true, _blobTrackerNotify, EmptyHandler)
                        )
                    )
                );
        }
Exemplo n.º 31
0
        public virtual IEnumerator <ITask> PromptHandler(Prompt prompt)
        {
            PortSet <string, Exception> result = new PortSet <string, Exception>();
            PromptForm form = null;

            RunForm runForm = new RunForm(
                delegate()
            {
                form              = new PromptForm(result);
                form.Message      = prompt.Body.Message;
                form.DefaultValue = prompt.Body.DefaultValue;
                form.Countdown    = _defaultTimeout;

                return(form);
            }
                );

            WinFormsServicePort.Post(runForm);

            yield return(Arbiter.Choice(
                             runForm.pResult,
                             delegate(SuccessResult success) { },
                             delegate(Exception e)
            {
                result.Post(e);
            }
                             ));

            yield return(Arbiter.Choice(
                             result,
                             delegate(string value)
            {
                PromptResponse response = new PromptResponse();
                response.TextData = value;
                response.Confirmed = true;

                prompt.ResponsePort.Post(response);
            },
                             delegate(Exception e)
            {
                if (e.Message == "Cancelled")
                {
                    // If the Cancel button was pressed, return the default text
                    PromptResponse response = new PromptResponse();
                    response.TextData = prompt.Body.DefaultValue;
                    response.Confirmed = false;

                    prompt.ResponsePort.Post(response);

                    if (form.Timeout)
                    {
                        LogWarning("Prompt dialog cancelled due to timeout.");
                    }
                }
                else
                {
                    Fault fault = Fault.FromException(e);
                    LogError(null, "Error in Prompt Handler", fault);
                    prompt.ResponsePort.Post(fault);
                }
            }
                             ));
        }
Exemplo n.º 32
0
 public IActionResult RunPost(User User, [FromForm] RunForm rf, string firstName)
 {
     return(Content(firstName));
 }
Exemplo n.º 33
0
        // TT - New handler for connecting to WebCam
        IEnumerator<ITask> OnConnectWebCamHandler(OnConnectWebCam Opt)
        {
            //ServiceInfoType info = null;
            Fault fault = null;
            SubscribeResponseType s;
            String camera = Opt.Service;

            _webCamPort = ServiceForwarder<cam.WebCamOperations>(camera);

            //cam.Subscribe subscribe = new cam.Subscribe();
            //subscribe.NotificationPort = _webCamNotify;

            //_webCamPort.Post(subscribe);

            yield return Arbiter.Choice(
                _webCamPort.Subscribe(_webCamNotify),
//                subscribe.ResponsePort,
                delegate(SubscribeResponseType success)
                { s = success; },
                delegate(Fault f)
                {
                    fault = f;
                }
            );

            if (fault != null)
            {
                LogError(null, "Failed to subscribe to webcam", fault);
                yield break;
            }

            RunForm runForm = new RunForm(CreateWebCamForm);

            WinFormsServicePort.Post(runForm);

            yield return Arbiter.Choice(
                runForm.pResult,
                delegate(SuccessResult success) { },
                delegate(Exception e)
                {
                    fault = Fault.FromException(e);
                }
            );

            if (fault != null)
            {
                LogError(null, "Failed to Create WebCam window", fault);
                yield break;
            }
            // The following code falls over with a null pointer
            // exception inside MainPortInterleave.CombineWith.
            // Since I don't know why, I have added the message
            // to the interleave that is created at startup.
            // This is a bit tacky, but does not seem to do any harm.
            /*
            Interleave x = Arbiter.Interleave(
                    new TeardownReceiverGroup(),
                    new ExclusiveReceiverGroup(
                        Arbiter.ReceiveWithIterator<cam.UpdateFrame>(true, _webCamNotify, CameraUpdateFrameHandler)
                    ),
                    new ConcurrentReceiverGroup()
            );

            base.MainPortInterleave.CombineWith(x);
            */

            // There is a bug in the simulated webcam. It does not
            // automatically send UpdateFrame messages when you
            // subscribe. If this is a simulated camera, then set
            // up a timer to poke the webcam service and make it
            // send a frame.
            if (camera.ToLower().Contains("simul"))
            {
                Activate(
                    Arbiter.Receive(false, TimeoutPort(_state.Options.CameraInterval), CameraTimer)
                );
            }

            yield break;

        }
Exemplo n.º 34
0
        // Create and display the Windows Form containing the map
        bool MakeForm()
        {
            Fault fault = null;

            RunForm runForm = new RunForm(CreateMapForm);

            WinFormsServicePort.Post(runForm);

            Arbiter.Choice(
                runForm.pResult,
                delegate(SuccessResult success) { },
                delegate(Exception e)
                {
                    fault = Fault.FromException(e);
                }
            );

            if (fault != null)
            {
                LogError(null, "Failed to create Map window", fault);
                return false;
            }
            else
                return true;
        }