예제 #1
0
파일: WuAgent.cs 프로젝트: OldMaCKY/wumgr
        protected void OnFinished(RetCodes ret, bool needReboot = false)
        {
            FinishedArgs args = new FinishedArgs(mCurOperation, ret, needReboot);

            mCurOperation = AgentOperation.None;

            Finished?.Invoke(this, args);
        }
    public static void InvokeOnFinished(FinishedArgs args)
    {
        Finished handler = OnFinished;

        if (handler != null)
        {
            handler(null, args);
        }
    }
예제 #3
0
        private void OnFinished(IntPtr converter, int success)
        {
            var eventArgs = new FinishedArgs
            {
                Document = _processingDocument,
                Success  = success == 1
            };

            Finished?.Invoke(this, eventArgs);
        }
예제 #4
0
 private void Progressable_Finished(object sender, FinishedArgs e)
 {
     if (Visible)
     {
         Invoke((MethodInvoker) delegate {
             if (!e.Successful)
             {
                 Console.WriteLine("FAILED: {0}", sender.GetType());
             }
             Close();
         });
     }
 }
        public void EventFinished(object sender, FinishedArgs finished)
        {
            var appConfig = AppConfigManager.Load();

            appConfig.LastFileGenerated = finished.FileName;
            AppConfigManager.Save(appConfig);

            switch (_processAction)
            {
            case EndProcessAction.None:
                break;

            case EndProcessAction.OpenFile:
                Process.Start(finished.FileName);
                break;

            case EndProcessAction.OpenDir:
                Process.Start(Path.GetDirectoryName(finished.FileName));
                break;

            case EndProcessAction.AskIfShouldOpenFile:
                if (MessageBox.Show(
                        this,
                        "Deseja abrir o arquivo gerado?",
                        "Ação ao fim do processamento",
                        MessageBoxButtons.YesNo,
                        MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    Process.Start(finished.FileName);
                }
                break;

            case EndProcessAction.AskIfShouldOpenDir:
                if (MessageBox.Show(
                        this,
                        "Deseja abrir o diretório onde o arquivo foi gerado?",
                        "Ação ao fim do processamento",
                        MessageBoxButtons.YesNo,
                        MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    Process.Start(Path.GetDirectoryName(finished.FileName));
                }
                break;

            default:
                MessageBox.Show("A ação configurada sobre o arquivo gerado é inválida!\nVerifique as configrurações.");
                break;
            }
        }
예제 #6
0
    // Update is called once per frame
    void Update()
    {
        _device.Update();
        _deltaMove = _prevPos - _device.pos1;
        _prevPos   = _device.pos1;

        UpdateCollisionTypes();

        if (_target != null && !IsEnabled(_target as Behaviour))
        {
            _activeState.InvokeInterrupt();
            Reset();
        }

        if (_device.state1 == Device.DeviceState.Down)
        {
            _activeState.InvokeDown();
        }
        if (_device.state1 == Device.DeviceState.Hold)
        {
            if (moved())
            {
                _activeState.InvokeMoved();
            }
            else
            {
                _activeState.Update();
            }
        }
        if (_device.state1 == Device.DeviceState.Up)
        {
            IGesture gesture = _target;
            _activeState.InvokeUp();

            if (gesture != null)
            {
                IFinished finished = gesture as IFinished;
                if (finished != null)
                {
                    FinishedArgs args = new FinishedArgs(_prevType, false, _startPos, _device.pos1);
                    finished.OnGestureFinished(args);
                }
            }
        }
    }
예제 #7
0
 private static void Converter_Finished(object sender, FinishedArgs e)
 {
     Console.WriteLine("Conversion {0} ", e.Success ? "successful" : "unsuccessful");
 }
예제 #8
0
        /// <summary>
        /// Take raw parameters and a runworkercompletedeventhandler to deal with the result.
        ///
        /// </summary>
        /// <param name="parameters">The parameters to run ffmpeg with</param>
        /// <param name="e">This holds the output to ffmpeg when it is done.</param>
        private void runRaw(string parameters, RunWorkerCompletedEventHandler e = null)
        {
            //Console.WriteLine(parameters + "\n\n\n");
            ProcessStartInfo oInfo = new ProcessStartInfo(this._ffTarget, parameters);

            //Don't show the shell
            oInfo.UseShellExecute = false;
            oInfo.CreateNoWindow  = true;
            //Change the output
            oInfo.RedirectStandardError = true;
            oInfo.RedirectStandardInput = true;
            if (process != null)
            {
                return;
            }
            string       output   = null;
            StreamReader srOutput = null;

            try
            {
                BackgroundWorker bw = new BackgroundWorker();
                bw.DoWork += new DoWorkEventHandler(
                    delegate(object o, DoWorkEventArgs args)
                {
                    //Start ffmpeg
                    process = System.Diagnostics.Process.Start(oInfo);
                    process.EnableRaisingEvents = true;
                    //When ffmpeg is finished we want to fire the event to let the user know we are done.
                    process.Exited += (obj, a) =>
                    {
                        EventHandler <FinishedArgs> handler = FinishedRecording;
                        if (handler != null)
                        {
                            FinishedArgs finishedArgs = null;
                            if (FileName != null)
                            {
                                finishedArgs = new FinishedArgs(FileName);
                            }
                            handler(this, finishedArgs);
                        }
                    };
                    //Getting the output
                    srOutput    = process.StandardError;
                    output      = srOutput.ReadToEnd();
                    args.Result = output;
                });
                bw.RunWorkerCompleted += e;
                bw.RunWorkerCompleted += (o, args) =>
                {
                    this.stopRecording();
                };
                bw.RunWorkerAsync();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                output = string.Empty;
            }
            finally
            {
                if (srOutput != null)
                {
                    srOutput.Close();
                    srOutput.Dispose();
                }
            }
        }
예제 #9
0
 public static void InvokeOnFinished(FinishedArgs args)
 {
     OnFinished?.Invoke(null, args);
 }
 public void OnFinished(FinishedArgs args)
 {
     // Reserved method; for internal use. Do nothing.
 }