本文整理汇总了C#中ProgressBar类的典型用法代码示例。如果您正苦于以下问题:C# ProgressBar类的具体用法?C# ProgressBar怎么用?C# ProgressBar使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ProgressBar类属于命名空间,在下文中一共展示了ProgressBar类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ProgressDialog
public ProgressDialog (string title, CancelButtonType cancel_button_type, int total_count, Gtk.Window parent_window)
{
Title = title;
this.total_count = total_count;
if (parent_window != null)
this.TransientFor = parent_window;
HasSeparator = false;
BorderWidth = 6;
SetDefaultSize (300, -1);
message_label = new Label (String.Empty);
VBox.PackStart (message_label, true, true, 12);
progress_bar = new ProgressBar ();
VBox.PackStart (progress_bar, true, true, 6);
switch (cancel_button_type) {
case CancelButtonType.Cancel:
button = (Gtk.Button)AddButton (Gtk.Stock.Cancel, (int) ResponseType.Cancel);
break;
case CancelButtonType.Stop:
button = (Gtk.Button)AddButton (Gtk.Stock.Stop, (int) ResponseType.Cancel);
break;
}
Response += new ResponseHandler (HandleResponse);
}
示例2: Start
void Start()
{
timer = FindObjectOfType(typeof(ProgressBar)) as ProgressBar;
if (timer == null)
Debug.LogError ("No Timer, dude");
}
示例3: onCreate
protected internal override void onCreate(Bundle savedInstanceState)
{
base.onCreate(savedInstanceState);
ContentView = R.layout.uploader;
mTargetDevicePicker = (DevicePicker) FragmentManager.findFragmentById(R.id.targetPicker);
mTargetDevicePicker.DeviceType = SmcDevice.TYPE_PROVIDER;
mTargetDevicePicker.DeviceSelectedListener = this;
mUploadButton = (Button) findViewById(R.id.button);
mUploadButton.OnClickListener = uploadClickListener;
progressBar = (ProgressBar) findViewById(R.id.progress);
SmcItem.LocalContent content = LocalContent;
if (content == null)
{
Toast.makeText(this, "Content not supported", Toast.LENGTH_SHORT).show();
this.finish();
}
else
{
itemToUpload = new SmcItem(content);
((TextView)findViewById(R.id.header)).Text = "File: " + itemToUpload.Uri.ToString();
}
}
示例4: Main
private static void Main(string[] args)
{
Console.WriteLine("Performing some task... ");
using (var progress = new ProgressBar<SimpleProgressInfo>())
using (new DoubleProgressAdapter(progress, "1"))
using (ProgressScope.Start("1", 0, 1, "Starting"))
{
Thread.Sleep(1000);
ProgressScope.Report(0.1, "One");
Thread.Sleep(1000);
ProgressScope.Report(0.2);
Thread.Sleep(1000);
using (ProgressScope.Start("2", 0.3, 0.45))
{
Thread.Sleep(1000);
ProgressScope.Report(0.33);
Thread.Sleep(1000);
ProgressScope.Report(0.66, "tu");
Thread.Sleep(1000);
}
Thread.Sleep(1000);
ProgressScope.Report(0.6, "Almost");
Thread.Sleep(1000);
ProgressScope.Report(0.8);
Thread.Sleep(1000);
}
Console.WriteLine("Done.");
Console.ReadKey();
}
示例5: OnCreate
protected override void OnCreate(Bundle bundle)
{
base.OnCreate (bundle);
SetContentView (Resource.Layout.SearchActivity);
searchViewModel = new SearchViewModel (Android.Application.Service, new Search ("Default")) {
GroupByLastName = false,
};
searchViewModel.SearchCompleted += HandleSearchCompleted;
progressBar = FindViewById<ProgressBar> (Resource.Id.progressBar1);
searchingText = FindViewById<TextView> (Resource.Id.emptyTextView);
ListAdapter = new PeopleGroupsAdapter () {
ItemsSource = searchViewModel.Groups,
};
// Start the search
var intent = Intent;
if (!Intent.ActionSearch.Equals (intent.Action))
return;
searchViewModel.SearchText = intent.GetStringExtra (SearchManager.Query);
searchViewModel.SearchProperty = SearchProperty.All;
searchViewModel.Search ();
}
示例6: AddSpinner
public void AddSpinner(ViewGroup rootview,string loadingtext)
{
loading = true;
if(loadingcontainer==null||(loadingcontainer!=null&&!loadingcontainer.IsShown)){
loadingcontainer = new RelativeLayout (nn_activity);
loadingcontainer.LayoutParameters = new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.MatchParent, RelativeLayout.LayoutParams.MatchParent);
loadingcontainer.SetBackgroundColor (Color.White);
var detailcontainer = new LinearLayout (nn_activity);
detailcontainer.Orientation = Orientation.Vertical;
RelativeLayout.LayoutParams param = new RelativeLayout.LayoutParams ((int)TapUtil.dptodx (100), RelativeLayout.LayoutParams.WrapContent);
param.AddRule (LayoutRules.CenterInParent);
detailcontainer.LayoutParameters = param;
LinearLayout.LayoutParams linearlayoutparm = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.WrapContent);
linearlayoutparm.Gravity = GravityFlags.CenterHorizontal;
ProgressBar progressbar = new ProgressBar (nn_activity);
progressbar.LayoutParameters = linearlayoutparm;
TextView tectview = new TextView (nn_activity);
tectview.LayoutParameters = linearlayoutparm;
tectview.Text = loadingtext;
tectview.Gravity = GravityFlags.CenterHorizontal;
detailcontainer.AddView (progressbar);
detailcontainer.AddView (tectview);
loadingcontainer.AddView (detailcontainer);
rootview.AddView (loadingcontainer);
}
}
示例7: OnCreate
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
var login = FindViewById<Button>(Resource.Id.login);
AuthenticationHelper.PlatformParameters = new PlatformParameters(this);
progressBar = FindViewById<ProgressBar>(Resource.Id.progressBar);
progressBar.Indeterminate = true;
progressBar.Visibility = ViewStates.Invisible;
login.Click += async (sender, args) =>
{
login.Enabled = false;
progressBar.Visibility = ViewStates.Visible;
var client = await AuthenticationHelper.GetCalendarClient();
progressBar.Visibility = ViewStates.Invisible;
login.Enabled = true;
if (client == null)
{
Toast.MakeText(this, "Login failed", ToastLength.Long).Show();
return;
}
StartActivity(typeof(MainActivity));
Finish();
};
if(Settings.TenantId != "common")
{
StartActivity(typeof(MainActivity));
Finish();
}
}
示例8: OnCreateView
public override View OnCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
// Use this to return your custom view for this Fragment
// return inflater.Inflate(Resource.Layout.YourFragment, container, false);
var rootView = inflater.Inflate(Resource.Layout.Settings, container, false);
cbNLT = rootView.FindViewById<CheckBox> (Resource.Id.ckboxRemindLT);
cbUpdate=rootView.FindViewById<CheckBox> (Resource.Id.ckboxAutoUpdateData);
btupdateData=rootView.FindViewById<Button> (Resource.Id.btUpdateData);
progressup=rootView.FindViewById<ProgressBar> (Resource.Id.proUpdateData);
txtResult = rootView.FindViewById<TextView> (Resource.Id.txtresult);
progressNL=rootView.FindViewById<ProgressBar> (Resource.Id.proNL);
//About
TextView txtVersion = rootView.FindViewById<TextView> (Resource.Id.txtVersion_Set);
txtVersion.Click += TxtVersion_Click;
Bundle bundle=this.Arguments;
bool check = bundle.GetBoolean ("Remind");
autoupdate = bundle.GetBoolean ("AutoUpdateData");
cbUpdate.Checked = autoupdate;
cbNLT.Checked = check;
btupdateData.Click+= BtupdateData_Click;
cbNLT.CheckedChange += CbNLT_CheckedChange;
cbUpdate.CheckedChange+= CbUpdate_CheckedChange;
if (cbUpdate.Checked) {
btupdateData.SetBackgroundResource (Android.Resource.Color.DarkerGray);
}
else
{
btupdateData.SetBackgroundResource (Android.Resource.Color.HoloBlueDark);
}
btupdateData.Enabled = !cbUpdate.Checked;
return rootView;
}
示例9: OnCreate
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
SetContentView(Resource.Layout.Main);
var client = new GitHubOrganisationEventClient();
// Alternative: Globale Events statt Organisation events anzeigen
// var client = new GitHubGlobalEventClient();
var service = new GitHubEventService(client);
var browserTask = new AndroidBrowserTask(this);
_viewModel = new GitHubEventListViewModel(service, browserTask);
_adapter = new GitHubEventListAdapter(this, _viewModel);
Button button = FindViewById<Button>(Resource.Id.main_button_refresh);
Button buttonWebsite = FindViewById<Button>(Resource.Id.main_button_website);
ListView listView = FindViewById<ListView>(Resource.Id.main_listview);
_progressBar = FindViewById<ProgressBar>(Resource.Id.main_progressBar);
button.Click += Button_Click;
buttonWebsite.Click += (o, e) => { _viewModel.GoToGithubDotCom(); };
listView.Adapter = _adapter;
_viewModel.PropertyChanged += viewModel_PropertyChanged;
UpdateViews(String.Empty);
}
示例10: OnCreate
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
/* Layout attributen toewijzen aan code */
SetContentView(Resource.Layout.Main);
mBtnLogin = FindViewById<Button>(Resource.Id.btn_login);
mBtnRegistreer = FindViewById<Button>(Resource.Id.btn_registreer);
mProgressbar = FindViewById<ProgressBar>(Resource.Id.progressBar1);
/* Click events */
mBtnLogin.Click += (object sender, EventArgs args) =>
{
FragmentTransaction transaction = FragmentManager.BeginTransaction();
Dialog_inloggen inlogdialog = new Dialog_inloggen();
inlogdialog.Show(transaction, "dialog fragment");
inlogdialog.logincompleet += Inlogdialog_logincompleet;
};
mBtnRegistreer.Click += (object sender, EventArgs args) => //Click methode in zelfde methode
{
// dialog weergeven
FragmentTransaction transaction = FragmentManager.BeginTransaction();
Dialog_registreer regdialog = new Dialog_registreer();
regdialog.Show(transaction, "dialog fragment");
regdialog.registreerCompleet += Regdialog_registreerCompleet;
};
}
示例11: OnCreate
protected override void OnCreate(Bundle bundle)
{
base.OnCreate (bundle);
RequestWindowFeature (WindowFeatures.ActionBarOverlay);
ActionBar.SetBackgroundDrawable (new ColorDrawable (Color.Transparent));
SetContentView (Resource.Layout.Main);
var list = FindViewById<OverscrollListView> (Resource.Id.listView1);
loadingBars = FindViewById<LinearLayout> (Resource.Id.loadingBars);
bar1 = FindViewById<ProgressBar> (Resource.Id.loadingBar1);
bar2 = FindViewById<ProgressBar> (Resource.Id.loadingBar2);
swipeText = FindViewById<TextView> (Resource.Id.swipeToRefreshText);
// Remove progress bar background
foreach (var p in new[] { bar1, bar2 }) {
var layer = p.ProgressDrawable as LayerDrawable;
if (layer != null)
layer.SetDrawableByLayerId (Android.Resource.Id.Background,
new ColorDrawable (Color.Transparent));
}
list.OverScrolled += deltaY => {
ShowSwipeDown ();
accumulatedDeltaY += -deltaY;
bar1.Progress = bar2.Progress = accumulatedDeltaY;
if (accumulatedDeltaY == 0)
HideSwipeDown ();
};
list.OverScrollCanceled += HideSwipeDown;
}
示例12: OnCreateView
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
base.OnCreateView (inflater, container, savedInstanceState);
var view = inflater.Inflate (Resource.Layout.Tab1, container, false);
var list = view.FindViewById<OverscrollListView> (Resource.Id.listView1);
loadingBars = view.FindViewById<LinearLayout> (Resource.Id.loadingBars);
bar1 = view.FindViewById<ProgressBar> (Resource.Id.loadingBar1);
bar2 = view.FindViewById<ProgressBar> (Resource.Id.loadingBar2);
swipeText = view.FindViewById<TextView> (Resource.Id.swipeToRefreshText);
fakeActionBar = view.FindViewById<FrameLayout> (Resource.Id.fakeActionBar);
// Remove progress bar background
foreach (var p in new[] { bar1, bar2 }) {
var layer = p.ProgressDrawable as LayerDrawable;
if (layer != null)
layer.SetDrawableByLayerId (Android.Resource.Id.Background,
new ColorDrawable (Color.Transparent));
}
list.OverScrolled += deltaY => {
ShowSwipeDown ();
accumulatedDeltaY += -deltaY;
bar1.Progress = bar2.Progress = accumulatedDeltaY;
if (accumulatedDeltaY == 0)
HideSwipeDown ();
};
list.OverScrollCanceled += HideSwipeDown;
return view;
}
示例13: Start
void Start()
{
ingredients = GameObject.FindGameObjectsWithTag("Ingredient");
pie = GameObject.FindObjectOfType<Pie>().GetComponent<Pie>();
progressBar = GameObject.FindObjectOfType<ProgressBar>().GetComponent<ProgressBar>();
gameController = GameObject.FindObjectOfType<GameController>().GetComponent<GameController>();
}
示例14: BindDataToView
public void BindDataToView(Post post, bool setHeight = false, ProgressBar progressBar = null, Action callBack = null)
{
Setup();
Clickable = false;
ImageService.Instance.LoadUrl(StringUtils.GetPostImageURL(post))
.Retry(3, 200)
.DownSample((Width == 0) ? TabHostActivity.GetTabHost().ScreenWidth : Width, 0)
.FadeAnimation(true)
.TransparencyChannel(false)
.Transform(new RoundedTransformation(20, 0, 0))
.Success((FFImageLoading.Work.ImageInformation arg1, FFImageLoading.Work.LoadingResult arg2) =>
{
if (progressBar != null)
{
progressBar.Visibility = ViewStates.Gone;
}
if (setHeight)
{
if (arg1.OriginalHeight > Width)
{
LayoutParameters.Height = (int)((float)arg1.OriginalHeight / (float)arg1.OriginalWidth * (float)((Width == 0) ? TabHostActivity.GetTabHost().ScreenWidth - 20 : Width));
}
else {
LayoutParameters.Height = (int)arg1.OriginalHeight;
}
RequestLayout();
if (callBack != null)
{
callBack();
}
}
})
.Into(this);
}
示例15: OnCreate
protected async override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
// Set our view from the "main" layout resource
SetContentView(Resource.Layout.view_expenses);
progressBar = FindViewById<ProgressBar>(Resource.Id.progressBar);
viewModel = ServiceContainer.Resolve<ExpensesViewModel>();
viewModel.IsBusyChanged = (busy) =>
{
progressBar.Visibility = busy ? ViewStates.Visible : ViewStates.Gone;
};
ListAdapter = new ExpenseAdapter(this, viewModel);
ListView.ItemLongClick += async (sender, args) =>
{
await viewModel.ExecuteDeleteExpenseCommand(viewModel.Expenses[args.Position]);
RunOnUiThread(() => ((ExpenseAdapter)ListAdapter).NotifyDataSetChanged());
};
if (!viewModel.IsSynced)
{
await Authenticate();
await viewModel.ExecuteSyncExpensesCommand();
RunOnUiThread(() => ((ExpenseAdapter)ListAdapter).NotifyDataSetChanged());
}
}