示例#1
0
        public void LoadSongsSync(SongLoader loader)
        {
            NewLoad?.Invoke(this, EventArgs.Empty);
            var songs = loader.LoadSongs();

            LoadInitiated?.Invoke(this, songs.Count);
            UpdateLibrary(songs, false);
            library.InitialiseParts();
            LoadCompleted?.Invoke(this, EventArgs.Empty);
        }
示例#2
0
        private async void OnWebViewNavigationCompleted(WebView sender, WebViewNavigationCompletedEventArgs args)
        {
            if (args.IsSuccess)
            {
                // Inject JS script
                await WebView.InvokeScriptAsync("eval", new[] { "function invokeCSharpAction(data){window.external.notify(data);}" });
            }

            LoadCompleted?.Invoke();
        }
示例#3
0
    private LoadCompleted m_lc;        //加载完成回调函数

    /// <summary>
    /// ABloader构造函数
    /// </summary>
    /// <param name="assetbundlename">AB包名</param>
    /// <param name="lc">加载完成回调</param>
    /// <param name="lp">加载进度回调</param>
    public AssetBundleLoader(string assetbundlename, LoadCompleted lc, LoadProgress lp)
    {
        m_assetLoader     = null;
        m_www             = null;
        m_assetBundleName = assetbundlename;
        m_assetBundlePath = PathUtil.getWWWPath() + "/" + m_assetBundleName;
        m_progress        = 0.0f;
        m_lp = lp;
        m_lc = lc;
    }
示例#4
0
        public void Run()
        {
            OnStartup(StartupEventArgs.Empty);
            Startup.Raise(this, StartupEventArgs.Empty);

            LoadStartupUri();

            OnLoadCompleted();
            LoadCompleted.Raise(this);
        }
        public void ClearLoadCompletedInvocationList()
        {
            if (LoadCompleted != null)
            {
                Delegate[] associatedDelegates = LoadCompleted.GetInvocationList();

                foreach (var d in associatedDelegates)
                {
                    LoadCompleted -= (d as LoadCompletedEventHandler);
                }
            }
        }
示例#6
0
 /// <summary>
 /// ソートを適応したユーザーのリストを読み込み、完了後にLoadCompletedイベントを発生させます。
 /// </summary>
 /// <param name="sidePanelChangedEventArgs">SidePanelで発生したイベントデータ</param>
 private void LoadSortedCollection(ISidePanelChangedEventArgs sidePanelChangedEventArgs)
 {
     if (_current != null)
     {
         SortCurrentList(sidePanelChangedEventArgs);
         LoadCompleted?.Invoke(_current);
     }
     else
     {
         LoadFilteredAndSortedCollectionAsync(sidePanelChangedEventArgs);
     }
 }
示例#7
0
 /// <summary>
 /// Allow the device to react to the start of a new frame
 /// </summary>
 public void OnCpuOperationCompleted()
 {
     SetTapeMode();
     if (CurrentMode == TapeOperationMode.Load &&
         HostVm.ExecuteCycleOptions.FastTapeMode &&
         TapeFilePlayer != null &&
         TapeFilePlayer.PlayPhase != PlayPhase.Completed &&
         _cpu.Registers.PC == LoadBytesRoutineAddress)
     {
         if (FastLoadFromTzx())
         {
             LoadCompleted?.Invoke(this, EventArgs.Empty);
         }
     }
 }
 void LoadWorkshopPage(object state)
 {
     PageURL  = Utility.GetWorkshopWebpageURL(this.Key);
     pageData = Utility.GetWorkshopWebpage(this.Key);
     if (!string.IsNullOrEmpty(pageData))
     {
         Author      = Utility.ExtractAuthor(pageData);
         Description = Utility.ExtractDescription(pageData);
         if (_info == null)
         {
             Title = Utility.ExtractTitle(pageData);
             var times = Utility.ExtractLastUpdate(pageData);
             if (times != null)
             {
                 CreatedTime = times.Item1;
                 PublishTime = times.Item2;
                 Size        = times.Item3;
             }
         }
         else
         {
             var t = Utility.ExtractLastUpdate(pageData);
             if (t != null)
             {
                 CreatedTime = t.Item1;
                 Size        = t.Item3;
             }
             else
             {
             }
         }
         AuthorProfileURL = Utility.ExtractAuthorProfileURL(pageData);
         ImageURL         = Utility.ExtractImageURL(pageData);
         if (string.IsNullOrEmpty(ImageURL))
         {
         }
         else
         {
             Image = CreateInstance <BitmapImageUIThreadManaged>(ImageURL);
         }
     }
     IsLoading = false;
     LoadCompleted?.Invoke(this, EventArgs.Empty);
 }
        /// <summary>
        /// Helper class to redraw the IImageMaskSurface asynchronously
        /// </summary>
        /// <returns>Task</returns>
        private async Task RedrawSurfaceAsync()
        {
            // Cache the canvasBitmap to avoid reloading of the same image during Resize/Redraw operations
            _canvasBitmap = await _generator.RedrawImageMaskSurfaceAsync(_surfaceLock, _surface, _uri, MaskPadding, Options, _canvasBitmap);

            Status = _canvasBitmap != null ? ImageSurfaceLoadStatus.Success : ImageSurfaceLoadStatus.Error;

            if (_canvasBitmap != null)
            {
                DecodedPhysicalSize = new Size(_canvasBitmap.SizeInPixels.Width, _canvasBitmap.SizeInPixels.Height);
                DecodedSize         = _canvasBitmap.Size;
            }

            if (_raiseLoadCompletedEvent)
            {
                LoadCompleted?.Invoke(this, Status);
                _raiseLoadCompletedEvent = false;
            }
        }
示例#10
0
    private IEnumerator WaitAndLoadLevel(float wait, string scene, LoadCompleted callback)
    {
        if (wait > 0)
        {
            yield return(new WaitForSeconds(wait));
        }
        LoadingHider.SetActive(true);
        // wait 3frames
        yield return(new WaitForSeconds(1.01f));

        yield return(null);

        Application.LoadLevel(scene);
        yield return(new WaitForSeconds(.01f));

        yield return(null);

        LoadingHider.SetActive(false);
        callback();
    }
示例#11
0
        // プライベートメソッド

        /// <summary>
        /// フィルタとソートを適応したユーザーのリストを読み込み、完了後にLoadCompletedイベントを発生させます。
        /// </summary>
        /// <param name="sidePanelChangedEventArgs">SidePanelで発生したイベントデータ</param>
        private async void LoadFilteredAndSortedCollectionAsync(ISidePanelChangedEventArgs sidePanelChangedEventArgs)
        {
            switch (sidePanelChangedEventArgs.FilterAndSortOption.FilterType)
            {
            case FilterType.OneWay:
            {
                _current = GetOneWayListOrDefault(sidePanelChangedEventArgs) ?? new List <UserData>();
                SortCurrentList(sidePanelChangedEventArgs);
                LoadCompleted?.Invoke(_current);
                break;
            }

            case FilterType.Fan:
            {
                _current = GetFanListOrDefault(sidePanelChangedEventArgs) ?? new List <UserData>();
                SortCurrentList(sidePanelChangedEventArgs);
                LoadCompleted?.Invoke(_current);
                break;
            }

            case FilterType.Mutual:
            {
                _current = GetMutualListOrDefault(sidePanelChangedEventArgs) ?? new List <UserData>();
                SortCurrentList(sidePanelChangedEventArgs);
                LoadCompleted?.Invoke(_current);
                break;
            }

            case FilterType.Inactive:
            {
                _current = await GetInactiveListOrDefaultAsync(sidePanelChangedEventArgs).ConfigureAwait(false) ?? new List <UserData>();

                SortCurrentList(sidePanelChangedEventArgs);
                LoadCompleted?.Invoke(_current);
                break;
            }
            }
        }
示例#12
0
        /// <summary>
        /// Sets the current tape mode according to the current PC register
        /// and the MIC bit state
        /// </summary>
        public void SetTapeMode()
        {
            // --- We must use the Spectrum 48K ROM for this mode
            if (_memoryDevice.GetSelectedRomIndex() != HostVm.RomConfiguration.Spectrum48RomIndex)
            {
                return;
            }

            switch (_currentMode)
            {
            case TapeOperationMode.Passive:
                if (_cpu.Registers.PC == LoadBytesRoutineAddress)
                {
                    EnterLoadMode();
                }
                else if (_cpu.Registers.PC == SaveBytesRoutineAddress)
                {
                    EnterSaveMode();
                }
                return;

            case TapeOperationMode.Save:
                if (_cpu.Registers.PC == ERROR_ROM_ADDRESS ||
                    (int)(_cpu.Tacts - _lastMicBitActivityTact) > SAVE_STOP_SILENCE)
                {
                    LeaveSaveMode();
                }
                return;

            case TapeOperationMode.Load:
                if ((_tapePlayer?.Eof ?? false) || _cpu.Registers.PC == ERROR_ROM_ADDRESS)
                {
                    LeaveLoadMode();
                    LoadCompleted?.Invoke(this, EventArgs.Empty);
                }
                return;
            }
        }
示例#13
0
        public void Load(string path)
        {
            string appData = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);

            var document = new XmlDocument();

            document.Load(path);

            var design = document.SelectSingleNode("/Canvas/Design");

            byte[] arr = Convert.FromBase64String(design.InnerText);
            LoadRequested?.Invoke(Encoding.UTF8.GetString(arr));

            foreach (XmlElement element in document.SelectNodes("/Canvas/Code/Blocks"))
            {
                var position = Point.Parse(element.GetAttribute("Position"));
                var block    = BlocksFromXML(element);
                AttachToCanvas(block);
                block.Position = position;
            }

            List <string> references = new List <string>();

            foreach (XmlElement element in document.SelectNodes("/Canvas/Extension/Reference"))
            {
                references.Add(element.GetAttribute("Path").Replace("%APPDATA%", appData));
            }

            List <string> dependencies = new List <string>();

            foreach (XmlElement element in document.SelectNodes("/Canvas/Extension/Dependencies"))
            {
                dependencies.Add(element.GetAttribute("Path").Replace("%APPDATA%", appData));
            }

            LoadCompleted?.Invoke(references.ToArray(), dependencies.ToArray());
        }
示例#14
0
 private void OnLoadCompleted(object sender, RunWorkerCompletedEventArgs e)
 {
     LoadCompleted?.Invoke(this, new AsyncCompletedEventArgs(e.Error, e.Cancelled, null));
 }
示例#15
0
 public void NotifyCompleted(IList <Song> loadedSongs)
 {
     attachedListener?.NotifyCompleted(loadedSongs);
     UpdateLibrary(loadedSongs, true);
     LoadCompleted?.Invoke(this, EventArgs.Empty);
 }
 public override void OnPageFinished(Android.Webkit.WebView view, string url)
 {
     LoadCompleted?.Invoke(view.Url);
     System.Diagnostics.Debug.WriteLine("Load finished.");
 }
示例#17
0
 void PART_Frame_LoadCompleted(object sender, NavigationEventArgs e)
 {
     LoadCompleted?.Invoke(this, e);
 }
示例#18
0
        public void Init()
        {
            // Make sure we don't initialize twice and create a disaster
            if (Initialized)
            {
                return;
            }
            Initialized = true;

            // Create timer for event management
            eventTimer          = new Timer(10);
            eventTimer.Elapsed += delegate
            {
                lock (NoteManager.Backlog)
                {
                    while (NoteManager.Backlog.Any() && NoteManager.Backlog.First().StartTime <= Stopwatch.ElapsedMilliseconds)
                    {
                        Event ev = NoteManager.Backlog.Dequeue();
                        ev.Method();
                    }
                }
            };

            LoadingStatus = 0;
            // Create handles to MIDI devices
            outDevice = new OutputDevice(0);    // You might want to change this!
            sequencer = new Sequencer();
            sequence  = new Sequence();
            //  RendererManager = new RendererManagerManager(NoteManager, Keyboard, sequence, sequencer);
            LoadingStatus = -1;
            // Set custom event handlers for sequencer
            sequencer.ChannelMessagePlayed += delegate(object o, ChannelMessageEventArgs args)
            {
                ChannelCommand cmd     = args.Message.Command;
                int            channel = args.Message.MidiChannel;
                int            data1   = args.Message.Data1;
                int            data2   = args.Message.Data2;
                if (cmd == ChannelCommand.NoteOff || (cmd == ChannelCommand.NoteOn && data2 == 0))
                {
                    if (NoteManager.LastPlayed[channel, data1] != null)
                    {
                        Note n = NoteManager.LastPlayed[channel, data1];
                        n.Playing = false;
                    }
                }
                else if (cmd == ChannelCommand.NoteOn)
                {
                    Note n = new Note
                    {
                        Key      = data1,
                        Length   = 0,
                        Playing  = true,
                        Position = 0,
                        Time     = Stopwatch.ElapsedMilliseconds,
                        Channel  = channel,
                        Velocity = data2
                    };
                    lock (NoteManager.Notes)
                        NoteManager.Notes.Add(n);
                    if (NoteManager.LastPlayed[channel, data1] != null)
                    {
                        NoteManager.LastPlayed[channel, data1].Playing = false;
                    }
                    NoteManager.LastPlayed[channel, data1] = n;
                }

                lock (NoteManager.Backlog)
                {
                    NoteManager.Backlog.Enqueue(new Event(delegate
                    {
                        outDevice.Send(args.Message);
                        if (cmd == ChannelCommand.NoteOff || (cmd == ChannelCommand.NoteOn && data2 == 0))
                        {
                            if (Keyboard.KeyPressed[data1] > 0)
                            {
                                Keyboard.KeyPressed[data1]--;
                            }
                        }
                        else if (cmd == ChannelCommand.NoteOn)
                        {
                            Keyboard.KeyPressed[data1]++;
                        }
                        else if (cmd == ChannelCommand.Controller)
                        {
                            if (data1 == 0x07)
                            {
                                Keyboard.ChannelVolume[channel] = data2;
                            }
                        }
                        else if (cmd == ChannelCommand.PitchWheel)
                        {
                            int pitchValue = Get14BitValue(data1, data2);
                            Keyboard.Pitchwheel[channel] = pitchValue;
                        }
                    }, Stopwatch.ElapsedMilliseconds, Delay));
                }
            };

            // BUG A bug in the Sanford.Multimedia.Midi library prevents certain SysEx messages from playing
            // Disabling SysEx messages completely solves this issue
            //sequencer.SysExMessagePlayed += delegate (object o, SysExMessageEventArgs args)
            //{
            //    lock (NoteManager.Backlog)
            //        NoteManager.Backlog.Enqueue(new Event(() => { try { outDevice.Send(args.Message); } catch { } }, Stopwatch.ElapsedMilliseconds, Delay));
            //};
            sequencer.Chased += delegate(object o, ChasedEventArgs args)
            {
                foreach (ChannelMessage message in args.Messages)
                {
                    lock (NoteManager.Backlog)
                        NoteManager.Backlog.Enqueue(new Event(() => { try { outDevice.Send(message); } catch { } }, Stopwatch.ElapsedMilliseconds, Delay));
                }
            };
            sequencer.Stopped += delegate(object o, StoppedEventArgs args)
            {
                foreach (ChannelMessage message in args.Messages)
                {
                    lock (NoteManager.Backlog)
                        NoteManager.Backlog.Enqueue(new Event(() => { try { outDevice.Send(message); } catch { } }, Stopwatch.ElapsedMilliseconds, Delay));
                }
                // Stop everything when the MIDI is done playing
                Stop();
            };
            sequence.LoadCompleted += delegate(object o, AsyncCompletedEventArgs args)
            {
                LoadingStatus = -1;
                if (args.Cancelled)
                {
                    //MessageBox.Show("The operation was cancelled.", "MIDITrailer - Error", MessageBoxButtons.OK,
                    //    MessageBoxIcon.Error);
                    return;
                }
                sequencer.Sequence = sequence;
                if (LoadCompleted != null)
                {
                    LoadCompleted.Invoke(this, args);
                }
            };
            sequence.LoadProgressChanged += delegate(object sender, ProgressChangedEventArgs args)
            {
                LoadingStatus = args.ProgressPercentage;
            };
        }
 private void NavigationService_LoadCompleted(object sender, NavigationEventArgs e)
 {
     LoadCompleted?.Invoke(sender, e);
 }
示例#20
0
 /// <summary>
 /// 触发加载完成
 /// </summary>
 public void NotifyLoadComplete()
 {
     LoadCompleted?.Invoke();
 }
 protected virtual void OnLoadCompleted()
 {
     LoadCompleted?.Invoke(this, EventArgs.Empty);
 }
 public override void DidFinishNavigation(WKWebView webView, WKNavigation navigation)
 {
     LoadCompleted?.Invoke(webView.Url.ToString());
 }
示例#23
0
 protected virtual void OnLoadCompleted(EventArgs e)
 {
     LoadCompleted?.Invoke(this, e);
 }
示例#24
0
 public void OnLoadComplete()
 {
     IsLoaded = true;
     LoadCompleted?.Invoke(this);
 }
示例#25
0
 ///<summary>Raises the LoadCompleted event.</summary>
 ///<param name="e">An EventArgs object that provides the event data.</param>
 protected virtual void OnLoadCompleted(EventArgs e)
 {
     EventSequence.Execute(() => LoadCompleted?.Invoke(this, e));
 }
示例#26
0
        /// <summary>
        /// This method will load a song and its settings from a file at the "path" variable's destination
        /// This loading method handles all previous save formats for backwards compatibility
        /// </summary>
        public static void LoadSong(string path)
        {
            Song.Clear();
            bool         errorWhileLoading = true;
            StreamReader sr        = new StreamReader(path);
            string       firstLine = sr.ReadLine();

            #region 2.1+ save format
            if (SupportedVersionsSave.Contains(firstLine))
            {
                if (sr.ReadLine() == "DELAYS")
                {
                    int delayCount = 0;
                    if (int.TryParse(sr.ReadLine(), out delayCount) && delayCount > 0)
                    {
                        for (int i = 0; i < delayCount; i++)
                        {
                            char delayChar;
                            int  delayTime = 0;
                            if (char.TryParse(sr.ReadLine(), out delayChar))
                            {
                                if (int.TryParse(sr.ReadLine(), out delayTime))
                                {
                                    Delays.Add(new Delay(delayChar, delayTime));
                                }
                            }
                        }
                    }
                }
                if (sr.ReadLine() == "CUSTOM NOTES")
                {
                    int noteCount = 0;
                    if (int.TryParse(sr.ReadLine(), out noteCount) && noteCount > 0)
                    {
                        for (int i = 0; i < noteCount; i++)
                        {
                            char origNoteChar;
                            char replaceNoteChar;
                            if (char.TryParse(sr.ReadLine(), out origNoteChar))
                            {
                                if (char.TryParse(sr.ReadLine(), out replaceNoteChar))
                                {
                                    WindowsInput.Native.VirtualKeyCode vkOld;
                                    WindowsInput.Native.VirtualKeyCode vkNew;
                                    try
                                    {
                                        VirtualDictionary.TryGetValue(origNoteChar, out vkOld);
                                        VirtualDictionary.TryGetValue(replaceNoteChar, out vkNew);

                                        if (vkOld == 0 || vkNew == 0)
                                        {
                                            return;
                                        }
                                    }
                                    catch (ArgumentNullException)
                                    {
                                        return;
                                    }

                                    CustomNotes.Add(new Note(origNoteChar, vkOld, char.IsUpper(origNoteChar)), new Note(replaceNoteChar, vkNew, char.IsUpper(replaceNoteChar)));
                                }
                            }
                        }
                    }
                }
                if (sr.ReadLine() == "SPEEDS")
                {
                    int normalSpeed, fastSpeed;
                    int.TryParse(sr.ReadLine(), out normalSpeed);
                    int.TryParse(sr.ReadLine(), out fastSpeed);
                    DelayAtNormalSpeed = normalSpeed;
                    DelayAtFastSpeed   = fastSpeed;
                }
                if (sr.ReadLine() == "NOTES")
                {
                    int noteCount = 0;
                    if (int.TryParse(sr.ReadLine(), out noteCount) && noteCount > 0)
                    {
                        AddNotesFromString(sr.ReadToEnd());
                    }
                    errorWhileLoading = false;
                }
            }
            #endregion
            #region 2.0 save format (for backwards compatibility)
            if (firstLine == "DELAYS")
            {
                int delayCount = 0;
                if (int.TryParse(sr.ReadLine(), out delayCount) && delayCount > 0)
                {
                    for (int i = 0; i < delayCount; i++)
                    {
                        char delayChar;
                        int  delayTime = 0;
                        if (char.TryParse(sr.ReadLine(), out delayChar))
                        {
                            if (int.TryParse(sr.ReadLine(), out delayTime))
                            {
                                Delays.Add(new Delay(delayChar, delayTime));
                            }
                        }
                    }
                }
                if (sr.ReadLine() == "NOTES")
                {
                    int noteCount = 0;
                    if (int.TryParse(sr.ReadLine(), out noteCount) && noteCount > 0)
                    {
                        AddNotesFromString(sr.ReadToEnd());
                    }
                    errorWhileLoading = false;
                }
            }
            #endregion
            #region 1.2.2 save format (For backwards compatibility)
            else if (firstLine == "CUSTOM DELAYS")
            {
                int delayCount = 0;
                if (int.TryParse(sr.ReadLine(), out delayCount))
                {
                    if (sr.ReadLine() == "NORMAL DELAY")
                    {
                        if (int.TryParse(sr.ReadLine(), out delayAtNormalSpeed))
                        {
                            Delays.Add(new Delay(' ', DelayAtNormalSpeed));
                            if (sr.ReadLine() == "FAST DELAY")
                            {
                                if (int.TryParse(sr.ReadLine(), out delayAtFastSpeed))
                                {
                                    if (delayCount != 0)
                                    {
                                        for (int i = 0; i < delayCount; i++)
                                        {
                                            int  customDelayIndex = 0;
                                            int  customDelayTime  = 0;
                                            char customDelayChar;

                                            if (sr.ReadLine() == "CUSTOM DELAY INDEX")
                                            {
                                                if (int.TryParse(sr.ReadLine(), out customDelayIndex))
                                                {
                                                    if (sr.ReadLine() == "CUSTOM DELAY CHARACTER")
                                                    {
                                                        if (char.TryParse(sr.ReadLine(), out customDelayChar))
                                                        {
                                                            if (sr.ReadLine() == "CUSTOM DELAY TIME")
                                                            {
                                                                if (int.TryParse(sr.ReadLine(), out customDelayTime))
                                                                {
                                                                    Delays.Add(new Delay(customDelayChar, customDelayTime));
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                    if (sr.ReadLine() == "NOTES")
                                    {
                                        AddNotesFromString(sr.ReadToEnd());
                                        errorWhileLoading = false;
                                    }
                                }
                            }
                        }
                    }
                }
            }
            #endregion
            #region 1.0 save format (For backwards compatibility)
            else if (firstLine == "NORMAL DELAY")
            {
                if (int.TryParse(sr.ReadLine(), out delayAtNormalSpeed))
                {
                    if (sr.ReadLine() == "FAST DELAY")
                    {
                        if (int.TryParse(sr.ReadLine(), out delayAtFastSpeed))
                        {
                            if (sr.ReadLine() == "NOTES")
                            {
                                AddNotesFromString(sr.ReadToEnd());
                                errorWhileLoading = false;
                            }
                        }
                    }
                }
            }
            #endregion
            sr.Close();
            if (errorWhileLoading)
            {
                LoadFailed?.Invoke();
                throw new AutoplayerLoadFailedException("No compatible save format was found!");
            }
            LoadCompleted?.Invoke();
        }