Ejemplo n.º 1
0
        /// <summary>
        /// Helps to update the selected sample
        /// </summary>
        internal async static void UpdateSelectedSample()
        {
            if (viewModel == null || viewModel.SelectedProduct == null || viewModel.SelectedSample == null)
            {
                return;
            }
            int selectedSampleIndex  = viewModel.SelectedProduct.Demos.IndexOf(viewModel.SelectedSample);
            int selectedProductIndex = viewModel.ProductDemos.IndexOf(viewModel.SelectedProduct);
            var timer = new DispatcherTimer();

            timer.Tick    += DemoTimer_Tick;
            timer.Interval = TimeSpan.FromSeconds(6);
            foreach (DemoInfo demo in viewModel.SelectedProduct.Demos)
            {
                if (demo.ShowBusyIndicator)
                {
                    if (timer != null)
                    {
                        timer.Stop();
                        timer.Start();
                    }
                    isLiveDemo = true;
                    await timer.Dispatcher.BeginInvoke(new Action(() =>
                    {
                        viewModel.SelectedSample = demo;
                        isLiveDemo = false;
                    }), System.Windows.Threading.DispatcherPriority.ApplicationIdle);
                }
                else
                {
                    isLiveDemo = false;
                    viewModel.SelectedSample = demo;
                    ErrorLogging.LogLiveDemos(viewModel.SelectedProduct.Product + "\\" + demo.SampleName + "\\ShowBusyIndicator set as false. Ensure to set as true, if this demo is not running anything in background always.");
                    await Task.Delay(6000);
                }
                if (viewModel.SelectedProduct != null)
                {
                    if (viewModel.SelectedSample.DemoLauchMode == DemoLauchMode.Window)
                    {
                        LaunchDemo(demo);
                    }

                    if (selectedSampleIndex == viewModel.SelectedProduct.Demos.Count - 1)
                    {
                        UpdateSelectedProduct(viewModel, selectedProductIndex);
                    }
                    selectedSampleIndex++;
                }
                isLiveDemo = false;
                timer.Stop();
            }

            if (selectedProductIndex == viewModel.ProductDemos.Count - 1)
            {
                viewModel = null;
                Application.Current.Shutdown();
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Occurs when the showcase demos timer interval has elapsed.
 /// </summary>
 private static void ShowcaseDemoTimer_Tick(object sender, EventArgs e)
 {
     if (isLiveDemo)
     {
         CloseAllWindow();
         if (viewModel != null && viewModel.SelectedShowcaseSample != null)
         {
             ErrorLogging.LogLiveDemos("Showcase\\" + viewModel.SelectedShowcaseSample.SampleName + "\\Live Demos with BusyIndicator");
         }
         isLiveDemo = false;
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Occurs when the showcase demos timer interval has elapsed.
        /// </summary>
        private static void ShowcaseDemoTimer_Tick(object sender, EventArgs e)
        {
            if (viewModel == null || viewModel.SelectedShowcaseSample == null)
            {
                return;
            }

            if (isLiveDemo)
            {
                CloseAllWindow();
                ErrorLogging.LogLiveDemos("Showcase\\" + viewModel.SelectedShowcaseSample.SampleName + "\\Demo is not loaded after 60 secs also. Ensure to check and fix. This might be because after demo lauched application idle status not reached due to some other backgroud work in sample. Due to this busy indicator will get displayed always.");
                isLiveDemo = false;
            }
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Occurs when the tutorial demos timer interval has elapsed.
 /// </summary>
 private static void DemoTimer_Tick(object sender, EventArgs e)
 {
     if (isLiveDemo && viewModel != null)
     {
         int selectedSampleIndex = viewModel.SelectedProduct.Demos.IndexOf(viewModel.SelectedSample);
         if (viewModel.SelectedProduct.Demos.Count > selectedSampleIndex + 1)
         {
             viewModel.SelectedSample = viewModel.SelectedProduct.Demos[selectedSampleIndex + 1];
         }
         if (viewModel.SelectedProduct != null && viewModel.SelectedSample != null)
         {
             ErrorLogging.LogLiveDemos(viewModel.SelectedProduct.Product + "\\" + viewModel.SelectedSample.SampleName + "\\Live Demos with BusyIndicator");
         }
         isLiveDemo = false;
     }
 }
Ejemplo n.º 5
0
        /// <summary>
        /// Helps to launch show demos .
        /// </summary>
        private async static void LaunchShowCaseDemo()
        {
            if (viewModel == null)
            {
                return;
            }

            var timer = new DispatcherTimer();

            timer.Tick += ShowcaseDemoTimer_Tick;
            foreach (var demo in viewModel.ShowcaseDemos)
            {
                viewModel.SelectedShowcaseSample = demo;
                var showcasewindow = Activator.CreateInstance(demo.DemoViewType) as Window;
                showcasewindow.Show();
                if (demo.ShowBusyIndicator)
                {
                    if (timer != null)
                    {
                        timer.Stop();
                        timer.Start();
                    }
                    isLiveDemo     = true;
                    timer.Interval = TimeSpan.FromSeconds(6);
                    await timer.Dispatcher.BeginInvoke(new Action(() =>
                    {
                        isLiveDemo = false;
                        showcasewindow.Close();
                    }), System.Windows.Threading.DispatcherPriority.ApplicationIdle);
                }
                else
                {
                    await Task.Delay(6000);

                    ErrorLogging.LogLiveDemos("Showcase\\" + demo.SampleName + "\\ShowBusyIndicator set as false. Ensure to set as true, if this demo is not running anything in background always.");
                    showcasewindow.Close();
                }
                isLiveDemo = false;
                timer.Stop();
            }

            if (viewModel.ProductDemos.Count > 0)
            {
                viewModel.SelectedProduct = viewModel.ProductDemos[0];
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Occurs when the tutorial demos timer interval has elapsed.
        /// </summary>
        private static void DemoTimer_Tick(object sender, EventArgs e)
        {
            if (viewModel == null || viewModel.SelectedProduct == null || viewModel.SelectedSample == null)
            {
                return;
            }

            try
            {
                if (isLiveDemo)
                {
                    if (viewModel.SelectedSample.ShowBusyIndicator)
                    {
                        ErrorLogging.LogLiveDemos(viewModel.SelectedProduct.Product + "\\" + viewModel.SelectedSample.SampleName + "\\Demo is not loaded after 60 secs also. Ensure to check and fix. This might be because after demo lauched application idle status not reached due to some other backgroud work in sample. Due to this busy indicator will get displayed always.");
                    }
                    int selectedSampleIndex = viewModel.SelectedProduct.Demos.IndexOf(viewModel.SelectedSample);
                    int sampleindex         = selectedSampleIndex;
                    if (viewModel.SelectedProduct.Demos.Count > sampleindex + 1)
                    {
                        viewModel.SelectedSample = viewModel.SelectedProduct.Demos[selectedSampleIndex + 1];
                        if (viewModel.SelectedSample.DemoLauchMode == DemoLauchMode.Window)
                        {
                            LaunchDemo(viewModel.SelectedSample);
                        }
                    }

                    isLiveDemo = false;
                }
            }
            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);
                    }
                }
            }
        }
Ejemplo n.º 7
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);
                    }
                }
            }
        }
Ejemplo n.º 8
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();
            }
        }