public void ParseAsync(string file_name, string[] text_lines, ParseProcessTick progress_call = null, ParseFinished finish_call = null) { if (!parsing) { Fitxer f = DataManager.Instance.NewFitxer(); f.nom = file_name; async_text_lines = text_lines; curr_text_line = 0; if (progress_call != null) { progress_callback += progress_call; } if (finish_call != null) { finish_callback += finish_call; } parse_timer = new System.Windows.Forms.Timer(); parse_timer.Tick += new EventHandler(ParseAsyncTimeStep); parse_timer.Interval = 3; // in miliseconds parse_timer.Start(); parsing = true; } }
void ContinueLoading() { if (loading) { return; } loading = true; Keyboard.ClearFocus(); loadSettingsScreen.Visibility = Visibility.Collapsed; loadProgessScreen.Visibility = Visibility.Visible; LoadedFile = new MIDIMemoryFile(filepath, loaderSettings, cancel.Token); LoadedFile.ParseFinished += () => { Dispatcher.InvokeAsync(() => { ParseFinished?.Invoke(); }).Task.GetAwaiter().GetResult(); }; LoadedFile.ParseCancelled += () => { Dispose(); Dispatcher.InvokeAsync(() => { ParseCancelled?.Invoke(); }).Task.GetAwaiter().GetResult(); }; Task.Run(() => { try { LoadedFile.Parse(); } catch (Exception e) { Dispatcher.InvokeAsync(() => { MessageBox.Show(e.Message, "Couldn't load midi file", this); ParseCancelled?.Invoke(); }).Task.GetAwaiter().GetResult(); } }); rotateStoryboard.Children.Add(rotate); Storyboard.SetTarget(rotate, rotateLogo); Storyboard.SetTargetProperty(rotate, new PropertyPath("(Image.RenderTransform).(RotateTransform.Angle)")); CompositionTarget.Rendering += OnRender; }
protected void ParseFinishedInvoke() { ParseFinished?.Invoke(); }