private void GenerateOptions(string title, string[] childrenKeys) { TextBlock tb1 = new TextBlock(); BlueStacksUIBinding.Bind(tb1, title, ""); tb1.Padding = new Thickness(0.0); tb1.FontSize = 16.0; tb1.Margin = new Thickness(0.0, 10.0, 0.0, 0.0); BlueStacksUIBinding.BindColor((DependencyObject)tb1, Control.ForegroundProperty, "SettingsWindowTabMenuItemSelectedForeground"); tb1.FontWeight = FontWeights.Normal; tb1.HorizontalAlignment = HorizontalAlignment.Left; tb1.VerticalAlignment = VerticalAlignment.Center; this.mOptionsStackPanel.Children.Add((UIElement)tb1); foreach (string childrenKey in childrenKeys) { CustomRadioButton tb2 = new CustomRadioButton(); tb2.Checked += new RoutedEventHandler(this.Btn_Checked); tb2.HorizontalAlignment = HorizontalAlignment.Left; BlueStacksUIBinding.Bind(tb2, childrenKey); tb2.Tag = (object)childrenKey; tb2.Margin = new Thickness(0.0, 10.0, 0.0, 5.0); this.mOptionsStackPanel.Children.Add((UIElement)tb2); if (childrenKey == this.mCurrentGlobalDefault) { tb2.IsChecked = new bool?(true); } } }
private static void OnItemsSourceChanged(BindableObject bindable, IEnumerable oldValue, IEnumerable newValue) { var radButtons = bindable as BindableRadioGroup; foreach (var item in radButtons.Items) { item.CheckedChanged -= radButtons.OnCheckedChanged; } radButtons.Children.Clear(); var radIndex = 0; foreach (var item in radButtons.ItemsSource) { var button = new CustomRadioButton { Text = item.ToString(), Id = radIndex++, TextColor = radButtons.TextColor, FontSize = Device.GetNamedSize(NamedSize.Small, radButtons), FontName = radButtons.FontName }; button.CheckedChanged += radButtons.OnCheckedChanged; radButtons.Items.Add(button); radButtons.Children.Add(button); } }
private void MobaSkillsRadioButton_PreviewMouseLeftButtonDown( object sender, MouseButtonEventArgs e) { this.mCanvasElement.MOBASkillSettingsMoreInfoPopup.IsOpen = false; this.mCanvasElement.MOBAOtherSettingsMoreInfoPopup.IsOpen = false; CustomRadioButton customRadioButton = sender as CustomRadioButton; customRadioButton.IsChecked = new bool?(true); KeymapCanvasWindow.sIsDirty = true; string skillName; switch (customRadioButton.Name) { case "mManualSkill": this.mCanvasElement.AssignMobaSkill(false, false); skillName = "ManualSkill"; break; case "mAutoSkill": this.mCanvasElement.AssignMobaSkill(true, false); skillName = "AutoSkill"; break; case "mQuickSkill": this.mCanvasElement.AssignMobaSkill(true, true); skillName = "QuickSkill"; break; default: this.mCanvasElement.AssignMobaSkill(true, true); skillName = "QuickSkill"; break; } this.mCanvasElement.SendMOBAStats("moba_skill_changed", skillName); }
public void SetPlayers(Player[] playersList) { players = playersList; playerButtons = new CustomRadioButton[players.Length]; for (int i = 0; i < players.Length; i++) { players[i].SetResources(); playerButtons[i] = new CustomRadioButton { Foreground = Color.Black, number = i, GroupName = "Players", Text = players[i].playerName, Margin = new Thickness(0, 0, 0, 40 * (players.Length - i + 1)), VerticalAlignment = VerticalAlignment.Bottom }; Owner.Scene.EntityManager.Add(playerButtons[i]); playerButtons[i].Checked += ChangePlayer; playerButtons[i].Entity.AddComponent(new MouseEnterBehavior()); } activePlayer = players[0]; playerButtons[0].IsChecked = true; clearPlayerButton = new CustomRadioButton { Foreground = Color.Black, number = -1, GroupName = "Players", Text = "No player", Margin = new Thickness(0, 0, 0, 40), VerticalAlignment = VerticalAlignment.Bottom }; clearPlayerButton.Checked += ClearPlayer; clearPlayerButton.Entity.AddComponent(new MouseEnterBehavior()); Owner.Scene.EntityManager.Add(clearPlayerButton); }
partial void UrduButton_TouchUpInside(CustomRadioButton sender) { HandleRadioBtnChange(SettingsLanguageSelection.Urdu, sender); }
partial void TigrinyaButton_TouchUpInside(CustomRadioButton sender) { HandleRadioBtnChange(SettingsLanguageSelection.Tigrinya, sender); }
partial void LithuanianButton_TouchUpInside(CustomRadioButton sender) { HandleRadioBtnChange(SettingsLanguageSelection.Lithuanian, sender); }
public void TestExamLayout(SubjectTakensModel subjectTakenModel) { if (ACTContext.isLogin == true) { #region header text Label lblTestScreenHeaderText = new Label { Text = "Mock Test", HorizontalOptions = LayoutOptions.CenterAndExpand, TextColor = Color.White, FontSize = 20, FontAttributes = FontAttributes.Bold }; StackLayout sLblTestScreenHeaderText = new StackLayout { Children = { lblTestScreenHeaderText }, Orientation = StackOrientation.Horizontal, Padding = new Thickness(0, 50, 0, 0) }; #endregion #region start button StackLayout sbtnStartTest = new StackLayout { Children = { btnStartTest }, Orientation = StackOrientation.Horizontal, Padding = new Thickness(20, 10, 2, 8) }; btnStartTest.Clicked += (object sender, EventArgs e) => { btnStartTest.IsVisible = false; slblQuestion.IsVisible = true; bRadioAnswerOptions.IsVisible = true; sbtnSubmitAnswer.IsVisible = true; sbtnSubmitAnswer2.IsVisible = true; }; #endregion #region time remaining if (countQuestion == 0) { Device.StartTimer(new TimeSpan(0, 0, 1), () => { if (btnStartTest.IsVisible == false) { if (examRemainingSecond <= 0 && examReamainingMinute <= 0 && examRemainigHour <= 0) { return(false); } if (examRemainingSecond <= 0 && examReamainingMinute <= 0) { examRemainingSecond = 61; examReamainingMinute = 61; lblTestScreenTimeReamaining.Text = "Time remaining : " + --examRemainigHour + " Hours " + --examReamainingMinute + " Minutes " + --examRemainingSecond + " Seconds"; return(true); } if (examRemainingSecond <= 0) { examRemainingSecond = 61; lblTestScreenTimeReamaining.Text = "Time remaining : " + examRemainigHour + " Hours " + --examReamainingMinute + " Minutes " + --examRemainingSecond + " Seconds"; return(true); } lblTestScreenTimeReamaining.Text = "Time remaining : " + examRemainigHour + " Hours " + examReamainingMinute + " Minutes " + --examRemainingSecond + " Seconds"; } return(true); }); sLblTestScreenTimeRemaining = new StackLayout { Children = { lblTestScreenTimeReamaining }, Orientation = StackOrientation.Horizontal, Padding = new Thickness(0, 30, 0, 10) }; } #endregion #region Question List <QuestionsModel> setOfQuestions = new List <QuestionsModel>(); setOfQuestions = subjectTakenModel.QuestionsList; Label lblQuestion = new Label { HorizontalOptions = LayoutOptions.StartAndExpand, TextColor = Color.White, FontSize = 15, FontAttributes = FontAttributes.None }; if (setOfQuestions.Count >= countQuestion + 1) { lblQuestion.Text = setOfQuestions[countQuestion].QuestionText; } else { lblQuestion.Text = ""; } slblQuestion = new StackLayout { Children = { lblQuestion }, Orientation = StackOrientation.Horizontal, Padding = new Thickness(20, 10, 20, 0) }; #endregion #region answers CustomRadioButton radioAnswerOption1 = new CustomRadioButton(); CustomRadioButton radioAnswerOption2 = new CustomRadioButton(); CustomRadioButton radioAnswerOption3 = new CustomRadioButton(); CustomRadioButton radioAnswerOption4 = new CustomRadioButton(); if (setOfQuestions.Count >= countQuestion + 1) { radioAnswerOption1.Text = setOfQuestions[countQuestion].OptionsList[0].OptionText; radioAnswerOption2.Text = setOfQuestions[countQuestion].OptionsList[1].OptionText; radioAnswerOption3.Text = setOfQuestions[countQuestion].OptionsList[2].OptionText; radioAnswerOption4.Text = setOfQuestions[countQuestion].OptionsList[3].OptionText; bRadioAnswerOptions = new BindableRadioGroup() { Orientation = StackOrientation.Vertical, Padding = new Thickness(20, 10, 20, 5) }; bRadioAnswerOptions.ItemsSource = new[] { radioAnswerOption1.Text, radioAnswerOption2.Text, radioAnswerOption3.Text, radioAnswerOption4.Text }; bRadioAnswerOptions.CheckedChanged += BRadioAnswerOptions_CheckedChanged; } else { radioAnswerOption1.Text = ""; radioAnswerOption2.Text = ""; radioAnswerOption3.Text = ""; radioAnswerOption4.Text = ""; slblQuestion.IsVisible = false; bRadioAnswerOptions.IsVisible = false; sbtnSubmitAnswer.IsVisible = false; sbtnSubmitAnswer2.IsVisible = false; } #endregion #region submit button Button btnSubmitAnswer = new Button { Text = "Next", HorizontalOptions = LayoutOptions.StartAndExpand, BackgroundColor = Color.FromHex("4690FB"), TextColor = Color.White, BorderRadius = 10, WidthRequest = 100, FontAttributes = FontAttributes.Bold }; Button btnCancelExam = new Button { Text = "End test", HorizontalOptions = LayoutOptions.CenterAndExpand, BackgroundColor = Color.FromHex("4690FB"), TextColor = Color.White, BorderRadius = 10, WidthRequest = 100, FontAttributes = FontAttributes.Bold }; Button btnBackToPreviousQuestion = new Button { Text = "Previous", HorizontalOptions = LayoutOptions.EndAndExpand, BackgroundColor = Color.FromHex("4690FB"), TextColor = Color.White, BorderRadius = 10, WidthRequest = 100, FontAttributes = FontAttributes.Bold }; sbtnSubmitAnswer = new StackLayout { Children = { btnSubmitAnswer, btnBackToPreviousQuestion }, Orientation = StackOrientation.Horizontal, Padding = new Thickness(20, 10, 2, 8) }; sbtnSubmitAnswer2 = new StackLayout { Children = { btnCancelExam }, Orientation = StackOrientation.Horizontal, Padding = new Thickness(0, 5, 0, 5) }; if (countQuestion == 0) { btnBackToPreviousQuestion.IsEnabled = false; } btnBackToPreviousQuestion.Clicked += (object sender, EventArgs e) => { if (countQuestion > 1) { countQuestion--; TestExamLayout(subjectTakenModel); } }; btnSubmitAnswer.Clicked += (object sender, EventArgs e) => { subjectTakenModel.CandidateId = 1; subjectTakenModel.BatchId = 6; subjectTakenModel.QuestionId = setOfQuestions[countQuestion].QuestionId; if (_selectedRadio == "first") { subjectTakenModel.SelectedAnswerId = setOfQuestions[countQuestion].OptionsList[0].OptionId; } else if (_selectedRadio == "second") { subjectTakenModel.SelectedAnswerId = setOfQuestions[countQuestion].OptionsList[1].OptionId; } else if (_selectedRadio == "third") { subjectTakenModel.SelectedAnswerId = setOfQuestions[countQuestion].OptionsList[2].OptionId; } else if (_selectedRadio == "fourth") { subjectTakenModel.SelectedAnswerId = setOfQuestions[countQuestion].OptionsList[3].OptionId; } else { subjectTakenModel.SelectedAnswerId = 0; unAnswered++; } _selectedRadio = ""; Device.BeginInvokeOnMainThread(async() => { var result = await Service.SaveAnswer(subjectTakenModel); }); countQuestion++; TestExamLayout(subjectTakenModel); }; #endregion #region stack and content layouts Label lblAfterExamResponse = new Label { HorizontalOptions = LayoutOptions.CenterAndExpand, TextColor = Color.FromHex("7AD169"), FontSize = 17, FontAttributes = FontAttributes.None }; lblAfterExamResponse.IsVisible = false; if (btnStartTest.IsVisible == true) { slblQuestion.IsVisible = false; bRadioAnswerOptions.IsVisible = false; sbtnSubmitAnswer.IsVisible = false; sbtnSubmitAnswer2.IsVisible = false; } if (slblQuestion.IsVisible == false && bRadioAnswerOptions.IsVisible == false && btnStartTest.IsVisible == false) { sbtnSubmitAnswer.IsVisible = false; sbtnSubmitAnswer2.IsVisible = false; lblAfterExamResponse.IsVisible = true; string result = ""; Device.BeginInvokeOnMainThread(async() => { result = await Service.CalculateCandidateTestResult(subjectTakenModel); lblTestScreenTimeReamaining.IsVisible = false; TimeSpan finishedTime = new TimeSpan(examRemainigHour, examReamainingMinute, examRemainingSecond); TimeSpan startedTime = new TimeSpan(subjectTakenModel.ExamDuration / 60, subjectTakenModel.ExamDuration / 60, 0); lblAfterExamResponse.Text = "Test finished. Thank you\n\nRight answers : " + result.ToString() + "\n\nWrong answers : " + (subjectTakenModel.QuestionsList.Count - int.Parse(result)) + "\n\nUnattended : " + (unAnswered++) + "\n\nPercentage : " + ((int.Parse(result) * 100) / subjectTakenModel.QuestionsList.Count) + "%\n\nTime taken : " + startedTime.Subtract(finishedTime); }); } StackLayout slTestScreen = new StackLayout { Children = { sLblTestScreenHeaderText, sbtnStartTest, sLblTestScreenTimeRemaining, slblQuestion, bRadioAnswerOptions, sbtnSubmitAnswer, sbtnSubmitAnswer2,lblAfterExamResponse }, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, Padding = new Thickness(20, 0, 20, 0), BackgroundColor = Color.Gray }; ScrollView svTestScreenDetails = new ScrollView { Content = slTestScreen }; Content = svTestScreenDetails; #endregion } else { Navigation.PushModalAsync(new Login()); } }
void IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.mTitleGrid = (Grid)target; break; case 2: this.mCrossButtonPictureBox = (CustomPictureBox)target; break; case 3: this.mTitleText = (TextBlock)target; break; case 4: this.mHeaderText = (TextBlock)target; break; case 5: this.mMinimizeRadioBtn = (CustomRadioButton)target; break; case 6: this.mMinimizeBtnBodyText = (TextBlock)target; break; case 7: this.mQuitRadioBtn = (CustomRadioButton)target; break; case 8: this.mQuitBtnBodyText = (TextBlock)target; break; case 9: this.mDoNotShowChkBox = (CustomCheckbox)target; break; case 10: this.mBtnActionPanel = (StackPanel)target; break; case 11: this.mCancelBtn = (CustomButton)target; break; case 12: this.mMinimizeBtn = (CustomButton)target; break; case 13: this.mQuitBtn = (CustomButton)target; break; default: this._contentLoaded = true; break; } }
partial void RadioButton3_TouchUpInside(CustomRadioButton sender) { HandleRadioBtnChange(SettingsLanguageSelection.English, sender); }
partial void RadioButton2_TouchUpInside(CustomRadioButton sender) { HandleRadioBtnChange(SettingsLanguageSelection.Nynorsk, sender); }
void IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.mMOBASkillSettingsPopup = (MOBASkillSettingsPopup)target; break; case 2: this.popupPanel = (StackPanel)target; break; case 3: this.mBorder = (Border)target; break; case 4: this.mMaskBorder3 = (Border)target; break; case 5: this.mHeaderGrid = (Grid)target; break; case 6: this.mHelpIcon = (CustomPictureBox)target; this.mHelpIcon.MouseEnter += new MouseEventHandler(this.HelpIcon_MouseEnter); break; case 7: this.mQuickSkill = (CustomRadioButton)target; this.mQuickSkill.PreviewMouseLeftButtonDown += new MouseButtonEventHandler(this.MobaSkillsRadioButton_PreviewMouseLeftButtonDown); break; case 8: this.mAutoSkill = (CustomRadioButton)target; this.mAutoSkill.PreviewMouseLeftButtonDown += new MouseButtonEventHandler(this.MobaSkillsRadioButton_PreviewMouseLeftButtonDown); break; case 9: this.mManualSkill = (CustomRadioButton)target; this.mManualSkill.PreviewMouseLeftButtonDown += new MouseButtonEventHandler(this.MobaSkillsRadioButton_PreviewMouseLeftButtonDown); break; case 10: this.mOtherSettingsGrid = (Grid)target; break; case 11: this.mOtherSettingsHelpIcon = (CustomPictureBox)target; this.mOtherSettingsHelpIcon.MouseEnter += new MouseEventHandler(this.OtherSettingsHelpIcon_MouseEnter); break; case 12: this.mStopMovementCheckbox = (CustomCheckbox)target; this.mStopMovementCheckbox.Checked += new RoutedEventHandler(this.StopMovementCheckbox_Checked); this.mStopMovementCheckbox.Unchecked += new RoutedEventHandler(this.StopMovementCheckbox_Unchecked); break; case 13: this.mMoreSettingsGrid = (Grid)target; this.mMoreSettingsGrid.PreviewMouseLeftButtonUp += new MouseButtonEventHandler(this.MoreSettingsGrid_PreviewMouseLeftButtonUp); break; case 14: this.DownArrow = (Path)target; break; default: this._contentLoaded = true; break; } }
void IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.mMainGrid = (Grid)target; break; case 2: this.mContent = (CustomCheckbox)target; this.mContent.Checked += new RoutedEventHandler(this.Box_Checked); this.mContent.Unchecked += new RoutedEventHandler(this.Box_Unchecked); break; case 3: this.mSingleMacroRecordTextblock = (TextBlock)target; break; case 4: this.mBlock = (Grid)target; break; case 5: this.mMacroImportedAsTextBlock = (TextBlock)target; break; case 6: this.mConflictingMacroOptionsPanel = (StackPanel)target; break; case 7: this.mReplaceExistingBtn = (CustomRadioButton)target; break; case 8: this.mRenameBtn = (CustomRadioButton)target; this.mRenameBtn.Checked += new RoutedEventHandler(this.ConflictingMacroHandlingRadioBtn_Checked); break; case 9: this.mImportName = (CustomTextBox)target; this.mImportName.TextChanged += new TextChangedEventHandler(this.ImportName_TextChanged); break; case 10: this.mWarningMsg = (TextBlock)target; break; case 11: this.mDependentScriptsMsg = (TextBlock)target; break; case 12: this.mDependentScriptsPanel = (StackPanel)target; break; default: this._contentLoaded = true; break; } }
void IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.mScrollBar = (ScrollViewer)target; break; case 2: this.mProfileLoader = (Border)target; break; case 3: this.mNoInternetWarning = (Border)target; break; case 4: this.mChildGrid = (Grid)target; break; case 5: this.mChooseProfile = (CustomRadioButton)target; this.mChooseProfile.Checked += new RoutedEventHandler(this.Profile_Checked); break; case 6: this.mPredefinedProfilesComboBox = (CustomComboBox)target; this.mPredefinedProfilesComboBox.SelectionChanged += new SelectionChangedEventHandler(this.mPredefinedProfilesComboBox_SelectionChanged); break; case 7: this.mCustomProfile = (CustomRadioButton)target; this.mCustomProfile.Checked += new RoutedEventHandler(this.Profile_Checked); break; case 8: this.mCustomProfileGrid = (Grid)target; break; case 9: this.mManufacturerTextBox = (CustomTextBox)target; break; case 10: this.mBrandTextBox = (CustomTextBox)target; break; case 11: this.mModelNumberTextBox = (CustomTextBox)target; break; case 12: this.mTryAgainBtnGrid = (Grid)target; break; case 13: ((ButtonBase)target).Click += new RoutedEventHandler(this.TryAgainBtn_Click); break; case 14: this.mMobileOperatorGrid = (Grid)target; break; case 15: this.mMobileOpertorText = (TextBlock)target; break; case 16: this.mMobileNetworkSetupText = (TextBlock)target; break; case 17: this.mMobileOperatorsCombobox = (CustomComboBox)target; this.mMobileOperatorsCombobox.SelectionChanged += new SelectionChangedEventHandler(this.MobileOperatorsCombobox_SelectionChanged); break; case 18: this.mRootAccessGrid = (Grid)target; break; case 19: this.mEnableRootAccessCheckBox = (CustomCheckbox)target; this.mEnableRootAccessCheckBox.Click += new RoutedEventHandler(this.mEnableRootAccessCheckBox_Click); break; case 20: this.mInfoIcon = (CustomPictureBox)target; break; case 21: this.mSaveChangesBtn = (CustomButton)target; this.mSaveChangesBtn.Click += new RoutedEventHandler(this.SaveChangesBtn_Click); break; default: this._contentLoaded = true; break; } }
void IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.CustomRam = (CustomTextBox)target; break; case 2: this.OrientationComboBox = (CustomComboBox)target; break; case 3: this.ResolutionComboBox = (CustomComboBox)target; break; case 4: this.CustomResolutionTextBoxes = (StackPanel)target; break; case 5: this.CustomResolutionWidth = (CustomTextBox)target; break; case 6: this.CustomResolutionHeight = (CustomTextBox)target; break; case 7: this.mAbi64AutoRadioButtonPanel = (StackPanel)target; this.mAbi64AutoRadioButtonPanel.MouseEnter += new MouseEventHandler(this.CustomRadioButtonAuto_MouseEnter); this.mAbi64AutoRadioButtonPanel.MouseLeave += new MouseEventHandler(this.CustomRadioButtonAuto_MouseLeave); break; case 8: this.mAbi64AutoRadioButton = (CustomRadioButton)target; break; case 9: this.mAbi64ARMRadioButtonPanel = (StackPanel)target; this.mAbi64ARMRadioButtonPanel.MouseEnter += new MouseEventHandler(this.CustomRadioButtonARM_MouseEnter); this.mAbi64ARMRadioButtonPanel.MouseLeave += new MouseEventHandler(this.CustomRadioButtonARM_MouseLeave); break; case 10: this.mAbi64ARMRadioButton = (CustomRadioButton)target; break; case 11: this.mDisabledAbiPopup = (CustomPopUp)target; break; case 12: this.mDisabledAbiPopupBorder = (Border)target; break; default: this._contentLoaded = true; break; } }