当前位置: 首页>>代码示例>>C#>>正文


C# ProgressBar.BeginAnimation方法代码示例

本文整理汇总了C#中System.Windows.Controls.ProgressBar.BeginAnimation方法的典型用法代码示例。如果您正苦于以下问题:C# ProgressBar.BeginAnimation方法的具体用法?C# ProgressBar.BeginAnimation怎么用?C# ProgressBar.BeginAnimation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Controls.ProgressBar的用法示例。


在下文中一共展示了ProgressBar.BeginAnimation方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: MakeFive

        private void MakeFive(object sender, RoutedEventArgs e)
        {
            sbar.Items.Clear();
            TextBlock txtb = new TextBlock();
            txtb.Text = "ProgressBar";
            sbar.Items.Add(txtb);
            Button btn = new Button();
            btn.Height = 50;
            btn.Width = 50;
            Image image = new Image();
            BitmapImage bi = new BitmapImage();
            bi.BeginInit();
            bi.UriSource = new Uri(@"pack://application:,,,/data/cat.png");
            bi.EndInit();
            image.Source = bi;
            ImageBrush imagebrush = new ImageBrush(bi);
            btn.Background = imagebrush;

            ProgressBar progbar = new ProgressBar();
            progbar.Background = imagebrush;
            progbar.Width = 150;
            progbar.Height = 15;
            Duration duration = new Duration(TimeSpan.FromMilliseconds(2000));
            DoubleAnimation doubleanimation = new DoubleAnimation(100.0, duration);
            doubleanimation.RepeatBehavior = new RepeatBehavior(5);
            progbar.BeginAnimation(ProgressBar.ValueProperty, doubleanimation);
            btn.Content = progbar;
            sbar.Items.Add(btn);
         }
开发者ID:JianwenSun,项目名称:mono-soc-2007,代码行数:29,代码来源:Window1.xaml.cs

示例2: MakeOne

 private void MakeOne(object sender, RoutedEventArgs e)
 {
    sbar.Items.Clear();
    Button btn = new Button();
    btn.Background = new LinearGradientBrush(Colors.LightBlue, Colors.SlateBlue, 90);
    btn.Content = "Progress Bar";
    sbar.Items.Add(btn);
    ProgressBar progbar = new ProgressBar();
    progbar.IsIndeterminate = false;
    progbar.Orientation = Orientation.Horizontal;
    progbar.Width = 150;
    progbar.Height = 15;
    Duration duration = new Duration(TimeSpan.FromSeconds(10));
    DoubleAnimation doubleanimation = new DoubleAnimation(100.0, duration);
    progbar.BeginAnimation(ProgressBar.ValueProperty, doubleanimation);
    sbar.Items.Add(progbar);
   } 
开发者ID:JianwenSun,项目名称:mono-soc-2007,代码行数:17,代码来源:Window1.xaml.cs

示例3: MakeThree

 private void MakeThree(object sender, RoutedEventArgs e)
 {
   sbar.Items.Clear();
   Button btn = new Button();
   btn.Background = new LinearGradientBrush(Colors.Pink, Colors.Red, 90);
   btn.Content = "Progress Bar";
   sbar.Items.Add(btn);
   ProgressBar progbar = new ProgressBar();
   progbar.Background = Brushes.Gray;
   progbar.Foreground = Brushes.Red;
   progbar.Width = 150;
   progbar.Height = 15;
   Duration duration = new Duration(TimeSpan.FromMilliseconds(2000));
   DoubleAnimation doubleanimation = new DoubleAnimation(100.0, duration);
   doubleanimation.RepeatBehavior = new RepeatBehavior(3);
   progbar.BeginAnimation(ProgressBar.ValueProperty, doubleanimation);
   sbar.Items.Add(progbar);
 }
开发者ID:JianwenSun,项目名称:mono-soc-2007,代码行数:18,代码来源:Window1.xaml.cs

示例4: Delay

        void Delay(int before, int after, ProgressBar temp)
        {
            DoubleAnimation myDoubleAnimation = new DoubleAnimation();
            myDoubleAnimation.From = before;
            myDoubleAnimation.To = after;
            myDoubleAnimation.Duration =  new Duration(TimeSpan.FromSeconds(0.5));

            // Apply the animation to the button's Width property.
            temp.BeginAnimation(ProgressBar.ValueProperty, myDoubleAnimation);
        }
开发者ID:pizarosky,项目名称:AI_Othello,代码行数:10,代码来源:MainWindow.xaml.cs

示例5: MakeForever

 private void MakeForever(object sender, RoutedEventArgs e)
 {
   sbar.Items.Clear();
   Button btn = new Button();
   btn.Background = new LinearGradientBrush(Colors.LightBlue,        
                                            Colors.SlateBlue, 90);
   btn.Content = "Progress Bar - Forever";
   sbar.Items.Add(btn);
   ProgressBar progbar = new ProgressBar();
   progbar.Width = 150;
   progbar.Height = 15;
   Duration duration = new Duration(TimeSpan.FromSeconds(1));
   DoubleAnimation doubleanimation = new DoubleAnimation(100.0, duration);
   doubleanimation.RepeatBehavior = RepeatBehavior.Forever;
   progbar.BeginAnimation(ProgressBar.ValueProperty, doubleanimation);
   sbar.Items.Add(progbar);
  
 }
开发者ID:JianwenSun,项目名称:mono-soc-2007,代码行数:18,代码来源:Window1.xaml.cs

示例6: uploadBinary

        private void uploadBinary(string db, string executable)
        {
            haveBinId = false;

            WindowInteropHelper helper = new WindowInteropHelper(this);
            SubmissionWorker w = new SubmissionWorker(helper.Handle, workers.Count());
            w.DoWork += new DoWorkEventHandler(worker_DoWork);
            w.ProgressChanged += new ProgressChangedEventHandler(worker_ProgressChanged);
            w.RunWorkerCompleted += new RunWorkerCompletedEventHandler(worker_RunWorkerCompleted);
            w.WorkerReportsProgress = true;
            w.WorkerSupportsCancellation = false;

            RowDefinition row = new RowDefinition();
            outerGrid.RowDefinitions.Add(row);
            row.Height = new GridLength(26);
            Label l = new Label();
            l.Content = "Upload binary...";
            l.Height = 26;
            Grid.SetRow(l, outerGrid.RowDefinitions.Count() - 1);
            Grid.SetColumn(l, 0);
            outerGrid.Children.Add(l);

            ProgressBar p = new ProgressBar();
            p.Height = 26;
            p.Width = 75;
            Grid.SetRow(p, outerGrid.RowDefinitions.Count() - 1);
            Grid.SetColumn(p, 1);
            outerGrid.Children.Add(p);

            DoubleAnimation a = new DoubleAnimation(0.0, 100.0, new Duration(TimeSpan.FromSeconds(1)));
            a.RepeatBehavior = RepeatBehavior.Forever;
            a.AutoReverse = true;
            p.BeginAnimation(System.Windows.Controls.ProgressBar.ValueProperty, a);

            pbars.Add(w.id, p);
            Object[] args = { "Upload", db, executable };
            workers.Add(w.id, w);
            w.RunWorkerAsync(args);
        }
开发者ID:ExiaHan,项目名称:z3test,代码行数:39,代码来源:Submission.xaml.cs

示例7: ProcessTestPage

        private static void ProcessTestPage(TestPage testPage, ObservableCollection<TestResult> testResults, ProgressBar testingProgress)
        {
            try
            {
                // Create page load (async)
                CQ.CreateFromUrlAsync(testPage.URL, responseSuccess =>
                {
                    var testResult = new TestResult() { URL = testPage.URL };

                    // Fix "stream close"
                    var doc = responseSuccess.Dom;

                    foreach (var element in testPage.ElementList)
                    {
                        // Check if element is supported
                        if (_checkSupportedElements && !_supportedElements.Contains(element.Name.ToLowerInvariant()))
                        {
                            testResult.Cases.Add(new TestCase(element) { Unsupported = true });
                        }
                        else
                        {
                            // Select element
                            var foundElement = doc.Select(element.Name);
                            if (foundElement != null && foundElement.Contents().Any())
                            {
                                // Found, check if meets expected value
                                var currentValue = foundElement.Contents()[0].NodeValue.Trim();

                                // Compare current value to expected
                                // Note: Empty expected values are considered valid
                                if (string.IsNullOrEmpty(element.ExpectedValue) || currentValue.Equals(element.ExpectedValue))
                                {
                                    System.Diagnostics.Debug.WriteLine("Valid");
                                }
                                else
                                {
                                    System.Diagnostics.Debug.WriteLine("Invalid, expected {0} received {1}", currentValue, element.ExpectedValue);
                                    testResult.Cases.Add(new TestCase(element) { ActualValue = currentValue });
                                }
                            }
                        }
                    }

                    // Set test icons based on results
                    testResult.Icon = new TestResultIcon(
                        testResult.Cases.Any() ? TestResultIcon.TestResultState.FAIL : TestResultIcon.TestResultState.PASS
                        );

                    // Add results (invoke main ui thread)
                    System.Windows.Application.Current.Dispatcher.Invoke(() => {
                        testResults.Add(testResult);
                        DoubleAnimation doubleanimation = new DoubleAnimation(testingProgress.Value + 100, new Duration(TimeSpan.FromSeconds(1)));
                        testingProgress.BeginAnimation(System.Windows.Controls.Primitives.RangeBase.ValueProperty, doubleanimation);
                    });

                }, responseFail =>
                {
                    // TODO
                });
            }
            catch (UriFormatException)
            {
                System.Diagnostics.Debug.WriteLine("Invalid URL");
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine("Error: {0}", e.Message);
            }
        }
开发者ID:linosousa86,项目名称:Projects,代码行数:69,代码来源:TestPagesService.cs

示例8: ChangeValue

 public static void ChangeValue(double fromValue, double toValue, ProgressBar control)
 {
     DoubleAnimation da = new DoubleAnimation(fromValue, toValue, time);
     da.DecelerationRatio = acceleration;
     da.FillBehavior = FillBehavior.Stop;
     currentToValue = toValue;
     da.Completed += ValueChanged;
     control.BeginAnimation(ProgressBar.ValueProperty, da);
 }
开发者ID:Shoop123,项目名称:Reworder-C-Sharp,代码行数:9,代码来源:Modification.cs

示例9: setProgressBarValue

 void setProgressBarValue(ProgressBar progressBar, double value) {
     var duration = TimeSpan.FromMilliseconds(500);
     var animation = new DoubleAnimation(value, duration);
     progressBar.BeginAnimation(ProgressBar.ValueProperty, animation);
 }
开发者ID:coolinc,项目名称:XWall,代码行数:5,代码来源:GAEWizard.xaml.cs


注:本文中的System.Windows.Controls.ProgressBar.BeginAnimation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。