public ProviderSetViewModel(MangaInfo mangaInfo, IMangaIndex mangaIndex, SubscriptionViewModel.Factory factory)
        {
            _mangaIndex         = mangaIndex;
            SubscriptionFactory = factory;
            Name      = mangaInfo.Name;
            Providers = mangaInfo.Instances.Select(t => new ProviderData {
                Provider = t.provider, Url = t.url
            }).ToBindableCollection();
            MetaData = mangaInfo.MetaData;
            var providerData = this
                               .OnPropertyChanges(s => s.SelectedProvider).Do(_ => IsLoading          = true)
                               .SelectTask(a => GetProviderData(a.Provider, a.Url)).Do(_ => IsLoading = false)
                               .ObserveOnDispatcher();

            SelectedInstance =
                providerData
                .Select(vt => CreateInstanceViewModel(vt.coverUrl, new ChapterInstanceViewModel(vt.chapters)))
                .ToReactiveProperty();

            Test =
                providerData
                .Select(vt => CreateInstanceViewModel(vt.coverUrl, SubscriptionFactory((Name, SelectedProvider), vt.chapters)))
                .ToReactiveProperty();

            SelectedInstance
            .Subscribe(x => x?.ChapterInstanceViewModel.SelectedRows.Clear());
        }
Exemple #2
0
        private void OnPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            if (e.PropertyName == nameof(SelectedInstance))
            {
                ProfileList = null;
                if (SelectedInstance != null)
                {
                    new Thread(new ThreadStart(
                                   () =>
                    {
                        Wizard.Dispatcher.Invoke(DispatcherPriority.Normal, (Action)(() => Wizard.ChangeTaskCount(+1)));
                        try
                        {
                            // Get and load profile list.
                            var profile_list = SelectedInstance.GetProfileList(InstanceSource.GetAuthenticatingInstance(SelectedInstance), Window.Abort.Token);

                            // Send the loaded profile list back to the UI thread.
                            // We're not navigating to another page and OnActivate() will not be called to auto-reset error message. Therefore, reset it manually.
                            Wizard.Dispatcher.Invoke(DispatcherPriority.Normal, (Action)(
                                                         () =>
                            {
                                Wizard.Error = null;
                                ProfileList = profile_list;
                            }));
                        }
                        catch (OperationCanceledException) { }
                        catch (Exception ex) { Wizard.Dispatcher.Invoke(DispatcherPriority.Normal, (Action)(() => Wizard.Error = ex)); }
                        finally { Wizard.Dispatcher.Invoke(DispatcherPriority.Normal, (Action)(() => Wizard.ChangeTaskCount(-1))); }
                    })).Start();
                }
            }
        }
Exemple #3
0
        private void OnPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            if (e.PropertyName == nameof(SelectedInstance))
            {
                ProfileList = null;
                if (SelectedInstance != null)
                {
                    new Thread(new ThreadStart(
                                   () =>
                    {
                        Wizard.Dispatcher.Invoke(DispatcherPriority.Normal, (Action)(() => Wizard.ChangeTaskCount(+1)));
                        try
                        {
                            // Get and load profile list.
                            var profile_list = SelectedInstance.GetProfileList(InstanceSource.GetAuthenticatingInstance(SelectedInstance), Window.Abort.Token);

                            // Send the loaded profile list back to the UI thread.
                            Wizard.Dispatcher.Invoke(DispatcherPriority.Normal, (Action)(() => ProfileList = profile_list));
                        }
                        catch (OperationCanceledException) { }
                        catch (Exception ex) { Wizard.Dispatcher.Invoke(DispatcherPriority.Normal, (Action)(() => Wizard.Error = ex)); }
                        finally { Wizard.Dispatcher.Invoke(DispatcherPriority.Normal, (Action)(() => Wizard.ChangeTaskCount(-1))); }
                    })).Start();
                }
            }
        }
 public static void AppPoolStop()
 {
     if (SelectedInstance != null)
     {
         SelectedInstance.Stop();
         OnInstanceSelected();
     }
 }
 public static void AppPoolRecycle()
 {
     if (SelectedInstance != null)
     {
         SelectedInstance.Recycle();
         OnInstanceSelected();
     }
 }
Exemple #6
0
        public override async void Publish()
        {
            var project = _publishDialog.Project;

            try
            {
                ShellUtils.SaveAllFiles();

                GcpOutputWindow.Activate();
                GcpOutputWindow.Clear();
                GcpOutputWindow.OutputLine(String.Format(Resources.GcePublishStepStartMessage, project.Name));

                _publishDialog.FinishFlow();

                bool result;
                using (var frozen = StatusbarHelper.Freeze())
                    using (var animationShown = StatusbarHelper.ShowDeployAnimation())
                        using (var progress = StatusbarHelper.ShowProgressBar(String.Format(Resources.GcePublishProgressMessage, SelectedInstance.Name)))
                            using (var deployingOperation = ShellUtils.SetShellUIBusy())
                            {
                                result = await WindowsVmDeployment.PublishProjectAsync(
                                    project.FullPath,
                                    SelectedInstance,
                                    SelectedCredentials,
                                    progress,
                                    (l) => GcpOutputWindow.OutputLine(l));
                            }

                if (result)
                {
                    GcpOutputWindow.OutputLine(String.Format(Resources.GcePublishSuccessMessage, project.Name, SelectedInstance.Name));
                    StatusbarHelper.SetText(Resources.PublishSuccessStatusMessage);

                    var url = SelectedInstance.GetDestinationAppUri();
                    GcpOutputWindow.OutputLine(String.Format(Resources.PublishUrlMessage, url));
                    if (OpenWebsite)
                    {
                        Process.Start(url);
                    }
                }
                else
                {
                    GcpOutputWindow.OutputLine(String.Format(Resources.GcePublishFailedMessage, project.Name));
                    StatusbarHelper.SetText(Resources.PublishFailureStatusMessage);
                }
            }
            catch (Exception ex) when(!ErrorHandlerUtils.IsCriticalException(ex))
            {
                GcpOutputWindow.OutputLine(String.Format(Resources.GcePublishFailedMessage, project.Name));
                StatusbarHelper.SetText(Resources.PublishFailureStatusMessage);
            }
        }
Exemple #7
0
        public override async void Publish()
        {
            var project = _publishDialog.Project;

            try
            {
                ShellUtils.SaveAllFiles();

                GcpOutputWindow.Activate();
                GcpOutputWindow.Clear();
                GcpOutputWindow.OutputLine(String.Format(Resources.GcePublishStepStartMessage, project.Name));

                _publishDialog.FinishFlow();

                TimeSpan deploymentDuration;
                bool     result;
                using (var frozen = StatusbarHelper.Freeze())
                    using (var animationShown = StatusbarHelper.ShowDeployAnimation())
                        using (var progress = StatusbarHelper.ShowProgressBar(String.Format(Resources.GcePublishProgressMessage, SelectedInstance.Name)))
                            using (var deployingOperation = ShellUtils.SetShellUIBusy())
                            {
                                var startDeploymentTime = DateTime.Now;
                                result = await WindowsVmDeployment.PublishProjectAsync(
                                    project,
                                    SelectedInstance,
                                    SelectedCredentials,
                                    progress,
                                    VsVersionUtils.ToolsPathProvider,
                                    GcpOutputWindow.OutputLine);

                                deploymentDuration = DateTime.Now - startDeploymentTime;
                            }

                if (result)
                {
                    GcpOutputWindow.OutputLine(String.Format(Resources.GcePublishSuccessMessage, project.Name, SelectedInstance.Name));
                    StatusbarHelper.SetText(Resources.PublishSuccessStatusMessage);

                    var url = SelectedInstance.GetDestinationAppUri();
                    GcpOutputWindow.OutputLine(String.Format(Resources.PublishUrlMessage, url));
                    if (OpenWebsite)
                    {
                        Process.Start(url);
                    }

                    EventsReporterWrapper.ReportEvent(GceDeployedEvent.Create(CommandStatus.Success, deploymentDuration));
                }
                else
                {
                    GcpOutputWindow.OutputLine(String.Format(Resources.GcePublishFailedMessage, project.Name));
                    StatusbarHelper.SetText(Resources.PublishFailureStatusMessage);

                    EventsReporterWrapper.ReportEvent(GceDeployedEvent.Create(CommandStatus.Failure));
                }
            }
            catch (Exception ex) when(!ErrorHandlerUtils.IsCriticalException(ex))
            {
                GcpOutputWindow.OutputLine(String.Format(Resources.GcePublishFailedMessage, project.Name));
                StatusbarHelper.SetText(Resources.PublishFailureStatusMessage);

                EventsReporterWrapper.ReportEvent(GceDeployedEvent.Create(CommandStatus.Failure));
            }
        }