public MyAddon(string[] args) : base() { DialogProgress dp = new DialogProgress(); dp.create("VideoLibrary Example", "Retrieve List of Movies"); VideoLibrary vl = new VideoLibrary(); List <Movie> mov = vl.GetMovies(0, 5); dp.update(50, "Retrieve List of TVShow"); List <TVShow> tv = vl.GetTVShows(); StringBuilder textview = new StringBuilder("Movies List :"); dp.update(80, "Create List"); foreach (Movie s in mov) { textview.AppendLine(" - " + s.Label + " (" + s.Year + ")"); } textview.AppendLine("TVShow List:"); foreach (TVShow s in tv) { textview.AppendLine(" - " + s.Label + " (" + s.Year + ")"); } dp.update(100, "Finish succesful"); dp.close(); Dialog.TextViewer("VideoLibrary Example", textview.ToString()); Stop(); }
private void OnSelectAnswer(object sender, DialogClosingEventArgs eventArgs) { if ((bool)eventArgs.Parameter == false) { return; } // Abort current process... eventArgs.Cancel(); // Creates a new dialog, to show the progress bar... DialogProgress progresso = new DialogProgress(); eventArgs.Session.UpdateContent(progresso); // Then starts a task.. var t = Task <string> .Run(() => { // Calls a methdo from server... return(RemoveItem()); }) .ContinueWith(resultFromServer => { // Now, with the answer from server we can do extra things.. // If there is no message, we just close the current Message if (resultFromServer.Result == string.Empty) { eventArgs.Session.Close(false); } else { // If there is an error message, we show a simple dialog (with just an "OK" button) and shows the error.. eventArgs.Cancel(); eventArgs.Session.UpdateContent(new DialogOk { Message = { Text = resultFromServer.Result } }); } }, TaskScheduler.FromCurrentSynchronizationContext()); }
public override async void Execute() { ExtensionFilter[] extensions = { new ExtensionFilter("Sound Files", "mp3", "wav"), }; string[] paths = StandaloneFileBrowser.OpenFilePanel("Open File", "", extensions, false); if (paths.Length > 0 && !string.IsNullOrEmpty(paths[0])) { string filepath = paths[0]; DialogProgress dialog = DialogManager.ShowProgressLinear("Loading " + filepath, "Loading music", MaterialIconHelper.GetIcon(MaterialIconEnum.INFO_OUTLINE)); Tuple <AudioFileReader, float[]> data = await Task.Run(() => ReadAudioFile(filepath)); AudioClip clip = AudioClip.Create(filepath, (int)(data.Item1.Length / sizeof(float) / data.Item1.WaveFormat.Channels), data.Item1.WaveFormat.Channels, data.Item1.WaveFormat.SampleRate, false); clip.SetData(data.Item2, 0); dialog.Hide(); SongLoadedSignal.Dispatch(clip); AudioPeerService.SetupAudioSource(clip); } }
public void OnProgressCircularButtonClicked() { DialogProgress dialog = DialogManager.ShowProgressCircular("Doing some hard work... Should be done in 5 seconds!", "Loading", MaterialIconHelper.GetIcon(MaterialIconEnum.HOURGLASS_EMPTY)); StartCoroutine(HideWindowAfterSeconds(dialog, 5.0f)); }
public void OnProgressLinearButtonClicked() { DialogProgress dialog = DialogManager.ShowProgressLinear(UIManager.FilesReadingText, UIManager.LoadingText, MaterialIconHelper.GetIcon(MaterialIconEnum.HOURGLASS_EMPTY)); StartCoroutine(HideWindowAfterSeconds(dialog, 5.0f)); }