Exemplo n.º 1
0
        /// <summary>
        /// Method helps to perform sample selection change operation.
        /// </summary>
        /// <param name="demoInfo">Selected Sample</param>
        private void OnSelectedSampleChanged(DemoInfo demoInfo)
        {
            if (demoInfo == null)
            {
                return;
            }

            if (demoInfo.ThemeMode != ThemeMode.Inherit)
            {
                IsThemeInheritMode = false;
            }
            else
            {
                IsThemeInheritMode = true;
            }

            if (demoInfo.ShowBusyIndicator)
            {
                IsProductDemoBusy = true;
            }

            var olddemo = DemosNavigationService.DemoNavigationService.Content as IDisposable;

            if (demoInfo.DemoLauchMode == DemoLauchMode.Window ||
                (SelectedProduct != null && SelectedProduct.DemoLauchMode == DemoLauchMode.Window))
            {
                var demoLauncherView = new DemoLauncherView(demoInfo.DemoViewType)
                {
                    DataContext = this
                };
                SfSkinManager.SetTheme(demoLauncherView, new Theme()
                {
                    ThemeName = SelectedThemeName
                });
                DemosNavigationService.DemoNavigationService.Navigate(demoLauncherView);
            }
            else
            {
                var demoControl = DemoLaucherExtension.LauchDemo <DemoControl>(this, demoInfo);
                if (demoControl != null && DemosNavigationService.DemoNavigationService != null)
                {
                    demoControl.Title       = demoInfo.SampleName;
                    demoControl.Description = demoInfo.Description;
                    DemosNavigationService.DemoNavigationService.Navigate(demoControl);
                }
            }

            if (olddemo != null)
            {
                olddemo.Dispose();
            }

            DemosNavigationService.MainWindow.Dispatcher.BeginInvoke(new Action(() =>
            {
                IsProductDemoBusy = false;
            }),
                                                                     System.Windows.Threading.DispatcherPriority.ApplicationIdle);
        }
Exemplo n.º 2
0
        protected override void Invoke(object parameter)
        {
            if (this.AssociatedObject == null)
            {
                return;
            }

            var viewmodel = this.AssociatedObject.DataContext as DemoBrowserViewModel;

            if (viewmodel == null)
            {
                return;
            }

            if ((viewmodel.SelectedProduct != null && viewmodel.SelectedProduct.DemoLauchMode == DemoLauchMode.Window) ||
                (viewmodel.SelectedSample != null && viewmodel.SelectedSample.DemoLauchMode == DemoLauchMode.Window))
            {
                try
                {
                    if (viewmodel.SelectedSample.ShowBusyIndicator)
                    {
                        viewmodel.IsProductDemoBusy = true;
                    }
                    var window = DemoLaucherExtension.LauchDemo <Window>(viewmodel, viewmodel.SelectedSample);
                    DemosNavigationService.MainWindow.Dispatcher.BeginInvoke(new Action(() =>
                    {
                        viewmodel.IsProductDemoBusy = false;
                    }),
                                                                             System.Windows.Threading.DispatcherPriority.ApplicationIdle);

                    if (window != null)
                    {
                        window.Title = viewmodel.SelectedSample.Title;
                        window.Owner = DemosNavigationService.MainWindow;
                        window.WindowStartupLocation = WindowStartupLocation.CenterScreen;
                        window.Closed += Window_Closed;
                        window.ShowDialog();
                    }
                }
                catch (Exception exception)
                {
                    viewmodel.IsProductDemoBusy = false;
                    ErrorWindow.Show(exception.Message + "\n" + exception.StackTrace);
                }
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Helps to launch window mode demos.
        /// </summary>
        private async static void LaunchDemo(DemoInfo demo)
        {
            if (viewModel == null || viewModel.SelectedProduct == null || viewModel.SelectedSample == null)
            {
                return;
            }

            try
            {
                var window = DemoLaucherExtension.LauchDemo <Window>(viewModel, demo);
                window.Show();
                if (demo.ShowBusyIndicator)
                {
                    await DemosNavigationService.MainWindow.Dispatcher.BeginInvoke(new Action(() =>
                    {
                        window.Close();
                    }), System.Windows.Threading.DispatcherPriority.ApplicationIdle);
                }
                else
                {
                    await Task.Delay(6000);

                    ErrorLogging.LogLiveDemos(viewModel.SelectedProduct.Product + "\\" + viewModel.SelectedSample.SampleName + "\\ShowBusyIndicator set as false. Ensure to set as true, if this demo is not running anything in background always.");
                    window.Close();
                }
            }
            catch (Exception exception)
            {
                if (viewModel != null)
                {
                    if (viewModel.SelectedProduct != null && viewModel.SelectedSample != null)
                    {
                        ErrorLogging.LogError("Product Sample\\" + viewModel.SelectedProduct.Product + "\\" + viewModel.SelectedSample.SampleName + "@@" + "Assembly location details missing in app.config file, Please contact Syncfusion support." + exception.Message + "\n" + exception.StackTrace + "\n" + exception.Source);
                    }
                    else if (viewModel.SelectedShowcaseSample != null)
                    {
                        ErrorLogging.LogError("Product ShowCase\\" + viewModel.SelectedShowcaseSample.SampleName + "\\" + viewModel.SelectedShowcaseSample.SampleName + "@@" + "Assembly location details missing in app.config file, Please contact Syncfusion support." + exception.Message + "\n" + exception.StackTrace + "\n" + exception.Source);
                    }
                }
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Helps to launch window mode demos.
        /// </summary>
        private async static void LaunchDemo(DemoInfo demo)
        {
            var window = DemoLaucherExtension.LauchDemo <Window>(viewModel, demo);

            window.Show();
            if (demo.ShowBusyIndicator)
            {
                await DemosNavigationService.MainWindow.Dispatcher.BeginInvoke(new Action(() =>
                {
                    window.Close();
                }), System.Windows.Threading.DispatcherPriority.ApplicationIdle);
            }
            else
            {
                await Task.Delay(4000);

                if (viewModel != null && viewModel.SelectedProduct != null && viewModel.SelectedSample != null)
                {
                    ErrorLogging.LogLiveDemos(viewModel.SelectedProduct.Product + "\\" + viewModel.SelectedSample.SampleName + "\\Live Demos");
                }
                window.Close();
            }
        }