本文整理汇总了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;
}
示例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);
}
示例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;
}
示例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();
}
}
}
示例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 + " %";
}));
}
}
}
}
示例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)
{
}
}
示例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;
}
示例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);
}
示例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)
{
}
}
示例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);
}
示例11: MainPage
/// Konstruktor
public MainPage()
{
InitializeComponent();
SetTextBoxToEmail(this.email);
this.bar = new ProgressBar();
bar.IsIndeterminate = true;
}
示例12: DajCzadu
public void DajCzadu(string zapytanie, ProgressBar progBar)
{
progBar.Value = 0;
Term[] termyZapytania = PrzerobNaTermy(zapytanie);
this.DoStaff(termyZapytania, progBar);
}
示例13: Start
public static void Start(ProgressBar progbar, TextBlock progbarLabel)
{
progbar.Value = 0;
progbarLabel.Text = "Processing Image: ";
progbar.IsIndeterminate = false;
progbar.Visibility = Visibility.Visible;
}
示例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;
}
}
示例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);
}
}
}
});
}