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


C# Controls.ProgressBar类代码示例

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


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

示例1: NFCConnection

 public NFCConnection(Dispatcher d, ProgressBar progress, TextBlock status)
 {
     //set the dispatcher and progress bar for updating the UI
     _d = d;
     _progress = progress;
     _txtStatus = status;
 }
开发者ID:WillVandergrift,项目名称:OneTone,代码行数:7,代码来源:NFCConnection.cs

示例2: OnApplyTemplate

        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();
            m_searchMenuViewListContainer = (FrameworkElement)GetTemplateChild("SearchMenuViewListContainer");
            m_list = (ListBox)GetTemplateChild("SearchMenuItemList");
            m_list.SelectionChanged += OnItemSelected;

            m_dragTabView = (Image)GetTemplateChild("SearchMenuDragTabView");

            m_dragTabClickHandler = new ControlClickHandler(m_dragTabView, OnDragTabMouseClick);

            m_dragTabView.MouseLeftButtonDown += OnDragTabMouseLeftButtonDown;
            m_dragTabView.MouseLeftButtonUp += OnDragTabMouseLeftButtonUp;

            m_closeButtonView = (Button)GetTemplateChild("SearchMenuCloseButton");
            m_closeButtonView.Click += CloseButtonClicked;

            m_progressSpinner = (ProgressBar)GetTemplateChild("SearchMenuSpinner");
            m_progressSpinner.Visibility = Visibility.Hidden;

            m_numResultsText = (TextBlock)GetTemplateChild("SearchMenuNumResultsText");
            m_numResultsText.Visibility = Visibility.Hidden;

            m_headerText = (TextBlock)GetTemplateChild("SearchMenuHeaderText");

            //m_headerCategoryImage = (Image)GetTemplateChild("SearchMenuHeaderCategoryIcon");

            PerformLayout(null, null);
        }
开发者ID:Krukobardacha,项目名称:mobile-example-app,代码行数:29,代码来源:SearchMenuView.cs

示例3: Game

        public List<Car> Game(ProgressBar pr1, ProgressBar pr2, ProgressBar pr3)
        {
            Console.WriteLine("ky");
            List<Car> cars = new List<Car>();

            StepDelegate stepDelegate1;
            StepDelegate stepDelegate2;
            StepDelegate stepDelegate3;

            cars.Add(new Car(225));
            cars.Add(new Car(225));
            cars.Add(new Car(210));

            stepDelegate1 = Steps;
            stepDelegate2 = Steps;
            stepDelegate3 = Steps;

            IAsyncResult result1 = stepDelegate1.BeginInvoke(cars[0], pr1, null, null);
            IAsyncResult result2 = stepDelegate2.BeginInvoke(cars[1], pr2, null, null);
            IAsyncResult result3 = stepDelegate3.BeginInvoke(cars[2], pr3, null, null);

            int _0 = stepDelegate1.EndInvoke(result1);
            int _1 = stepDelegate2.EndInvoke(result2);
            int _2 = stepDelegate3.EndInvoke(result3);

            Console.WriteLine(string.Format("{0} - {1} - {2}", _0, _1, _2));

            return cars;
        }
开发者ID:D-Moskalyov,项目名称:SP_Race,代码行数:29,代码来源:MainWindow.xaml.cs

示例4: openFiles

        private void openFiles(object sender, RoutedEventArgs e)
        {
            Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();

            dlg.DefaultExt = ".bdf";
            dlg.Multiselect = true;
            dlg.Filter = "BDF Files (*.bdf) | *.bdf";

            bool? result = dlg.ShowDialog();

            if (result.HasValue && result.Value)
            {
                if (openedFiles == null)
                    openedFiles = new List<BDFFile>();
                openedFiles.Clear();

                workerList.Clear();

                disableButtons();


                foreach (string fileName in dlg.FileNames)
                {
                    BDFFile newFile = new BDFFile();
                    openedFiles.Add(newFile);
                    ProgressBar progressBar = new ProgressBar();

                    progressBar.Width = Double.NaN;
                    //progressBar.Height = 25.0;

                    progressBar.Minimum = 0;

                    bindProgressBarWithBDFFile(progressBar, ProgressBar.MaximumProperty, "Size", newFile);
                    bindProgressBarWithBDFFile(progressBar, ProgressBar.ValueProperty, "Read", newFile);

                    BackgroundWorker bw = new BackgroundWorker();
                    workerList.Add(bw);
                    bw.DoWork += (obj, args) => 
                    {
                        App.Current.Dispatcher.Invoke(new ThreadStart(delegate { this.stackPanel.Children.Add(progressBar); }));
                        try
                        {
                            newFile.readFromFile(fileName);
                        }
                        catch (Exception ex)
                        {
                            //
                        }
                        App.Current.Dispatcher.Invoke(new ThreadStart(delegate { this.stackPanel.Children.Remove(progressBar); }));
                    };

                    bw.RunWorkerCompleted += (obj, args) => 
                    {
                        tryEnableButtons();
                    };
                    
                    bw.RunWorkerAsync();
                }
            }
        }
开发者ID:6aJIaJIae4HuK,项目名称:BDFPatcher,代码行数:60,代码来源:MainWindow.xaml.cs

示例5: CopyFiles

        public static async Task CopyFiles(string from, string to, ProgressBar bar, Label percent)
        {
            long total_size = new FileInfo(from).Length;

            using (var outStream = new FileStream(to, FileMode.Create, FileAccess.Write))
            {
                using (var inStream = new FileStream(from, FileMode.Open, FileAccess.Read))
                {
                    byte[] buffer = new byte[1024 * 1024];

                    long total_read = 0;

                    while (total_read < total_size)
                    {
                        int read = await inStream.ReadAsync(buffer, 0, buffer.Length);

                        await outStream.WriteAsync(buffer, 0, read);

                        total_read += read;

                        await System.Windows.Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action(() =>
                        {
                            long a = total_read * 100 / total_size;
                            bar.Value = a;
                            percent.Content = a + " %";
                        }));
                    }
                }
            }
        }
开发者ID:Deswing,项目名称:File-Manager,代码行数:30,代码来源:Copying.cs

示例6: DownloadPhoto

        public static async Task DownloadPhoto(PhotoItem photo, String path, ProgressBar ProgressBar)
        {
            try
            {
                if (path[path.Length - 1] != '\\')
                {
                    path = path + "\\";
                }
                var fileName = photo.UrlPhoto;
                if (fileName.Length > 40)
                {
                    fileName = fileName.Substring(0, 40);
                }
                fileName = fileName.Replace(":", "").Replace("\\", "").Replace("/", "").Replace("*", "").Replace("?", "").Replace("\"", "");
                using (var client = new WebClient())
                {

                    client.DownloadProgressChanged += (o, args) =>
                    {
                        ProgressBar.Value = args.ProgressPercentage;
                    };
                    client.DownloadFileCompleted += (o, args) =>
                    {
                        ProgressBar.Value = 0;
                    };
                    await client.DownloadFileTaskAsync(new Uri(photo.UrlPhoto), path + fileName + ".jpg");
                }
            }
            catch (Exception)
            {
            }
        }
开发者ID:Konahrik,项目名称:KYM,代码行数:32,代码来源:Photos.cs

示例7: DoublePlayer

        /// <summary>
        /// Initializes a new instance of the <see cref="DoublePlayer" /> class.
        /// </summary>
        /// <param name="player1">The player1.</param>
        /// <param name="progress1">The progress1.</param>
        /// <param name="remaining1">The remaining1.</param>
        /// <param name="p2">The p2.</param>
        /// <param name="progress2">The progress2.</param>
        /// <param name="remaining2">The remaining2.</param>
        public DoublePlayer(MediaElement player1, ProgressBar progress1, TextBlock remaining1, MediaElement p2, ProgressBar progress2, TextBlock remaining2)
        {
            _player1 = player1;
            _player1.MediaOpened += _player1_MediaOpened;
            _player1.LoadedBehavior = MediaState.Manual;
            _player1.UnloadedBehavior = MediaState.Stop;
            _player1.MediaEnded += _player1_MediaEnded;
            _progress1 = progress1;
            _remaining1 = remaining1;
            _player2 = p2;
            _player2.MediaOpened += _player2_MediaOpened;
            _player2.LoadedBehavior = MediaState.Manual;
            _player2.UnloadedBehavior = MediaState.Stop;
            _player2.MediaEnded += _player2_MediaEnded;
            _progress2 = progress2;
            _remaining2 = remaining2;

            // set the update timer for the progress bars
            _timerPlayer1.Interval = TimeSpan.FromMilliseconds(1000);
            _timerPlayer1.Tick += new EventHandler(TriggerUIRefresh);
            _timerPlayer1.Start();

            Active = _player1;
            InActive = _player2;
        }
开发者ID:Lords-Von-Handschreiber,项目名称:Juke-Mobile,代码行数:34,代码来源:DoublePlayer.cs

示例8: 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

示例9: DownloadAudio

        public static async Task DownloadAudio(AudioResponse composition, String path, ProgressBar ProgressBar)
        {
            try
            {
                if (path[path.Length - 1] != '\\')
                {
                    path = path + "\\";
                }
                var fileName = composition.Artist + " – " + composition.AudioTitle;
                if (fileName.Length > 40)
                {
                    fileName = fileName.Substring(0, 40);
                }
                fileName = fileName.Replace(":", "").Replace("\\", "").Replace("/", "").Replace("*", "").Replace("?", "").Replace("\"", "");
                using (var client = new WebClient())
                {

                    client.DownloadProgressChanged += (o, args) =>
                    {
                        ProgressBar.Value = args.ProgressPercentage;
                    };
                    client.DownloadFileCompleted += (o, args) =>
                    {
                        ProgressBar.Value = 0;
                    };
                    await client.DownloadFileTaskAsync(new Uri(composition.AudioUrl), path + fileName + ".mp3");
                }
            }
            catch (Exception)
            {
            }
        }
开发者ID:Konahrik,项目名称:KYM,代码行数:32,代码来源:Audio.cs

示例10: DajCzadu500

        public void DajCzadu500(string zapytanie, ProgressBar progBar, int numbeOfAddTerms, double termCoefficent)
        {
            progBar.Value = 0;
            Term[] previousZapytanie = PrzerobNaTermy(zapytanie);
            List<Term> newZaptanie = previousZapytanie.ToList<Term>();
            Dictionary<Term , List<CorelatedTerm>> corTerms= this.BuildMeMatrix();

            foreach (Term questione in previousZapytanie)
            {
                Term additionalTerm;
                //Term extra = corTerms[questione].First(); // ale urwał!!! ale nie sprawdziłem czy tak moze być a teraz już tak zostanie na zawsze:)!!!
                List<CorelatedTerm> corelated=null;
                var xxx = corTerms.FirstOrDefault(x => x.Key.TermStemming == questione.TermStemming); // ale urwal 500!!!
                if (xxx.Value == null)
                    continue;
                corelated = xxx.Value.ToList();  // ale urwał 5000!!!!
                do
                {
                    additionalTerm = corelated.First();
                    corelated.Remove(additionalTerm as CorelatedTerm);
                } while (additionalTerm != null && additionalTerm.TermStemming.Equals(questione.TermStemming));

                additionalTerm.TermCoefficent = termCoefficent; // wstaw wagę!!!
                newZaptanie.Add(additionalTerm);

                numbeOfAddTerms--;
                if (numbeOfAddTerms == 0) break;
            }

            this.DoStaff(newZaptanie.Distinct().ToArray(),progBar);
        }
开发者ID:vekkar,项目名称:rafal-flieger,代码行数:31,代码来源:Megawyszukiwacz.cs

示例11: MainPage

  /// Konstruktor
 public MainPage()
 {
     InitializeComponent();
     SetTextBoxToEmail(this.email);
     this.bar = new ProgressBar();
     bar.IsIndeterminate = true;
 }
开发者ID:JochenJankowai,项目名称:WP7-app-and-server,代码行数:8,代码来源:MainPage.xaml.cs

示例12: DajCzadu

        public void DajCzadu(string zapytanie, ProgressBar progBar)
        {
            progBar.Value = 0;
            Term[] termyZapytania = PrzerobNaTermy(zapytanie);

            this.DoStaff(termyZapytania, progBar);
        }
开发者ID:vekkar,项目名称:rafal-flieger,代码行数:7,代码来源:Megawyszukiwacz.cs

示例13: Start

 public static void Start(ProgressBar progbar, TextBlock progbarLabel)
 {
     progbar.Value = 0;
     progbarLabel.Text = "Processing Image: ";
     progbar.IsIndeterminate = false;
     progbar.Visibility = Visibility.Visible;
 }
开发者ID:jniehus,项目名称:ProcView,代码行数:7,代码来源:ProgressBarControl.cs

示例14: AWindow

        public AWindow(IWindow owner)
            : base(owner, Core.settings)
        {
            TabItem from_me = new TabItem();
            from_me.BeginInit();
            from_me.EndInit();
            this.Background = from_me.Background;
            ProgressBar from_color = new ProgressBar();
            default_progress_color = from_color.Foreground;

            // Taskbar progress setup
            TaskbarItemInfo = new TaskbarItemInfo();
            //            var uriSource = new Uri(System.IO.Path.Combine(Core.ExecutablePath, "masgau.ico"), UriKind.Relative);

            System.Drawing.Icon ico = Properties.Resources.MASGAUIcon;

            this.Icon = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(
                    ico.ToBitmap().GetHbitmap(),
                    IntPtr.Zero,
                    Int32Rect.Empty,
                    BitmapSizeOptions.FromEmptyOptions());

            if (owner != null) {
                this.Owner = owner as System.Windows.Window;
                this.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterOwner;
            } else {
                this.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
            }
        }
开发者ID:raven-ie,项目名称:MASGAU,代码行数:29,代码来源:AWindow.cs

示例15: activityStart

        // Display an inderminate progress indicator
        public void activityStart(string unused)
        {
            Deployment.Current.Dispatcher.BeginInvoke(() =>
            {
                PhoneApplicationFrame frame = Application.Current.RootVisual as PhoneApplicationFrame;
                if (frame != null)
                {
                    PhoneApplicationPage page = frame.Content as PhoneApplicationPage;

                    if (page != null)
                    {
                        Grid grid = page.FindName("LayoutRoot") as Grid;
                        if (grid != null)
                        {
                            if (progressBar != null)
                            {
                                grid.Children.Remove(progressBar);
                            }
                            progressBar = new ProgressBar();
                            progressBar.IsIndeterminate = true;
                            progressBar.IsEnabled = true;

                            grid.Children.Add(progressBar);
                        }
                    }
                }
            });
        }
开发者ID:benmonro,项目名称:phonegap-wp7,代码行数:29,代码来源:Notification.cs


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