Exemple #1
0
        public void Print(string content)
        {
            Delegate[] delegates = Log?.GetInvocationList();

            // delegates[1] = null;

            // LogConsole($"Printing... {content}");
            // LogFile($"Printing... {content}");

            //if (Log!=null)
            //    Log($"Printing... {content}");

            Log?.Invoke($"Printing... {content}");

            // ..

            // LogConsole($"Printed.");
            Log?.Invoke($"Printed.");

            Finish?.Invoke(10);

            decimal?cost = CalculateCost?.Invoke(10);

            if (cost.HasValue)
            {
                Display(cost.Value);
            }

            Completed?.Invoke();

            Error?.Invoke(this, EventArgs.Empty);
        }
        public override void Update(double deltaTime)
        {
            base.Update(deltaTime);

            if (!Enable)
            {
                return;
            }

            if (mode == FadeIn)
            {
                parent.Alpha += OpPerSec * deltaTime;
                if (parent.Alpha >= 1)
                {
                    Finish?.Invoke(this, EventArgs.Empty);
                }
            }
            else if (mode == FadeOut)
            {
                parent.Alpha -= OpPerSec * deltaTime;
                if (parent.Alpha <= 0)
                {
                    Finish?.Invoke(this, EventArgs.Empty);
                }
            }
        }
Exemple #3
0
 private int ToCheck(string name, Filter filter)
 {
     if (filter(name))
     {
         FilesFinded?.Invoke(this, new EventArgs());
         if (toExclude)
         {
             toExclude = false;
             return(0);
         }
         else
         {
             return(1);
         }
     }
     else
     {
         FilteredFilesFinded?.Invoke(this, new EventArgs());
         if (toStop)
         {
             toStop = false;
             Finish?.Invoke(this, new EventArgs());
             return(-1);
         }
         else
         {
             return(0);
         }
     }
 }
Exemple #4
0
 private void OnCollisionEnter(Collision collision)
 {
     if (_canJump == false)
     {
         return;
     }
     if (collision.gameObject.TryGetComponent(out PlatformSegmentDead platformSegmentDead))
     {
         if (_ball.BallCanDead)
         {
             _ball.StaminaZero();
             Dead?.Invoke();
         }
         else
         {
             Jump(platformSegmentDead);
         }
     }
     else if (collision.gameObject.TryGetComponent(out PlatformSegment platformSegment))
     {
         Jump(platformSegment);
     }
     else if (collision.gameObject.TryGetComponent(out FinishSegment finishSegment))
     {
         Finish?.Invoke();
     }
 }
        internal static async void CopyTextToClipboard(Context context, Guid guid)
        {
            await DataStorageProviders.HistoryManager.OpenAsync();

            var item = DataStorageProviders.HistoryManager.GetItem(guid);

            DataStorageProviders.HistoryManager.Close();

            if (!(item.Data is ReceivedText))
            {
                throw new Exception("Invalid received item type.");
            }

            await DataStorageProviders.TextReceiveContentManager.OpenAsync();

            string text = DataStorageProviders.TextReceiveContentManager.GetItemContent(guid);

            DataStorageProviders.TextReceiveContentManager.Close();

            Handler handler = new Handler(Looper.MainLooper);

            handler.Post(() =>
            {
                ClipboardManager clipboard = (ClipboardManager)context.GetSystemService(Context.ClipboardService);
                ClipData clip         = ClipData.NewPlainText(text, text);
                clipboard.PrimaryClip = clip;
            });

            ShowToast(context, "Text copied to clipboard.", ToastLength.Long);

            Finish?.Invoke();
        }
Exemple #6
0
 void manager_Finish(object sender, EventArgs e)
 {
     if (Finish != null)
     {
         Finish.Invoke(this, EventArgs.Empty);
     }
 }
Exemple #7
0
 private void onFireFinish(FinishEventArgs args)
 {
     if (Finish != null)
     {
         Finish.Invoke(this, args);
     }
 }
Exemple #8
0
 public int Stop()
 {
     Acceleration = 0;
     CurrentSpeed = 0;
     Finish.Invoke(this, $"{Name} drivig: {Distance} miles by {_totalMoves} moves");
     return(Distance);
 }
        public IEnumerable <FileSystemInfoBase> Enumerate(string startPath)
        {
            Start?.Invoke(this, EventArgs.Empty);

            CheckPath(startPath);
            var result = _fileSystem.DirectoryInfo.FromDirectoryName(startPath).EnumerateFileSystemInfos("*", SearchOption.AllDirectories);

            foreach (var systemInfoBase in result)
            {
                ProcessFoundEntry(systemInfoBase);

                if (Filter != null && !Filter(systemInfoBase))
                {
                    continue;
                }

                var args = new FilteredFileSystemInfoFound();                //not obvious - should filtered events be raised in case of empty filter?

                ProcessFilteredEntry(systemInfoBase, args);

                if (args.IsProcessTerminated)
                {
                    break;
                }

                if (!args.IsExcluded)
                {
                    yield return(systemInfoBase);
                }
            }

            Finish?.Invoke(this, EventArgs.Empty);
        }
Exemple #10
0
 /// <summary>
 /// Raises the Finish event.
 /// </summary>
 private void OnFinish()
 {
     if (Finish != null)
     {
         Finish.Invoke();
     }
 }
        private async static void FileReceiver_FileTransferProgress(FileTransfer.FileTransfer2ProgressEventArgs e)
        {
            Activity?.Invoke();

            if (e.State == FileTransfer.FileTransferState.Error)
            {
                await progressNotifier?.FinishProgress("Receive failed.", "");
            }
            else if (e.State == FileTransfer.FileTransferState.Finished)
            {
                var intent = new Intent(context, typeof(HistoryListActivity)); //typeof(NotificationLaunchActivity));
                intent.PutExtra("itemGuid", e.Guid.ToString());

                if (e.TotalFiles == 1)
                {
                    await progressNotifier?.FinishProgress($"Received a file from {e.SenderName}", "Tap to view", intent, context);
                }
                else
                {
                    await progressNotifier?.FinishProgress($"Received {e.TotalFiles} files from {e.SenderName}", $"Tap to view", intent, context);
                }

                progressNotifier = null;
                Finish?.Invoke();
            }
            else if (e.State == FileTransfer.FileTransferState.DataTransfer)
            {
                progressNotifier?.SetProgressValue(1000, (int)(1000.0 * e.Progress), "Receiving...");
            }
        }
Exemple #12
0
 private void CreateFirstVaultSkipButton_Clicked(object sender, EventArgs e)
 {
     Finish?.Invoke(this, new FirstRunFinishEventArgs(
                        PBKDF2Enabled ? Common.PasswordDerivationMode.PBKDF2 : Common.PasswordDerivationMode.SCrypt,
                        ClipboardObfuscatorEnabled,
                        AutoSaveEnabled));
 }
        public IEnumerable <FileSystemInfo> ScanDir(DirectoryInfo dir)
        {
            Start?.Invoke(_logService);

            int level = 0;

            if (_filterMode)
            {
                foreach (var treeObject in ScanDir(dir, level))
                {
                    if (_breakNexStep)
                    {
                        yield break;
                    }
                    if (FilteringTreeObject(treeObject))
                    {
                        yield return(treeObject);
                    }
                    else if (!_includeOnlyFiltered)
                    {
                        yield return(treeObject);
                    }
                }
            }
            else
            {
                foreach (var treeObject in ScanDir(dir, level))
                {
                    yield return(treeObject);
                }
            }

            Finish?.Invoke(_logService);
        }
Exemple #14
0
        public void Execute()
        {
            Start?.Invoke("Start scan!");

            TraverseTree(_root);

            Finish?.Invoke("Finish scan!");
        }
Exemple #15
0
 protected virtual void OnFinish(System.EventArgs e)
 {
     Finish?.Invoke(this, e);
     // ensure parent form is closed (even when ShowDialog is not used)
     if (this.AllowAutoClose)
     {
         this.ParentForm.Close();
     }
 }
Exemple #16
0
        public override void Update()
        {
            //base.Update();
            if (state == State.stop)
            {
                return;
            }
            count++;
            if (count / 60.0f * 1000 > timeduration)
            {
                if (!reverse)
                {
                    if (pfilenames >= filenames.Length - 1)
                    {
                        pfilenames = 0;
                        if (Finish != null)
                        {
                            Finish.Invoke(this, EventArgs.Empty);
                        }
                    }
                    else
                    {
                        pfilenames++;
                    }
                }
                else
                {
                    if (!reversing)
                    {
                        if (pfilenames >= filenames.Length - 1)
                        {
                            pfilenames--;
                            reversing = true;
                        }
                        else
                        {
                            pfilenames++;
                        }
                    }
                    else
                    {
                        if (pfilenames <= 0)
                        {
                            pfilenames++;
                            reversing = false;
                        }
                        else
                        {
                            pfilenames--;
                        }
                    }
                }

                Filename = filenames[pfilenames];
                count    = 0;
            }
        }
Exemple #17
0
        public static void SortThread <T>(T[] array, Func <T, T, bool> comparator)
        {
            int    threadId  = ++_threadID;
            Thread newThread = new Thread(() => CustomSort.Sort(ref array, comparator));

            newThread.Start();
            newThread.Join();
            Finish?.Invoke($"Sorting is finished in Thread with ID {threadId}.");
        }
Exemple #18
0
        public double[] Do()
        {
            _doStart?.Invoke(this, new TimeEventArgs("Start", DateTime.Now.Millisecond));

            double[] result = SortedArray();

            _doFinish?.Invoke(this, new TimeEventArgs("Finish", DateTime.Now.Millisecond));

            return(result);
        }
Exemple #19
0
 private void OnCollisionEnter(Collision collision)
 {
     if (collision.gameObject.layer == LayerMask.NameToLayer("RoadBorder"))
     {
         StopAll();
         CoroutineController.DoAfterFixedUpdate(() => Finish?.Invoke(false));
         _rigidBody.transform.DOKill();
         ResetTransform();
     }
 }
Exemple #20
0
        public IEnumerable <string> ViewFiles(string path)
        {
            _logger.LogInformation("Start file searching.");
            Start?.Invoke();

            var result = GetEntities(path);

            _logger.LogInformation("End file searching.");
            Finish?.Invoke();

            return(result);
        }
Exemple #21
0
        public static void SortingInThread <T>(T[] a, Func <T, T, bool> compare)
        {
            Thread thread = new Thread(() =>
            {
                Console.WriteLine($"Starting  #{Thread.CurrentThread.ManagedThreadId}");
                Sort(a, compare);
                Print(a);
                Finish?.Invoke("Finish!" + Thread.CurrentThread.ManagedThreadId);
            });

            thread.Start();
        }
Exemple #22
0
 private void OnOk(object sender, EventArgs e)
 {
     if (CurrentIndex >= testings.Count - 1)
     {
         Finish?.Invoke(sender, e);
         testings[CurrentIndex].Collapse();
         return;
     }
     testings[CurrentIndex].Collapse();
     CurrentIndex++;
     testings[CurrentIndex].Expand();
     ScrollToControl(testings[CurrentIndex]);
 }
Exemple #23
0
 private void FinishButton_Clicked(object sender, EventArgs e)
 {
     Finish?.Invoke(this, new FirstRunFinishEventArgs(
                        PBKDF2Enabled ? Common.PasswordDerivationMode.PBKDF2 : Common.PasswordDerivationMode.SCrypt,
                        ClipboardObfuscatorEnabled,
                        AutoSaveEnabled,
                        _syncMode,
                        _cloudProvider,
                        CloudStorageProviderType,
                        CloudStorageAccountUser,
                        VaultName,
                        VaultDescription,
                        MasterPassphrase));
 }
Exemple #24
0
        protected override void OnKeyUp(KeyEventArgs e)
        {
            base.OnKeyUp(e);

            if (e.Key == Key.Escape)
            {
                Clear();
            }

            if (FinisherKeys.Contains(e.Key))
            {
                Finish?.Invoke(this, EventArgs.Empty);
            }
        }
Exemple #25
0
        /// <summary>
        /// 更新する
        /// </summary>
        public void Update()
        {
            if (state != PlayState.Playing)
            {
                return;
            }
            switch (playType)
            {
            case PlayType.Once:
                currentFrame = FPS * stopwatch.ElapsedMilliseconds / 1000;
                break;

            case PlayType.ReverseOnce:
                currentFrame = FrameLength - FPS * stopwatch.ElapsedMilliseconds / 1000;
                break;

            case PlayType.Loop:
                currentFrame = NormalizeValue(FPS * stopwatch.ElapsedMilliseconds / 1000, FrameLength);
                break;

            case PlayType.ReverseLoop:
                currentFrame = ReverseValue(NormalizeValue(FPS * stopwatch.ElapsedMilliseconds / 1000, FrameLength * 2), FrameLength);
                break;
            }
            if (currentFrame > FrameLength && playType == PlayType.Once)
            {
                state = PlayState.Stop;
                stopwatch.Stop();
                stopwatch.Reset();
                currentFrame = FrameLength;
                if (Finish != null)
                {
                    Finish.Invoke(this, EventArgs.Empty);
                }
            }
            else if (currentFrame < 0 && playType == PlayType.ReverseOnce)
            {
                state = PlayState.Stop;
                stopwatch.Stop();
                stopwatch.Reset();
                currentFrame = 0;
                if (Finish != null)
                {
                    Finish.Invoke(this, EventArgs.Empty);
                }
            }
            InnerUpdate();
        }
Exemple #26
0
        public async Task <ScriptResult> Run(IList <Input> inputs)
        {
            ScriptResult result;

            IsRunning = true;
            Start?.Invoke(ScriptBlock);
            result = await ExecuteScript(ScriptBlock, inputs);

            await Task.Run(() =>
            {
                Finish?.Invoke(ScriptBlock, result);
                IsRunning = false;
            });

            return(result);
        }
        public override void Update(double deltaTime)
        {
            base.Update(deltaTime);

            if (!Enable || !IsAnimate)
            {
                return;
            }
            time += deltaTime;
            if (mode == 1)
            {
                parent.X += vx;
                parent.Y += vy;
            }
            else if (mode == 2)
            {
                Vector2 v = MathUtils.BezierCurve(new Vector2(p0.X, p0.Y), new Vector2(p1.X, p1.Y), new Vector2(p2.X, p2.Y), new Vector2(p3.X, p3.Y), time / duration);
                parent.X = v.X;
                parent.Y = v.Y;
            }
            else if (mode == 3)
            {
                Vector2 v = MathUtils.BezierCurve(new Vector2(p0.X, p0.Y), new Vector2(p1.X, p1.Y), new Vector2(p2.X, p2.Y), new Vector2(p3.X, p3.Y), time / duration);
                parent.X = v.X;
                // parent.Y = v.Y;
            }
            else if (mode == 4)
            {
                Vector2 v = MathUtils.BezierCurve(new Vector2(p0.X, p0.Y), new Vector2(p1.X, p1.Y), new Vector2(p2.X, p2.Y), new Vector2(p3.X, p3.Y), time / duration);
                // parent.X = v.X;
                parent.Y = v.Y;
            }
            parent.DebugMessage = time.ToString();
            if (time >= duration)
            {
                if (mode == 2 || mode == 3)
                {
                    parent.X = p3.X;
                }
                if (mode == 2 || mode == 4)
                {
                    parent.Y = p3.Y;
                }
                Finish?.Invoke(this, EventArgs.Empty);
                IsAnimate = false;
            }
        }
Exemple #28
0
        async void BeforeFinish()
        {
            List <string> Messages = new List <string>();

            if (Halfmap1Final == null)
            {
                Messages.Add("No half-map 1.");
            }
            if (Halfmap2Final == null)
            {
                Messages.Add("No half-map 2.");
            }
            if (Halfmap1Final != null && Halfmap2Final != null && Halfmap1Final.Dims != Halfmap2Final.Dims)
            {
                Messages.Add("Half-map dimensions don't match.");
            }

            if (MaskFinal == null)
            {
                Messages.Add("No mask.");
            }
            if (Halfmap1Final != null && MaskFinal != null && Halfmap1Final.Dims != MaskFinal.Dims)
            {
                Messages.Add("Mask and half-map dimensions don't match.");
            }

            if (SpeciesName.ToLower() == "new species")
            {
                Messages.Add("Species name left at default value.");
            }

            if (ParticlesFinal == null || ParticlesFinal.Length == 0)
            {
                Messages.Add("No particles.");
            }

            if (Messages.Count > 0)
            {
                await((MainWindow)Application.Current.MainWindow).ShowMessageAsync("Oopsie", "There are some problems:\n\n" + string.Join("\n", Messages));
                return;
            }

            Dispose();
            Finish?.Invoke();
        }
Exemple #29
0
        public void Integration(object s)
        {
            double res = 0;

            Stopwatch stopWatch = new Stopwatch();

            stopWatch.Start();

            for (double i = LBorder; i < HBorder; i += Step)
            {
                res += Math.Sin(i);
            }
            res *= Step;

            stopWatch.Stop();

            Finish?.Invoke(res, stopWatch, s);
        }
        protected void OnFinish(EventArgs arg)
        {
            if (arg == null)
            {
                throw new ArgumentNullException(nameof(arg));
            }

            Finish?.Invoke(this, arg);

            Console.WriteLine($"FINISH SEARCH \r\n");
            Console.WriteLine($"----- File system objects found: {_fileManager.FileSystemObjectsList.Count} ------- \r\n");

            var i = 0;

            foreach (var file in _fileManager.FileSystemObjectsList)
            {
                Console.WriteLine($"{i++}. {file.Name} TYPE : {file.GetFileSystemType()}");
            }
        }