Exemplo n.º 1
0
        public async Task ShowLoginDialog(libVLCX.Dialog dialog, string title, string text, string defaultUserName, bool askToStore)
        {
            await VLCDialog.WaitForDialogLock();

            await DispatchHelper.InvokeInUIThread(Windows.UI.Core.CoreDispatcherPriority.Normal, async() =>
            {
                _currentDialog = new VLCDialog(title, text, dialog, defaultUserName, askToStore);
                await _currentDialog.ShowAsync();
            });
        }
Exemplo n.º 2
0
        public async Task ShowErrorDialog(string title, string text)
        {
            await VLCDialog.WaitForDialogLock();

            await DispatchHelper.InvokeInUIThread(Windows.UI.Core.CoreDispatcherPriority.Normal, async() =>
            {
                _currentDialog = new VLCDialog(title, text);
                await _currentDialog.ShowAsync();
            });
        }
Exemplo n.º 3
0
        public static async Task DisplayDialog(string title, string desc, Dialog d, string username = null, bool askStore = false)
        {
            await DialogDisplaySemaphoreSlim.WaitAsync();

            try
            {
                var dialog = new VLCDialog();
                dialog.Closed += Dialog_Closed;
                dialog.Initialize(title, desc, d, username, askStore);
                await dialog.ShowAsync();
            }
            catch { }
        }
Exemplo n.º 4
0
        public static async Task DisplayDialog(string title, string desc)
        {
            await DialogDisplaySemaphoreSlim.WaitAsync();

            try
            {
                var dialog = new VLCDialog();
                dialog.Closed += Dialog_Closed;
                dialog.Initialize(title, desc);
                await dialog.ShowAsync();
            }
            catch { }
        }
Exemplo n.º 5
0
        public async Task ShowQuestionDialog(libVLCX.Dialog dialog, string title, string text, libVLCX.Question qType, string cancel, string action1, string action2)
        {
            if (qType == libVLCX.Question.warning)
            {
                dialog.postAction(1);
                return;
            }
            await VLCDialog.WaitForDialogLock();

            await DispatchHelper.InvokeInUIThread(Windows.UI.Core.CoreDispatcherPriority.Normal, async() =>
            {
                _currentDialog = new VLCDialog(title, text, dialog, qType, cancel, action1, action2);
                await _currentDialog.ShowAsync();
            });
        }
Exemplo n.º 6
0
        public static async Task DisplayDialog(string title, string desc, Dialog d, Question questionType, string cancel, string action1, string action2)
        {
            if (questionType == Question.warning)
            {
                d.postAction(1);
                return;
            }

            await DialogDisplaySemaphoreSlim.WaitAsync();

            try
            {
                var dialog = new VLCDialog();
                dialog.Closed += Dialog_Closed;
                dialog.Initialize(title, desc, d, questionType, cancel, action1, action2);
                await dialog.ShowAsync();
            }
            catch { }
        }
Exemplo n.º 7
0
        public Task Initialize(object o = null)
        {
            return(DispatchHelper.InvokeAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
            {
                var param = new List <string>
                {
                    "-I",
                    "dummy",
                    "--no-osd",
                    "--verbose=3",
                    "--no-stats",
                    "--avcodec-fast",
                    string.Format("--freetype-font={0}\\NotoSans-Regular.ttf", Windows.ApplicationModel.Package.Current.InstalledLocation.Path),
                    "--subsdec-encoding",
                    Locator.SettingsVM.SubtitleEncodingValue == "System" ? "" : Locator.SettingsVM.SubtitleEncodingValue,
                    "--aout=winstore",
                    string.Format("--keystore-file={0}\\keystore", ApplicationData.Current.LocalFolder.Path),
                };

                // So far, this NEEDS to be called from the main thread
                try
                {
                    Instance = new Instance(param, App.RootPage.SwapChainPanel);
                    Instance?.setDialogHandlers(
                        async(title, text) =>
                    {
                        await DispatchHelper.InvokeAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, async() =>
                        {
                            await VLCDialog.WaitForDialogLock();
                            CurrentDialog = new VLCDialog(title, text);
                            await CurrentDialog.ShowAsync();
                        });
                    },
                        async(dialog, title, text, defaultUserName, askToStore) =>
                    {
                        await DispatchHelper.InvokeAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, async() =>
                        {
                            await VLCDialog.WaitForDialogLock();
                            CurrentDialog = new VLCDialog(title, text, dialog, defaultUserName, askToStore);
                            await CurrentDialog.ShowAsync();
                        });
                    },

                        async(dialog, title, text, qType, cancel, action1, action2) =>
                    {
                        await DispatchHelper.InvokeAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, async() =>
                        {
                            if (qType == Question.warning)
                            {
                                dialog.postAction(1);
                                return;
                            }
                            await VLCDialog.WaitForDialogLock();
                            CurrentDialog = new VLCDialog(title, text, dialog, qType, cancel, action1, action2);
                            await CurrentDialog.ShowAsync();
                        });
                    },

                        (dialog, title, text, intermidiate, position, cancel) => { },
                        async(dialog) =>
                    {
                        await DispatchHelper.InvokeAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => CurrentDialog.Cancel());
                    },
                        (dialog, position, text) => { });

                    // Audio device management also needs to be called from the main thread
                    AudioClient = new AudioDeviceHandler(AudioDeviceID);
                    MediaDevice.DefaultAudioRenderDeviceChanged += onDefaultAudioRenderDeviceChanged;
                    PlayerInstanceReady.TrySetResult(Instance != null);
                }
                catch (Exception e)
                {
                    LogHelper.Log("VLC Service : Couldn't create VLC Instance\n" + StringsHelper.ExceptionToString(e));
                    ToastHelper.Basic(Strings.FailStartVLCEngine);
                }
            }));
        }