ViewGroup DrawTemplate(Node node) { //TEMPLATE var template = new Shape(this, diagram.Context, node, dataModel, FillColor, StrokeColor); template.Layout(0, 0, (int)node.Width, (int)node.Height); //EMP IMAGE var img = new ImageView(diagram.Context); var imageId = (node.Content as DiagramEmployee).ImageUrl; if (imageId != null) { var imageData = LoadResource(imageId).ToArray(); img.SetImageBitmap(BitmapFactory.DecodeByteArray(imageData, 0, imageData.Length)); } img.SetPadding(0, (int)(10 * MainActivity.factor), 0, 0); img.Layout((int)(10 * MainActivity.factor), (int)(10 * MainActivity.factor), (int)(100 * MainActivity.factor), (int)(100 * MainActivity.factor)); //Name of the employee. var name = new TextView(diagram.Context); name.Text = (node.Content as DiagramEmployee).Name; name.SetTextSize(Android.Util.ComplexUnitType.Px, 28 * MainActivity.factor); name.SetTextColor(Color.White); name.SetPadding(0, (int)(10 * MainActivity.factor), 0, 0); name.Layout((int)(110 * MainActivity.factor), (int)(10 * MainActivity.factor), (int)node.Width, (int)node.Height); //Designation of the employee. var designation = new TextView(diagram.Context); designation.Text = (node.Content as DiagramEmployee).Designation; designation.SetTextSize(Android.Util.ComplexUnitType.Px, 28 * MainActivity.factor); designation.SetTextColor(Color.White); designation.SetPadding(0, (int)(10 * MainActivity.factor), 0, 0); designation.Layout((int)(110 * MainActivity.factor), (int)(50 * MainActivity.factor), (int)node.Width, (int)node.Height); if ((node.Content as DiagramEmployee).HasChild) { expanded = new ExpandButton(diagram.Context, node, FillColor); template.SetExpanded(expanded); expanded.Text = "-"; expanded.Typeface = Typeface.Create("Times New Roman", TypefaceStyle.Bold); expanded.TextAlignment = TextAlignment.Center; expanded.Gravity = GravityFlags.Center; expanded.SetTextSize(Android.Util.ComplexUnitType.Px, 54 * MainActivity.factor); expanded.SetTextColor(Color.White); expanded.SetPadding(0, (int)(10 * MainActivity.factor), 0, 0); expanded.SetColor(template.m_color); expanded.SetStrokeColor(template.m_strokeColor); expanded.Layout((int)(350 * MainActivity.factor), 0, (int)(node.Width - 10 * MainActivity.factor), (int)node.Height); template.AddView(expanded); } //Add the view to the template instance. template.AddView(img); template.AddView(name); template.AddView(designation); return(template); }
async void HideBtn_Clicked(System.Object sender, System.EventArgs e) { await SettingsButton.FadeTo(0, 200, Easing.Linear); await HomeButton.FadeTo(0, 200, Easing.Linear); await ExploreButton.FadeTo(0, 200, Easing.Linear); await HideButton.TranslateTo(-deviceWidth - 10, 0, 1000, Easing.SpringOut); await ExpandButton.FadeTo(100, 500, Easing.Linear); HideButton.Opacity = 0; await HideButton.TranslateTo(0, 0, 0); }
async void RevealBtn_Clicked(System.Object s, System.EventArgs e) { await ExpandButton.TranslateTo(deviceWidth + 10, 0, 1000, Easing.SpringOut); await Task.WhenAll( ExploreButton.FadeTo(100, 1000, Easing.CubicIn), HomeButton.FadeTo(100, 1000, Easing.CubicIn), SettingsButton.FadeTo(100, 1000, Easing.CubicIn) ); await HideButton.FadeTo(100, 500, Easing.Linear); ExpandButton.Opacity = 0; await ExpandButton.TranslateTo(0, 0, 0); }
public ViewStoredQuizzes() { InitializeComponent(); QuestionClass qc = new QuestionClass(); Quizzes = qc.LoadQuizzes("%"); //Loads the quizzes from the database that contain any question text QuizListBox.DataSource = Quizzes; //Sets the source for the list box to be the loaded quizzes QuizListBox.DisplayMember = "Name"; //The displayed item from the stored quizzes to be the name of the quiz //Hides the quiz display info so that it only appears when the user clicks on an item QuizNameLabel.Hide(); InsertQuizNameLabel.Hide(); QuestionsLabel.Hide(); QuestionsListBox.Hide(); ExpandButton.Hide(); }
private void QuizListBox_MouseDoubleClick(object sender, MouseEventArgs e) { //Displays the quiz info QuizNameLabel.Show(); InsertQuizNameLabel.Show(); QuestionsLabel.Show(); QuestionsListBox.Show(); ExpandButton.Show(); ChosenQuiz = (StoredQuizzes)QuizListBox.SelectedItem; //The chosen quiz is saved to be the selected item from the list view InsertQuizNameLabel.Text = ChosenQuiz.Name; //The quiz name is displayed QuestionClass qc = new QuestionClass(); SelectedQuestionsId = qc.FindQuestionsId(ChosenQuiz); //Retrives the quiz`s questions ID`s from the database SelectedQuestions = qc.GetStoredQuizQuestions(SelectedQuestionsId); //The ID`s related questions are then returned from the database QuestionsListBox.DataSource = SelectedQuestions; //The data source for the list box displaying the questions is set to the questions QuestionsListBox.DisplayMember = "Question"; //The displayed item from the stored quizzes to be the name of the quiz }
/// <summary> /// /// </summary> /// <param name="r_form"></param> /// <param name="r_path"></param> /// <param name="action"></param> public static ExpandButton FindUserButton(this Transform r_form, string r_path, UnityAction action) { if (r_form == null) { DeBug.LogError($">>>>>>>>>>> 注意:传入 Transform 为空"); return(null); } ExpandButton buttom = r_form.Find(r_path).GetComponent <ExpandButton>(); if (buttom == null) { Debug.LogError($">>>>>>>>>>> 注意:查找的子对象没有 UserButton 组件"); return(null); } else { buttom?.onClick.AddListener(action); return(buttom); } }
private async Task AnimateAll() { m_animationComplete = false; if (!m_isExpanded) { DisplayOverlay(); } else { HideOverlay(); } var multiplier = 1; foreach (var menuButton in Children) { var maxOpacity = menuButton.IsEnabled ? 1 : .5; menuButton.TranslateTo(0, m_isExpanded ? 0 : -m_yTranslate * multiplier, 250, Easing.CubicInOut); menuButton.FadeTo(m_isExpanded ? 0 : maxOpacity, 250, Easing.CubicInOut); multiplier += 1; } if (m_isExpanded) { ExpandButton.FadeTo(.5, 250, Easing.CubicInOut); } else { ExpandButton.FadeTo(1, 250, Easing.CubicInOut); } await ExpandButton.RelRotateTo(180, 250, Easing.CubicInOut); m_isExpanded = !m_isExpanded; m_animationComplete = true; }
internal void SetExpanded(ExpandButton expanded) { m_expanded = expanded; }
private bool ExpandButtonCheck(ExpandButton.state currentState) { bool stateMatch = false; ExpandButton.state exState = ExpandButton.GetCurrentState(); if(exState == currentState){ stateMatch = true; } else{ expandState = exState; } return stateMatch; }
/// <summary> /// /// </summary> /// <param name="user"></param> /// <param name="type"></param> public static void SetUserType(this ExpandButton user, ExpandButton.UserClickType type) { }