public ProgressBarDemoPage() { Label header = new Label { Text = "ProgressBar", Font = Font.BoldSystemFontOfSize(50), HorizontalOptions = LayoutOptions.Center }; progressBar = new ProgressBar { VerticalOptions = LayoutOptions.CenterAndExpand }; // Accomodate iPhone status bar. this.Padding = new Thickness(10, Device.OnPlatform(20, 0, 0), 10, 5); // Build the page. this.Content = new StackLayout { Children = { header, progressBar } }; }
public ProgressBarDemoPage() { Label header = new Label { Text = "ProgressBar", FontSize = 50, FontAttributes = FontAttributes.Bold, HorizontalOptions = LayoutOptions.Center }; progressBar = new ProgressBar { VerticalOptions = LayoutOptions.CenterAndExpand }; // Build the page. this.Content = new StackLayout { Children = { header, progressBar } }; }
Controls SetControls(ProgressBar progressBar) { return new Controls { LblUsersCount = lblUsersCount, MessageStackLayout = msgStackLayot, MsgScrollView = msgScrollView, ProgressBar = progressBar, TxtMessage = phoneNumberText }; }
public SyllableCard (string kana,TestPage root,int index) { progressLabel = new Label{Text=" ",TextColor=Color.Gray,XAlign=TextAlignment.Center}; Title = Character.getCategory(kana)+" Reading"; mCharacter = kana; mRoot = root; Grid grid = new Grid { HorizontalOptions=LayoutOptions.Fill, VerticalOptions = LayoutOptions.FillAndExpand, RowDefinitions = { new RowDefinition {Height = GridLength.Auto}, new RowDefinition {Height = new GridLength(1, GridUnitType.Star)}, new RowDefinition {Height = GridLength.Auto}, } }; progressBar = new ProgressBar { Progress=0 }; //Setting the progress\ //double progress = (double)(mRoot.drillList.LastIndexOf/(double)mRoot.drillList.Count); double progress=0; if(root.GetType()==typeof(TestPage)) { progress = (double)(index/(double)StudyCard.initDrillCount); progressLabel.Text=index.ToString()+"/"+StudyCard.initDrillCount; progressBar.ProgressTo (progress, 10, Easing.Linear); } StackLayout layout = new StackLayout () { Orientation=StackOrientation.Vertical, Children = { progressLabel, progressBar } }; //Adding children to grid grid.Children.Add (layout,0,2); Button backButton = new Button{ Text = "→", HorizontalOptions= LayoutOptions.End, FontSize = 50 }; grid.Children.Add(backButton,0,0); grid.Children.Add (new Label { Text = kana.Replace('/','\n'), VerticalOptions = LayoutOptions.Center, XAlign=TextAlignment.Center, YAlign=TextAlignment.Center, FontSize = 100-15*kana.Split('/')[0].Length }, 0,1,0, 2); grid.Padding = new Thickness (10, Device.OnPlatform (10, 0, 0), 10, 10); Content = grid; backButton.Clicked+= BackButton_Clicked; }
public SyncProgressContentView() { _progressbar = new ProgressBar(); _progressLabel = new Label(); Content = new StackLayout { Children = { _progressLabel, _progressbar, } }; }
public MessageView(ProgressBar progressBar) { InitializeComponent(); CustomInitial(); Controls controls = SetControls(progressBar); Device.BeginInvokeOnMainThread(() => { progressBar.ProgressTo(.5, 250, Easing.Linear); }); hubInitializer = new HubInitializer(controls); hubInitializer.HubInitial(); }
private static void ChangeProgressBarColor(int state, Xamarin.Forms.ProgressBar progressBar) { if (state < 40) { progressBar.ProgressColor = Color.Red; } else if (state < 70) { progressBar.ProgressColor = Color.Yellow; } else { progressBar.ProgressColor = Color.Green; } }
private void UpdateProgressBar(ProgressBar progressBar, float progressTo) { Device.BeginInvokeOnMainThread (() => { progressBar.ProgressTo(progressTo,250,Easing.Linear); }); }
void LoginButtonClicked(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace (userCodeEntry.Text) || string.IsNullOrWhiteSpace (userIdEntry.Text)) { ShowErrorAlert ("User Id and Code are required"); return; } Spinner.IsRunning = true; userIdEntry.IsEnabled = false; userCodeEntry.IsEnabled = false; loginButton.IsEnabled = false; Phoenix.Application.UserManager.Save (this.UserId, this.UserCode, (user) => { Phoenix.Application.UserLoggedIn(user); Xamarin.Insights.Identify(UserId.ToString(),new Dictionary<string, string>{ {"Version",App.Version} }); if(Phoenix.Application.GameStatusManager.Count() < 1){ // fresh setup StackLayout layout = (StackLayout) Content; ProgressBar progressBar = new ProgressBar{ Progress = 0f }; layout.Children.Add(progressBar); header.Text = "Setting Up. Please be patient."; UpdateStatusMessage("Fetching game status"); Phoenix.Application.GameStatusManager.Fetch ((results, ex) => { if(ex == null){ UpdateStatusMessage("Fetched game status. Now fetching info."); UpdateProgressBar(progressBar, 0.14f); Phoenix.Application.InfoManager.Fetch((infoResults, ex2) => { if(ex2 == null){ UpdateStatusMessage("Fetched info data. Now fetching star systems."); UpdateProgressBar(progressBar, 0.28f); Phoenix.Application.StarSystemManager.Fetch((systemResults, ex3) => { if(ex3 == null){ UpdateStatusMessage("Fetched star systems. Now fetching order types."); UpdateProgressBar(progressBar, 0.42f); Phoenix.Application.OrderTypeManager.Fetch((orderTypeResults, ex4) => { if(ex4 == null){ UpdateStatusMessage("Fetched order types. Now fetching items"); UpdateProgressBar(progressBar, 0.56f); Phoenix.Application.ItemManager.Fetch((itemResults, ex5) => { if(ex5 == null){ UpdateStatusMessage("Fetched items. Now fetching positions."); UpdateProgressBar(progressBar, 0.70f); Phoenix.Application.PositionManager.Fetch((positionResults, ex6) => { if(ex6 == null){ UpdateStatusMessage("Fetched positions. Now fetching notifications."); UpdateProgressBar(progressBar, 0.84f); Phoenix.Application.NotificationManager.Fetch((notificationResults, ex7) => { if(ex7 == null){ ShowHomePage(); } else { UpdateProgressBar(progressBar, 1.0f); ShowErrorAndThenHome(ex6); } }); } else { } }); } else { ShowErrorAndThenHome(ex5); } }); } else { ShowErrorAndThenHome(ex4); } }); } else { ShowErrorAndThenHome(ex3); } }); } else { ShowErrorAndThenHome(ex2); } }); } else { ShowErrorAndThenHome(ex); } }); } else { ShowHomePage(); } }); }
public IEnumerable<ViewSample> BuildSamples() { var activityIndicator = new ActivityIndicator { IsEnabled = true, IsRunning = true }; var boxView = new BoxView { Color = Color.Red }; var button = new Button { Text = "Click Me" }; var buttonLabel = new Label { Text = "" }; button.Clicked += (sender, e) => { buttonLabel.Text = "I've been clicked!"; }; var buttonStack = new StackLayout { Children = { button, buttonLabel } }; var datePicker = new DatePicker (); var editor = new Editor { Text = "You can edit multiple lines of text here!" }; var entry = new Entry { Placeholder = "Enter a single line of text" }; var image = new Image { Source = ImageSource.FromUri(new Uri("http://placehold.it/350x150")) }; var label = new Label { Text = "Hello, I'm a label!" }; var picker = new Picker (); picker.Items.Add ("Red"); picker.Items.Add ("Green"); picker.Items.Add ("Purple"); picker.Items.Add ("Grey"); picker.Items.Add ("Black"); var progressBar = new ProgressBar { Progress = 0 }; var progressButton = new Button { Text = "Start Progressing" }; progressButton.Clicked += async (sender, e) => { await progressBar.ProgressTo(1.0, 500, Easing.Linear); }; var progressStack = new StackLayout { Children = { progressBar, progressButton } }; var searchBar = new SearchBar (); var slider = new Slider (); var stepper = new Stepper (); var @switch = new Switch (); var timePicker = new TimePicker (); var webView = new WebView { Source = new UrlWebViewSource { Url = "https://tutsplus.com/" }, VerticalOptions = LayoutOptions.FillAndExpand }; return new List<ViewSample> { new ViewSample { Name = "ActivityIndicator", View = activityIndicator }, new ViewSample { Name = "BoxView", View = boxView }, new ViewSample { Name = "Button", View = buttonStack }, new ViewSample { Name = "DatePicker", View = datePicker }, new ViewSample { Name = "Editor", View = editor }, new ViewSample { Name = "Entry", View = entry }, new ViewSample { Name = "Image", View = image }, new ViewSample { Name = "Label", View = label }, new ViewSample { Name = "Picker", View = picker }, new ViewSample { Name = "ProgressBar", View = progressStack }, new ViewSample { Name = "SearchBar", View = searchBar }, new ViewSample { Name = "Slider", View = slider }, new ViewSample { Name = "Stepper", View = stepper }, new ViewSample { Name = "Switch", View = @switch }, new ViewSample { Name = "TimePicker", View = timePicker }, new ViewSample { Name = "WebView", View = webView } }; }
public FillBlanks (int index) { currentIndex = index; Title = "Fill in the blanks"; NavigationPage.SetBackButtonTitle (this, "Table"); string rowData; string disData; rowData = FillData.hData [TestPage.fillList[index]]; string search_character = rowData.Split ('\t') [2].Split('\n')[0]; disData = FillData.distractors [FillData.searchDistractor(search_character)]; int arrowSize; if (Device.Idiom == TargetIdiom.Tablet) arrowSize = 40; else arrowSize = 30; itemNext = new Button { Text="→", FontSize=arrowSize, Command = new Command (() => nextScreen()), }; itemNext.IsVisible = false; stimulus=new string[]{rowData.Split('\t')[5],rowData.Split('\t')[8],rowData.Split('\t')[11]}; answerData=new string[]{rowData.Split('\t')[4],rowData.Split('\t')[7],rowData.Split('\t')[10]}; romajiData=new string[]{rowData.Split('\t')[4],rowData.Split('\t')[7],rowData.Split('\t')[10]}; english=new string[]{rowData.Split('\t')[6],rowData.Split('\t')[9],rowData.Split('\t')[12]}; correct = rowData.Split ('\t') [2].Split('\n')[0]; distractors = new string[8]; for (int i = 1; i < 9; i++) distractors [i - 1] = disData.Split ('\t') [i]; grid = new Grid { HorizontalOptions=LayoutOptions.Fill, VerticalOptions = LayoutOptions.Fill, RowDefinitions = { new RowDefinition {Height = new GridLength(2, GridUnitType.Star)}, new RowDefinition {Height = new GridLength(1, GridUnitType.Star)}, new RowDefinition {Height = new GridLength(2, GridUnitType.Star)}, new RowDefinition {Height = new GridLength(1, GridUnitType.Star)}, new RowDefinition {Height = new GridLength(2, GridUnitType.Star)}, new RowDefinition {Height = new GridLength(1, GridUnitType.Star)}, new RowDefinition {Height = new GridLength(2, GridUnitType.Star)}, new RowDefinition {Height = new GridLength(2, GridUnitType.Star)}, }, ColumnDefinitions = { new ColumnDefinition {Width = new GridLength(2, GridUnitType.Star)}, new ColumnDefinition {Width = new GridLength(2, GridUnitType.Star)}, new ColumnDefinition {Width = new GridLength(2, GridUnitType.Star)}, new ColumnDefinition {Width = new GridLength(2, GridUnitType.Star)}, new ColumnDefinition {Width = new GridLength(1, GridUnitType.Star)} }, Padding=new Thickness(0,10,0,0) }; for (int i = 0; i < 3; i++) { kanaLabels [i] = new Label (){ Text=stimulus [i], XAlign = TextAlignment.Center, YAlign = TextAlignment.Center,FontSize=30}; englishLabels [i] = new Label (){ Text=english [i], XAlign = TextAlignment.Center, YAlign = TextAlignment.Center,FontSize=20}; grid.Children.Add (kanaLabels[i], 0,5,i*2,i*2+1); grid.Children.Add (englishLabels[i], 0,5,i*2+1,i*2+2); } int[] templateData=new int[8]; string[] rndAnswers = new string[8]; for (int i = 0; i < 8; i++) { templateData [i] = i; } templateData = StudyCard.randomIntArray (templateData); for (int i = 0; i < 8; i++) { rndAnswers[i]=distractors[templateData[i]]; } for (int i = 0; i < 8; i++) { answers [i] = new Button (){ Text = rndAnswers [i], FontSize = 30,BorderColor=Color.Gray,BorderRadius=2,BorderWidth=2}; answers[i].Clicked += answerClicked; } for (int j = 0; j < 4; j++) { grid.Children.Add (answers[j], j, j+1, 6, 7); } for (int j = 4; j < 8; j++) { grid.Children.Add (answers[j], j-4, j-3, 7, 8); } progress = (double)((double)rightCount / (double)initCount); progressBar = new ProgressBar { Progress=progress, }; var pFontSize = 10; if (Device.Idiom == TargetIdiom.Tablet) pFontSize = 30; progressLabel = new Label () { Text = rightCount.ToString () + "/" +initCount.ToString(), XAlign = TextAlignment.Center, YAlign=TextAlignment.Center, FontSize=pFontSize }; StackLayout layout = new StackLayout () { Orientation=StackOrientation.Vertical, VerticalOptions=LayoutOptions.Center, Children = { progressBar } }; grid.Children.Add (layout, 0, 5, 8,9); grid.Children.Add (itemNext,4,5, 6, 7); grid.Children.Add (progressLabel, 4, 5, 7, 8); Content = grid; }
public Timed (int index) { NavigationPage.SetBackButtonTitle (this, "Table"); currentIndex = index; Title = "Timed recognition"; string disData; disData = FillData.distractors [TestPage.timeList[index]]; distractors = new string[8]; timeLabel = new Label (){XAlign=TextAlignment.Center,YAlign=TextAlignment.Center}; elapsedMin=(int)sw.ElapsedMilliseconds/1000/60; elapsedSec=(int)sw.ElapsedMilliseconds/1000%60; string preZero = ""; if (elapsedSec < 10) preZero = "0"; timeLabel.Text = "Elapsed Time: " + elapsedMin+":"+preZero+elapsedSec; //double mode = (double)rnd.Next ()/(double)Int32.MaxValue; int mode=TestPage.timeMode[index]; if (mode==1) { correct = disData.Split ('\t') [1]; correctTitle = disData.Split ('\t') [13]; for (int i = 1; i < 9; i++) distractors [i - 1] = disData.Split ('\t') [i]; } else { correct = disData.Split ('\t') [13]; correctTitle=disData.Split ('\t') [1]; for (int i = 13; i < 21; i++) distractors [i-13] = disData.Split ('\t') [i]; } titleLabel=new Label(){Text=correctTitle,FontSize=80,XAlign=TextAlignment.Center,YAlign=TextAlignment.Center}; grid = new Grid { HorizontalOptions=LayoutOptions.Fill, VerticalOptions = LayoutOptions.Fill, RowDefinitions = { new RowDefinition {Height = new GridLength(1, GridUnitType.Star)}, new RowDefinition {Height = new GridLength(4, GridUnitType.Star)}, new RowDefinition {Height = new GridLength(1, GridUnitType.Star)}, new RowDefinition {Height = new GridLength(1, GridUnitType.Star)}, }, ColumnDefinitions = { new ColumnDefinition {Width = new GridLength(2, GridUnitType.Star)}, new ColumnDefinition {Width = new GridLength(2, GridUnitType.Star)}, new ColumnDefinition {Width = new GridLength(2, GridUnitType.Star)}, new ColumnDefinition {Width = new GridLength(2, GridUnitType.Star)}, } }; int[] templateData=new int[8]; string[] rndAnswers = new string[8]; for (int i = 0; i < 8; i++) { templateData [i] = i; } templateData = StudyCard.randomIntArray (templateData); for (int i = 0; i < 8; i++) { rndAnswers[i]=distractors[templateData[i]]; } for (int i = 0; i < 8; i++) { answers [i] = new Button (){ Text = rndAnswers [i], FontSize = 30,BorderColor=Color.Gray,BorderRadius=2,BorderWidth=2,TextColor=Color.Blue}; answers[i].Clicked += answerClicked; } for (int j = 0; j < 4; j++) { grid.Children.Add (answers[j], j, j+1, 2, 3); } for (int j = 4; j < 8; j++) { grid.Children.Add (answers[j], j-4, j-3, 3, 4); } progress = (double)((double)rightCount / (double)initCount); progressBar = new ProgressBar { Progress=progress }; progressLabel = new Label () { Text = rightCount.ToString () + "/" +initCount.ToString(), XAlign = TextAlignment.Center, }; StackLayout layout = new StackLayout () { Orientation=StackOrientation.Vertical, Children = { progressLabel, progressBar } }; grid.Children.Add (timeLabel, 0, 4, 0, 1); grid.Children.Add (titleLabel, 0, 4,1,2); grid.Children.Add (layout, 0, 4, 4,5); Content = new ScrollView(){Content=grid}; Device.StartTimer (TimeSpan.FromMilliseconds(1000), () => { elapsedMin=(int)sw.ElapsedMilliseconds/1000/60; elapsedSec=(int)sw.ElapsedMilliseconds/1000%60; preZero = ""; if (elapsedSec < 10) preZero = "0"; timeLabel.Text = "Elapsed Time: " + elapsedMin+":"+preZero+elapsedSec; return true; }); }
protected BaseContentPage() { _contentView = new ContentView { HorizontalOptions = LayoutOptions.Fill, VerticalOptions = LayoutOptions.Fill }; _backgroundImage = new Image { Source = BackgroundImageSource, Opacity = BackgroundImageOpacity, Aspect = BackgroundImageAspect }; _opacityGrid = CreateFillGrid(); _opacityGrid.IsVisible = false; _opacityGrid.Opacity = 0.75; _opacityGrid.BackgroundColor = OpacityBackgroundColor; var activityGrid = new Grid { HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center, }; activityGrid.AddAutoRowDefinition(); activityGrid.AddAutoRowDefinition(); activityGrid.AddAutoColumnDefinition(); _activityIndicator = new ActivityIndicator { HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, Color = Color.White }; _activityLabel = new Label { HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center, TextColor = Color.White, LineBreakMode = LineBreakMode.WordWrap }; Grid.SetRow(_activityIndicator, 0); Grid.SetRow(_activityLabel, 1); activityGrid.Children.Add(_activityIndicator); activityGrid.Children.Add(_activityLabel); _activityFrame = new Frame { BackgroundColor = BusyIndicatorBackgroundColor, HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center, Content = activityGrid, IsVisible = false }; _seperator = new ProgressBar { VerticalOptions = LayoutOptions.Fill, IsVisible = ShowSeperator }; _mainGrid = new Grid { HorizontalOptions = LayoutOptions.Fill, VerticalOptions = LayoutOptions.Fill, RowSpacing = 0 }; _mainGrid.AddStarColumnDefinition(); _mainGrid.AddAutoRowDefinition(); _mainGrid.AddStarRowDefinition(); _mainGrid.Children.Add(_backgroundImage); _mainGrid.Children.Add(_contentView); _mainGrid.Children.Add(_opacityGrid); _mainGrid.Children.Add(_activityFrame); _mainGrid.Children.Add(_seperator); Grid.SetRow(_contentView, 1); Grid.SetRow(_opacityGrid, 1); Grid.SetRow(_activityFrame, 1); Grid.SetRow(_backgroundImage, 1); Grid.SetRow(_seperator, 0); Content = _mainGrid; _mainGrid.IsVisible = false; Padding = new Thickness(0, Device.OnPlatform(20, 0, 0), 0, 0); }
string kMode;//Used for checking the test status for changing the title public ExCardfront (string key,string value,int index) { kMode = kanaMode; progressLabel = new Label{Text=" ",TextColor=Color.Gray,XAlign=TextAlignment.Center}; mKey = key; mValue = value; var palleteFrame = BuildDrawingFrame (); gridView = new ContentView { Content = palleteFrame, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand }; string kana = key.Split(' ')[0]; string romaji = key.Substring (kana.Length); //Erase Button Button butErase = new Button { Text = " Erase ", HorizontalOptions = LayoutOptions.End, VerticalOptions = LayoutOptions.Center, BorderWidth=1, }; butErase.Clicked += ButErase_Clicked; grid= new Grid { VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand, RowDefinitions = { new RowDefinition {Height = GridLength.Auto}, new RowDefinition {Height = GridLength.Auto}, new RowDefinition {Height = new GridLength(2, GridUnitType.Star)}, new RowDefinition {Height = new GridLength(1, GridUnitType.Star)}, new RowDefinition {Height = GridLength.Auto}, }, ColumnDefinitions = { new ColumnDefinition { Width = new GridLength (1, GridUnitType.Star) }, }, Children = { {new Label { Text="Tap outside writing field when done\nUse landscape view for maximum width (tablet only)", XAlign=TextAlignment.Center, YAlign=TextAlignment.Center, TextColor=Color.Gray, }, 0,0}, {butErase,0,1}, {gridView, 0,2}, {new Label { Text = romaji, XAlign=TextAlignment.Center, FontSize = 40, YAlign=TextAlignment.Center, },0,3 }, } }; progressBar = new ProgressBar { Progress=0 }; if (root.GetType () == typeof(CompMenu) || root.GetType () == typeof(TestPage)) { double progress=0; if(root.GetType()==typeof(CompMenu)) { progress = (double)(CompMenu.wrightCount/StudyCard.initDrillCount); progressLabel.Text = CompMenu.wrightCount.ToString () + "/" + StudyCard.initDrillCount.ToString (); } else if(root.GetType()==typeof(TestPage)) { progress = (double)(index/(double)StudyCard.initDrillCount); progressLabel.Text=index.ToString()+"/"+StudyCard.initDrillCount.ToString(); } progressBar.ProgressTo (progress, 10, Easing.Linear); StackLayout layout = new StackLayout () { Orientation=StackOrientation.Vertical, Children = { progressLabel, progressBar } }; grid.Children.Add (layout,0,4); } //backButton.Clicked += async BackButton_Clicked; Content = grid; // Accomodate iPhone status bar. Padding = new Thickness (10, Device.OnPlatform (20, 0, 0), 10, 10); //NavigationPage.SetHasBackButton (this, false); Title="Writing"; // Set title to Katakana writing in test mode if (kanaMode.Length > 0) this.Title = kanaMode.Split (' ') [1]+" Writing"; var tapGestureRecognizer = new TapGestureRecognizer (); tapGestureRecognizer.Tapped += TapGestureRecognizer_Tapped; this.Content.GestureRecognizers.Add (tapGestureRecognizer); }
public LeadListItemCell() { #region companyNameLabel CompanyNameLabel = new Label() { TextColor = Palette._006, FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)) * 1.2, YAlign = TextAlignment.End, LineBreakMode = LineBreakMode.TailTruncation }; CompanyNameLabel.SetBinding( Label.TextProperty, new Binding("Company")); #endregion #region opportunityStageLabel OpportunityStageLabel = new Label() { TextColor = Palette._007, FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)), YAlign = TextAlignment.End, LineBreakMode = LineBreakMode.TailTruncation }; OpportunityStageLabel.SetBinding( Label.TextProperty, new Binding( path: "OpportunityStage")); #endregion #region leadAmountLabel LeadAmountLabel = new Label() { TextColor = Palette._007, XAlign = TextAlignment.End, FontSize = Device.OnPlatform( iOS: Device.GetNamedSize(NamedSize.Small, typeof(Label)), Android: Device.GetNamedSize(NamedSize.Small, typeof(Label)), WinPhone: Device.GetNamedSize(NamedSize.Medium, typeof(Label))), LineBreakMode = LineBreakMode.TailTruncation }; LeadAmountLabel.SetBinding( targetProperty: Label.TextProperty, binding: new Binding( path: "OpportunitySize", stringFormat: "{0:C}")); #endregion #region progressBar ProgressBar = new ProgressBar(); ProgressBar.SetBinding( targetProperty: ProgressBar.ProgressProperty, binding: new Binding( path: "OpportunityStagePercent", converter: new WholePercentToDecimalPercent() // use the WholePercentToDecimalPercent value converter to change the whole percent value to a decimal percent value )); #endregion // A ContentView, which will serve as the "top-level" of the cell's view hierarchy. // It also allows a Padding to be set; something that can't be done with a plain View. var contentView = new ContentView(); // set the padding of the contentView contentView.Padding = new Thickness(10, 0); // A container for the "top-level" of the cell's view hierarchy. RelativeLayout relativeLayout = new RelativeLayout(); // add the companyNameLabel to the relativeLayout relativeLayout.Children.Add( view: CompanyNameLabel, xConstraint: Constraint.RelativeToParent(parent => 0), yConstraint: Constraint.RelativeToParent(Parent => 0), widthConstraint: Constraint.RelativeToParent(parent => parent.Width), heightConstraint: Constraint.RelativeToParent(parent => parent.Height / 3)); // add the percentCopleteLabel to the relativeLayout relativeLayout.Children.Add( view: OpportunityStageLabel, xConstraint: Constraint.RelativeToParent(parent => 0), yConstraint: Constraint.RelativeToParent(parent => parent.Height / 3), widthConstraint: Constraint.RelativeToParent(parent => parent.Width / 2), heightConstraint: Constraint.RelativeToParent(parent => parent.Height / 3)); // add the leadAmountLabel to the relativeLayout relativeLayout.Children.Add( view: LeadAmountLabel, xConstraint: Constraint.RelativeToParent(parent => parent.Width / 2), yConstraint: Constraint.RelativeToParent(parent => parent.Height / 3), widthConstraint: Constraint.RelativeToParent(parent => parent.Width / 2), heightConstraint: Constraint.RelativeToParent(parent => parent.Height / 3)); Constraint progressBarConstraint = Constraint.Constant(0); Device.OnPlatform( Default: () => progressBarConstraint = Constraint.RelativeToParent(parent => ((parent.Height / 3) * 2)), iOS: () => progressBarConstraint = Constraint.RelativeToParent(parent => ((parent.Height / 3) * 2) * 1.20)); // add the progressBar to the relativeLayout relativeLayout.Children.Add( view: ProgressBar, xConstraint: Constraint.RelativeToParent(parent => 0), yConstraint: progressBarConstraint, widthConstraint: Constraint.RelativeToParent(parent => parent.Width), heightConstraint: Constraint.RelativeToParent(parent => parent.Height / 3)); // Assign the relativeLayout to Content of contentView // This lets us take advantage of ContentView's padding. contentView.Content = relativeLayout; // assign contentView to the View property View = contentView; }
public LoadingPage () { NavigationPage.SetHasNavigationBar (this, false); InitializeComponent (); ProgressBar1 = new ProgressBar () { Progress = 0 }; bgImage = new Image { Source = "Loading_BG.jpg", WidthRequest = MyDevice.GetScaledSize(640), /*CacheDuration = TimeSpan.FromDays(30), //DownsampleToViewSize = true, RetryCount = 10, RetryDelay = 250, TransparencyEnabled = false, FadeAnimationEnabled = false,*/ Aspect = Aspect.Fill }; var footerImage = new CachedImage () { Source = "Loading_Footer.png", WidthRequest = MyDevice.GetScaledSize(421), HeightRequest = MyDevice.GetScaledSize(94), CacheDuration = TimeSpan.FromDays(30), DownsampleToViewSize = true, RetryCount = 10, RetryDelay = 250, TransparencyEnabled = false, FadeAnimationEnabled = false }; var versionText = new Label () { Text = "Ver 1.0", FontSize = MyDevice.FontSizeMicro, HorizontalTextAlignment = TextAlignment.Center, WidthRequest = MyDevice.GetScaledSize(80), HeightRequest = MyDevice.GetScaledSize(30), TextColor = Color.White, FontAttributes = FontAttributes.Bold }; ProgressBar1.WidthRequest = MyDevice.GetScaledSize (415); ProgressBar1.HeightRequest = MyDevice.GetScaledSize (90); relLayout1.Children.Add (bgImage, Constraint.Constant (0), Constraint.Constant (0) ); relLayout1.Children.Add (footerImage, Constraint.RelativeToParent (parent => { return parent.Bounds.Left + MyDevice.GetScaledSize(114); }), Constraint.RelativeToParent (parent => { return parent.Bounds.Bottom - MyDevice.GetScaledSize(170); }) ); relLayout1.Children.Add (versionText, Constraint.RelativeToView (footerImage, (parent, sibling) => { return sibling.Bounds.Right - MyDevice.GetScaledSize (80); }), Constraint.RelativeToView (footerImage, (parent, sibling) => { return sibling.Bounds.Bottom + MyDevice.GetScaledSize (10); }) ); if (Device.OS == TargetPlatform.Android) { relLayout1.Children.Add (ProgressBar1, Constraint.RelativeToParent (parent => { return parent.Bounds.Left + MyDevice.GetScaledSize (117); }), Constraint.RelativeToParent (parent => { return parent.Bounds.Bottom - MyDevice.GetScaledSize (130); }) ); } else { relLayout1.Children.Add (ProgressBar1, Constraint.RelativeToParent (parent => { return parent.Bounds.Left + MyDevice.GetScaledSize (117); }), Constraint.RelativeToParent (parent => { return parent.Bounds.Bottom - MyDevice.GetScaledSize (130) + 20; }) ); } Load(); }
public SyllableRCard (string kana,TestPage root,int index) { progressLabel = new Label{Text=" ",TextColor=Color.Gray,XAlign=TextAlignment.Center}; Title = Character.getCategory(kana)+" Writing"; string romaji = Character.kana_to_romaji (kana); mRoot = root; mKana = kana; ImageWithTouch DrawingImage; DrawingImage = new ImageWithTouch { VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand, BackgroundColor = Color.White, CurrentLineColor = Color.Gray }; Button butErase = new Button { Text = " Erase ", HorizontalOptions = LayoutOptions.End, VerticalOptions = LayoutOptions.Center, BorderWidth=1, }; butErase.Clicked += ButErase_Clicked; DrawingImage.SetBinding (ImageWithTouch.CurrentLineColorProperty, "CurrentLineColor"); var palleteFrame = new Frame { BackgroundColor = Color.White, HasShadow = false, OutlineColor = Color.Black, Content = DrawingImage ,Padding=0 }; progressBar = new ProgressBar { Progress=0 }; double progress=0; if(root.GetType()==typeof(TestPage)) { progress = (double)(index/(double)StudyCard.initDrillCount); progressLabel.Text=index.ToString()+"/"+StudyCard.initDrillCount; } progressBar.ProgressTo (progress, 10, Easing.Linear); StackLayout layout = new StackLayout () { Orientation=StackOrientation.Vertical, Children = { progressLabel, progressBar } }; gridView = new ContentView { Content = palleteFrame, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand }; grid = new Grid { HorizontalOptions=LayoutOptions.Fill, VerticalOptions = LayoutOptions.FillAndExpand, RowDefinitions = { new RowDefinition {Height = GridLength.Auto}, new RowDefinition {Height = GridLength.Auto}, new RowDefinition {Height = new GridLength(2, GridUnitType.Star)}, new RowDefinition {Height = new GridLength(1, GridUnitType.Star)}, new RowDefinition {Height = GridLength.Auto}, } }; grid.Children.Add(new Label { Text="Tap outside writing field when done\nUse landscape view for maximum width (tablet only)", XAlign=TextAlignment.Center, TextColor=Color.Gray} ,0,0); grid.Children.Add (new Label { Text = romaji.Replace('/','\n'), VerticalOptions = LayoutOptions.Center, XAlign=TextAlignment.Center, YAlign=TextAlignment.Center, FontSize = 50 }, 0, 3); grid.Children.Add (gridView, 0, 2); grid.Children.Add (butErase, 0, 1); grid.Children.Add (layout,0,4); Content = grid; Padding = new Thickness (10, Device.OnPlatform (20, 0, 0), 10, 10); var tapGestureRecognizer = new TapGestureRecognizer (); tapGestureRecognizer.Tapped+= TapGestureRecognizer_Tapped; this.Content.GestureRecognizers.Add (tapGestureRecognizer); }
public ProgressBarHandler(NativeComponentRenderer renderer, XF.ProgressBar progressBarControl) : base(renderer, progressBarControl) { ProgressBarControl = progressBarControl ?? throw new ArgumentNullException(nameof(progressBarControl)); Initialize(renderer); }
public SpinnerView() { // Init this.Opacity = 0; // Create Controls var relativeLayout = new RelativeLayout() { VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand }; _roundedBox = new RoundedBox() { BackgroundColor = Color.Black, CornerRadius = 10, Opacity = 1 }; _spinnerViewProgressBar = new ProgressBar(); _spinnerViewLabel = new Label() { TextColor = Color.White, FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Label)), HorizontalTextAlignment = TextAlignment.Center }; _spinnerViewActivityIndicator = new ActivityIndicator() { Color = Color.White }; // Rounded Box relativeLayout.Children.AddInOrigo(_roundedBox, 120, 100); // Progress Bar //_spinnerViewProgressBar.IsVisible = this.ShowProgress; _spinnerViewProgressBar.Opacity = this.ShowProgress ? 1 : 0; _spinnerViewProgressBar.Progress = this.Progress; relativeLayout.Children.Add(_spinnerViewProgressBar, xConstraint:Constraint.RelativeToView(_roundedBox, (RelativeLayout arg1, View arg2) => { return arg2.Bounds.Left + 10; }), yConstraint:Constraint.RelativeToView(_roundedBox, (RelativeLayout arg1, View arg2) => { return arg2.Bounds.Bottom - 15; }), widthConstraint:Constraint.RelativeToView(_roundedBox, (RelativeLayout arg1, View arg2) => { return arg2.Bounds.Width - 20; }), heightConstraint:Constraint.Constant(10)); // Label _spinnerViewLabel.Text = this.Message; relativeLayout.Children.Add(_spinnerViewLabel, xConstraint:Constraint.RelativeToView(_roundedBox, (RelativeLayout arg1, View arg2) => { return arg2.Bounds.Left + 10; }), yConstraint:Constraint.RelativeToView(_roundedBox, (RelativeLayout arg1, View arg2) => { return arg2.Bounds.Top + 5; }), widthConstraint:Constraint.RelativeToView(_roundedBox, (RelativeLayout arg1, View arg2) => { return arg2.Bounds.Width - 20; })); // Activity Indicator relativeLayout.Children.AddInOrigo(_spinnerViewActivityIndicator, 50, 50); // Return this.Content = relativeLayout; }
public ExampleCard (string key,string value, int index) { progressLabel = new Label{Text=" ",TextColor=Color.Gray,XAlign=TextAlignment.Center}; this.Title = key.Split(' ')[0]; if (kanaMode.Length > 0) this.Title = kanaMode.Split (' ') [1]+" Reading"; mKey = key; mValue = value; Grid grid = new Grid { HorizontalOptions=LayoutOptions.Fill, VerticalOptions = LayoutOptions.Fill, RowDefinitions = { new RowDefinition {Height = GridLength.Auto}, new RowDefinition {Height = new GridLength(1, GridUnitType.Star)}, new RowDefinition {Height = GridLength.Auto}, } }; Button backButton = new Button{ Text = "→", HorizontalOptions= LayoutOptions.End, FontSize = 50 }; grid.Children.Add(backButton,0,0); int fontSize1 = 40; if (Device.Idiom == TargetIdiom.Tablet) { fontSize1 = 80; } Label kanaLabel = new Label { Text = key.Split(' ')[0], VerticalOptions = LayoutOptions.Center, HorizontalOptions=LayoutOptions.Center, FontSize=fontSize1-key.Split(' ')[0].Length*2, }; grid.Children.Add (kanaLabel, 0, 1); progressBar = new ProgressBar { Progress=0 }; double progress=0; if (root.GetType () == typeof(CompMenu) || root.GetType () == typeof(TestPage)) { if(root.GetType()==typeof(CompMenu)) { progress = (double)(CompMenu.rrightCount/StudyCard.initDrillCount); progressLabel.Text=CompMenu.rrightCount.ToString()+"/"+StudyCard.initDrillCount.ToString(); } else if(root.GetType()==typeof(TestPage)) { progress = (double)(index/(double)StudyCard.initDrillCount); progressLabel.Text=index.ToString()+"/"+StudyCard.initDrillCount.ToString(); } progressBar.ProgressTo (progress, 10, Easing.Linear); StackLayout layout = new StackLayout () { Orientation=StackOrientation.Vertical, Children = { progressLabel, progressBar } }; grid.Children.Add (layout,0,2); } else grid.Children.Add (new Label (), 0, 2); Content = grid; grid.Padding = new Thickness (10, Device.OnPlatform (10, 0, 0), 10, 10); backButton.Clicked+= BackButton_Clicked; }
/// <summary> /// Initializes a new instance of the <see cref="SensusUI.ShareLocalDataStorePage"/> class. /// </summary> /// <param name="localDataStore">Local data store to display.</param> public ShareLocalDataStorePage(LocalDataStore localDataStore) { _cancellationTokenSource = new CancellationTokenSource(); Title = "Sharing Local Data Store"; StackLayout contentLayout = new StackLayout { Orientation = StackOrientation.Vertical, VerticalOptions = LayoutOptions.FillAndExpand }; Label statusLabel = new Label { FontSize = 20, HorizontalOptions = LayoutOptions.FillAndExpand }; contentLayout.Children.Add(statusLabel); ProgressBar progressBar = new ProgressBar { Progress = 0, HorizontalOptions = LayoutOptions.FillAndExpand }; contentLayout.Children.Add(progressBar); Button cancelButton = new Button { Text = "Cancel", FontSize = 20, HorizontalOptions = LayoutOptions.FillAndExpand }; cancelButton.Clicked += async (o, e) => { await Navigation.PopAsync(); }; contentLayout.Children.Add(cancelButton); new Thread(() => { string sharePath = null; bool errorWritingShareFile = false; try { sharePath = SensusServiceHelper.Get().GetSharePath(".zip"); int numDataWritten = localDataStore.WriteDataToZipFile(sharePath, _cancellationTokenSource.Token, (message, progress) => { Device.BeginInvokeOnMainThread(async () => { uint duration = 250; if (message != null) { statusLabel.Text = message; duration = 0; } await progressBar.ProgressTo(progress, duration, Easing.Linear); }); }); if (numDataWritten == 0) throw new Exception("No data to share."); } catch (Exception ex) { errorWritingShareFile = true; string message = "Error sharing data: " + ex.Message; SensusServiceHelper.Get().FlashNotificationAsync(message); SensusServiceHelper.Get().Logger.Log(message, LoggingLevel.Normal, GetType()); } if (_cancellationTokenSource.IsCancellationRequested || errorWritingShareFile) { // always delete the file on cancel / error try { if (File.Exists(sharePath)) File.Delete(sharePath); } catch (Exception) { } // if the window has already been popped then the token will have been cancelled. pop the window if needed. if (!_cancellationTokenSource.IsCancellationRequested) Device.BeginInvokeOnMainThread(async () => await Navigation.PopAsync()); } else { Device.BeginInvokeOnMainThread(async () => { await Navigation.PopAsync(); SensusServiceHelper.Get().ShareFileAsync(sharePath, "Sensus Data: " + localDataStore.Protocol.Name, "application/zip"); }); } }).Start(); Content = new ScrollView { Content = contentLayout }; }
/// <summary> /// Initializes a new instance of the <see cref="SensusUI.ShareLocalDataStorePage"/> class. /// </summary> /// <param name="localDataStore">Local data store to display.</param> public ShareLocalDataStorePage(LocalDataStore localDataStore) { _cancellationTokenSource = new CancellationTokenSource(); Title = "Sharing Local Data Store"; StackLayout contentLayout = new StackLayout { Orientation = StackOrientation.Vertical, VerticalOptions = LayoutOptions.FillAndExpand }; Label statusLabel = new Label { FontSize = 20, HorizontalOptions = LayoutOptions.FillAndExpand }; contentLayout.Children.Add(statusLabel); ProgressBar progressBar = new ProgressBar { Progress = 0, HorizontalOptions = LayoutOptions.FillAndExpand }; contentLayout.Children.Add(progressBar); Button cancelButton = new Button { Text = "Cancel", FontSize = 20, HorizontalOptions = LayoutOptions.FillAndExpand }; cancelButton.Clicked += async (o, e) => { await Navigation.PopAsync(); }; contentLayout.Children.Add(cancelButton); new Thread(() => { string sharePath = SensusServiceHelper.Get().GetSharePath(".json"); bool errorWritingShareFile = false; try { // step 1: gather data. Device.BeginInvokeOnMainThread(() => statusLabel.Text = "Gathering data..."); List<Datum> localData = localDataStore.GetDataForRemoteDataStore(_cancellationTokenSource.Token, progress => { Device.BeginInvokeOnMainThread(() => { progressBar.ProgressTo(progress, 250, Easing.Linear); }); }); // step 2: write gathered data to file. if (!_cancellationTokenSource.IsCancellationRequested) { Device.BeginInvokeOnMainThread(() => { progressBar.ProgressTo(0, 0, Easing.Linear); statusLabel.Text = "Writing data to file..."; }); using (StreamWriter shareFile = new StreamWriter(sharePath)) { shareFile.WriteLine("["); int dataWritten = 0; foreach (Datum localDatum in localData) { if (_cancellationTokenSource.IsCancellationRequested) break; shareFile.Write((dataWritten++ == 0 ? "" : "," + Environment.NewLine) + localDatum.GetJSON(localDataStore.Protocol.JsonAnonymizer)); if (localData.Count >= 10 && (dataWritten % (localData.Count / 10)) == 0) Device.BeginInvokeOnMainThread(() => progressBar.ProgressTo(dataWritten / (double)localData.Count, 250, Easing.Linear)); } shareFile.WriteLine(Environment.NewLine + "]"); } } } catch (Exception ex) { errorWritingShareFile = true; string message = "Error writing share file: " + ex.Message; SensusServiceHelper.Get().FlashNotificationAsync(message); SensusServiceHelper.Get().Logger.Log(message, LoggingLevel.Normal, GetType()); } if (_cancellationTokenSource.IsCancellationRequested || errorWritingShareFile) { // always delete the file on cancel / error try { File.Delete(sharePath); } catch (Exception) { } // the only way to get a cancellation event is to back out of the window, so only pop if there was an error if(errorWritingShareFile) Device.BeginInvokeOnMainThread(async () => await Navigation.PopAsync()); } else { Device.BeginInvokeOnMainThread(async () => { await Navigation.PopAsync(); SensusServiceHelper.Get().ShareFileAsync(sharePath, "Sensus Data", "application/json"); }); } }).Start(); Content = new ScrollView { Content = contentLayout }; }
public ConfusedTest (string mode,int index) { wrongState = false; timeLabel = new Label (){XAlign=TextAlignment.Center,YAlign=TextAlignment.Center}; avgLabel = new Label (){XAlign=TextAlignment.Center,YAlign=TextAlignment.Center}; timerSwitch=new Switch(){HorizontalOptions=LayoutOptions.Center,VerticalOptions=LayoutOptions.Center}; timerSwitch.IsToggled = timerEnabled; timerSwitch.Toggled+= TimerSwitch_Toggled; Title = mode; mMode = mode; Debug.WriteLine (currentIndex.ToString()); int answered = 0; if (mode == "Easily Confused Hiragana") { if (currentIndex == 38) { Debug.WriteLine ("38"); } int elapsedSec = (int)hiraSW.ElapsedMilliseconds / 1000 % 60; int elapsedMin = (int)hiraSW.ElapsedMilliseconds / 1000 / 60; timeLabel.Text = "Elapsed Time: \n" + elapsedMin+"m "+elapsedSec+"s"; data = ConfusedData.hData [index].Split ('\t'); avgLabel.Text = "Average Time: \n" + (hiraSW.ElapsedMilliseconds / 1000 / (float)HiraMenu.drillList.Count).ToString () + "s"; answered = HiraMenu.completeList [currentIndex]; Debug.WriteLine (index.ToString()+"/"+data [0] + "/" + data [1] + "/" + answered.ToString ()); } else { int elapsedSec = (int)kataSW.ElapsedMilliseconds / 1000%60; int elapsedMin = (int)kataSW.ElapsedMilliseconds / 1000 / 60; timeLabel.Text = "Elapsed Time: \n" + elapsedMin+"m "+elapsedSec+"s"; avgLabel.Text = "Average Time: \n" +(kataSW.ElapsedMilliseconds / 1000 / (float)KataMenu.drillList.Count).ToString()+"s"; data = ConfusedData.kData [index].Split ('\t'); answered = KataMenu.completeList [currentIndex]; Debug.WriteLine (index.ToString()+"/"+data [0] + "/" + data [1] + "/" + answered.ToString ()); } grid = new Grid { HorizontalOptions=LayoutOptions.Fill, VerticalOptions = LayoutOptions.Fill, RowDefinitions = { new RowDefinition {Height = new GridLength(2, GridUnitType.Star)}, new RowDefinition {Height = new GridLength(2, GridUnitType.Star)}, } }; if (data [10].Length > 0) { // Checking whether it shows 3 items or not romajiArray = new string[]{ data [7], data [9], data [11] }; kanaArray = new string[]{ data [6], data [8], data [10] }; if (index == 1 && mode == "Easily Confused Katakana") { romajiArray [1] = "se\n(in katakana)"; kanaArray = new string[]{ data [6], data [10], data [8] }; } for (int i = 0; i < 3; i++) { grid.ColumnDefinitions.Add (new ColumnDefinition (){ Width = new GridLength (3, GridUnitType.Star) }); dict.Add (kanaArray [i],romajiArray [i]); } } else { romajiArray = new string[]{ data [7], data [9]}; kanaArray = new string[]{ data [6], data [8]}; for (int i = 0; i < 2; i++) { grid.ColumnDefinitions.Add (new ColumnDefinition (){ Width = new GridLength (3, GridUnitType.Star) }); dict.Add (kanaArray [i],romajiArray [i]); } } grid.ColumnDefinitions.Add (new ColumnDefinition (){ Width = new GridLength (1, GridUnitType.Star) }); int[] templateData=new int[kanaArray.Length]; string[] rndAnswers = new string[kanaArray.Length]; string[] labels = new string[kanaArray.Length]; for (int i = 0; i < kanaArray.Length; i++) { templateData [i] = i; } for (int i = 0; i < kanaArray.Length; i++) { rndAnswers[i]=romajiArray[i]; labels [i] = kanaArray [i]; } answers = new Button[kanaArray.Length]; int butFontSize = 90,titleFontSize = 50,nextFontSize=40; if (Device.Idiom == TargetIdiom.Tablet) { butFontSize = 180; titleFontSize = 100; nextFontSize = 60; } if (kanaArray.Length == 3) butFontSize = (int)(butFontSize*0.66); for (int i = 0; i < kanaArray.Length; i++) { answers [i] = new Button (){ Text = labels [i], FontSize = butFontSize,BorderColor=Color.Gray,BorderRadius=2,BorderWidth=2,TextColor=Color.Blue}; answers[i].Clicked += answerClicked; } if (answered ==0) { grid.Children.Add (new Label () { Text = romajiArray [0], XAlign = TextAlignment.Center, YAlign = TextAlignment.Center, FontSize = titleFontSize, TextColor = Color.Maroon }, 0, kanaArray.Length+1, 0, 1); correct = romajiArray [0]; } else if (answered==1){ string[] str = romajiArray [1].Split ('\n'); grid.Children.Add (new Label () { Text = str [0], XAlign = TextAlignment.Center, YAlign = TextAlignment.Center, FontSize = titleFontSize, TextColor = Color.Maroon }, 0, kanaArray.Length+1, 0, 1); if(str.Length>1) grid.Children.Add (new Label () { Text = str [1], XAlign = TextAlignment.Center, YAlign = TextAlignment.Center, FontSize = Math.Max(20,titleFontSize-50), TextColor = Color.Black,VerticalOptions=LayoutOptions.End }, 0, kanaArray.Length+1, 0, 1); correct = str[0]; } else if (answered ==2) { grid.Children.Add (new Label () { Text = romajiArray [2], XAlign = TextAlignment.Center, YAlign = TextAlignment.Center, FontSize = titleFontSize, TextColor = Color.Maroon }, 0, kanaArray.Length+1, 0, 1); correct = romajiArray [2]; } Debug.WriteLine ("Index="+index.ToString ()); nextButton = new Button (){ Text = "→", FontSize = nextFontSize,IsVisible=false,HorizontalOptions=LayoutOptions.End}; nextButton.Clicked += NextButton_Clicked; templateData = StudyCard.randomIntArray (templateData); for (int j = 0; j < kanaArray.Length; j++) { grid.Children.Add (answers[templateData[j]], j, j+1, 1,2); } grid.Children.Add (nextButton,kanaArray.Length,kanaArray.Length+1, 1,2); if(mMode=="Easily Confused Hiragana") progress = (double)((double)rightCount / ((double)initCount*2+1)); else if(mMode=="Easily Confused Katakana") progress = (double)((double)rightCount / ((double)initCount*2)); progressBar = new ProgressBar { Progress=progress }; progressLabel = new Label () { XAlign = TextAlignment.Center, }; if(mMode=="Easily Confused Hiragana") progressLabel.Text = rightCount.ToString () + "/" + (initCount*2+1).ToString(); else if(mMode=="Easily Confused Katakana") progressLabel.Text = rightCount.ToString () + "/" + (initCount*2).ToString(); StackLayout layout = new StackLayout () { Orientation=StackOrientation.Vertical, Children = { progressLabel, progressBar } }; grid.Children.Add (layout, 0, kanaArray.Length+1,2,3); Padding = new Thickness (5, 10, 5, 10); Content = grid; if(Settings.sound) DependencyService.Get<IAudio>().PlayMp3File("Audio/SC/sc_"+correct+".mp3"); Device.StartTimer (TimeSpan.FromMilliseconds(1000), () => { int em, es=0; if (mode == "Easily Confused Hiragana") { es = (int)hiraSW.ElapsedMilliseconds / 1000 % 60; em = (int)hiraSW.ElapsedMilliseconds / 1000 / 60; avgLabel.Text = "Average Time: \n" +(hiraSW.ElapsedMilliseconds / 1000/(float)HiraMenu.drillList.Count).ToString()+"s"; } else { es = (int)kataSW.ElapsedMilliseconds / 1000 % 60; em = (int)kataSW.ElapsedMilliseconds / 1000 / 60; avgLabel.Text = "Average Time: \n" +(kataSW.ElapsedMilliseconds / 1000/(float)KataMenu.drillList.Count).ToString()+"s"; } timeLabel.Text = "Elapsed Time: \n" + em+"m "+es+"s"; return true; }); }
public void InitializeComponent() { try { this.LoadFromXaml (typeof(UsagePage)); ProgressBarData = this.FindByName<ProgressBar>("ProgressBarData"); ProgressBarCall = this.FindByName<ProgressBar>("ProgressBarCall"); ButtonUsageReport = this.FindByName<Image>("UsageReportButton"); ButtonUsagePage = this.FindByName<Image>("UsageButton"); ButtonUsageDetails = this.FindByName<Image>("UsageDetailsButton"); SlUsagePage= this.FindByName<StackLayout>("SlUsagePage"); SlUsageReport= this.FindByName<StackLayout>("SlUsageReport"); SlUsageDetail = this.FindByName<StackLayout>("SlUsageDetail"); TabButtonTouchRecognizer = new TapGestureRecognizer(); TabButtonTouchRecognizer.Tapped+= TabButtonTouchRecognizer_Tapped; ButtonUsageReport.GestureRecognizers.Add(TabButtonTouchRecognizer); ButtonUsagePage.GestureRecognizers.Add(TabButtonTouchRecognizer); ButtonUsageDetails.GestureRecognizers.Add(TabButtonTouchRecognizer); } catch (Exception ex) { //TODO::Log Reporting. int i=0; i++; } }