コード例 #1
0
		public FontPageCs ()
		{
			var label = new Label {
				Text = "Hello, Forms!",
				Font = Device.OnPlatform (
					Font.OfSize ("SF Hollywood Hills", 24),
					Font.SystemFontOfSize (NamedSize.Medium),
					Font.SystemFontOfSize (NamedSize.Large)
				),
				VerticalOptions = LayoutOptions.CenterAndExpand,
				HorizontalOptions = LayoutOptions.CenterAndExpand,

			};

			var myLabel = new MyLabel {
				Text = "MyLabel for Android!",
				// temporarily disable the size setting, since it's breaking the custom font on 1.2.2 :-(
//				Font = Device.OnPlatform (
//					Font.SystemFontOfSize (NamedSize.Small),
//					Font.SystemFontOfSize (NamedSize.Medium), // will get overridden in custom Renderer
//					Font.SystemFontOfSize (NamedSize.Large)
//				),
				VerticalOptions = LayoutOptions.CenterAndExpand,
				HorizontalOptions = LayoutOptions.CenterAndExpand,
			};

			var labelBold = new Label {
				Text = "Bold",
				Font = Font.SystemFontOfSize (14, FontAttributes.Bold),
				VerticalOptions = LayoutOptions.CenterAndExpand,
				HorizontalOptions = LayoutOptions.CenterAndExpand,
			};
			var labelItalic = new Label {
				Text = "Italic",
				Font = Font.SystemFontOfSize (14, FontAttributes.Italic),
				VerticalOptions = LayoutOptions.CenterAndExpand,
				HorizontalOptions = LayoutOptions.CenterAndExpand,
			};
			var labelBoldItalic = new Label {
				Text = "BoldItalic",
				Font = Font.SystemFontOfSize (14, FontAttributes.Bold | FontAttributes.Italic),
				VerticalOptions = LayoutOptions.CenterAndExpand,
				HorizontalOptions = LayoutOptions.CenterAndExpand,
			};

			Content = new StackLayout { 
				VerticalOptions = LayoutOptions.CenterAndExpand,
				HorizontalOptions = LayoutOptions.CenterAndExpand,
				Children = {
					label, myLabel, labelBold, labelItalic, labelBoldItalic
				}
			};
		}
コード例 #2
0
 /// <summary>
 /// 设计器支持所需的方法 - 不要
 /// 使用代码编辑器修改此方法的内容。
 /// </summary>
 private void InitializeComponent()
 {
     this.components = new System.ComponentModel.Container();
     this.ContextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
     this.tsm隐藏 = new System.Windows.Forms.ToolStripMenuItem();
     this.lblCaption = new Feng.Windows.Forms.MyLabel();
     this.ContextMenuStrip1.SuspendLayout();
     this.SuspendLayout();
     //
     // ContextMenuStrip1
     //
     this.ContextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
     this.tsm隐藏});
     this.ContextMenuStrip1.Name = "tsm隐藏";
     this.ContextMenuStrip1.Size = new System.Drawing.Size(101, 26);
     //
     // tsm隐藏
     //
     this.tsm隐藏.Name = "tsm隐藏";
     this.tsm隐藏.Size = new System.Drawing.Size(100, 22);
     this.tsm隐藏.Text = "隐藏";
     this.tsm隐藏.Click += new System.EventHandler(this.tsm隐藏_Click);
     //
     // lblCaption
     //
     this.lblCaption.ContextMenuStrip = this.ContextMenuStrip1;
     this.lblCaption.Dock = System.Windows.Forms.DockStyle.Left;
     this.lblCaption.Location = new System.Drawing.Point(0, 0);
     this.lblCaption.Name = "lblCaption";
     this.lblCaption.ReadOnly = true;
     this.lblCaption.Size = new System.Drawing.Size(60, 24);
     this.lblCaption.TabIndex = 4;
     this.lblCaption.Text = "状态";
     //
     // CustomSearchControl
     //
     this.Controls.Add(this.lblCaption);
     this.Name = "CustomSearchControl";
     this.Size = new System.Drawing.Size(172, 24);
     this.ContextMenuStrip1.ResumeLayout(false);
     this.ResumeLayout(false);
 }
コード例 #3
0
ファイル: FlightData.cs プロジェクト: neolu/MissionPlanner
        void tabStatus_Resize(object sender, EventArgs e)
        {
            // localise it
            //Control tabStatus = sender as Control;

            //  tabStatus.SuspendLayout();

            //foreach (Control temp in tabStatus.Controls)
            {
                //  temp.DataBindings.Clear();
                //temp.Dispose();
            }
            //tabStatus.Controls.Clear();

            int x = 10;
            int y = 10;

            object thisBoxed = MainV2.comPort.MAV.cs;
            Type test = thisBoxed.GetType();

            PropertyInfo[] props = test.GetProperties();

            //props

            foreach (var field in props)
            {
                // field.Name has the field's name.
                object fieldValue;
                TypeCode typeCode;
                try
                {
                    fieldValue = field.GetValue(thisBoxed, null); // Get value

                    // Get the TypeCode enumeration. Multiple types get mapped to a common typecode.
                    typeCode = Type.GetTypeCode(fieldValue.GetType());

                }
                catch { continue; }

                bool add = true;

                MyLabel lbl1 = new MyLabel();
                MyLabel lbl2 = new MyLabel();
                try
                {
                    lbl1 = (MyLabel)tabStatus.Controls.Find(field.Name, false)[0];

                    lbl2 = (MyLabel)tabStatus.Controls.Find(field.Name + "value", false)[0];

                    add = false;
                }
                catch { }

                if (add)
                {

                    lbl1.Location = new Point(x, y);
                    lbl1.Size = new System.Drawing.Size(75, 13);
                    lbl1.Text = field.Name;
                    lbl1.Name = field.Name;
                    lbl1.Visible = true;
                    lbl2.AutoSize = false;

                    lbl2.Location = new Point(lbl1.Right + 5, y);
                    lbl2.Size = new System.Drawing.Size(50, 13);
                    //if (lbl2.Name == "")
                    lbl2.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.bindingSourceStatusTab, field.Name, false, System.Windows.Forms.DataSourceUpdateMode.Never, "0"));
                    lbl2.Name = field.Name + "value";
                    lbl2.Visible = true;
                    //lbl2.Text = fieldValue.ToString();

                    tabStatus.Controls.Add(lbl1);
                    tabStatus.Controls.Add(lbl2);
                }
                else
                {
                    lbl1.Location = new Point(x, y);
                    lbl2.Location = new Point(lbl1.Right + 5, y);
                }

                //Application.DoEvents();

                x += 0;
                y += 15;

                if (y > tabStatus.Height - 30)
                {
                    x += 140;
                    y = 10;
                }
            }

            tabStatus.Width = x;

            ThemeManager.ApplyThemeTo(tabStatus);

            //   tabStatus.ResumeLayout();
        }
コード例 #4
0
 public Wishlet(Wish w, MyLabel l)
 {
     my_wish  = w;
     my_label = l;
 }
コード例 #5
0
        //解析副窗体
        public static void Parse_SubWindow(UserControl subwindow, SQL_Connect_Builder sql_builder, Grid MainGrid, Running_Data data)
        {
            // 解析所有的Grid
            #region
            string    where_cmd = "ParentWindow='" + subwindow.Name + "'";
            DataTable allgriddt = sql_builder.Select_Table("ALLGrid", where_cmd);
            if (allgriddt != null)
            {
                if (allgriddt.Rows.Count > 0)
                {
                    foreach (DataRow dr in allgriddt.Rows)
                    {
                        Grid grid = new Grid();

                        // 水平对齐
                        if (dr[3].ToString() == "Left")
                        {
                            grid.HorizontalAlignment = HorizontalAlignment.Left;
                        }
                        if (dr[3].ToString() == "Center")
                        {
                            grid.HorizontalAlignment = HorizontalAlignment.Center;
                        }
                        if (dr[3].ToString() == "Right")
                        {
                            grid.HorizontalAlignment = HorizontalAlignment.Right;
                        }
                        if (dr[3].ToString() == "Stretch")
                        {
                            grid.HorizontalAlignment = HorizontalAlignment.Stretch;
                        }

                        // 垂直对齐
                        if (dr[4].ToString() == "Bottom")
                        {
                            grid.VerticalAlignment = VerticalAlignment.Bottom;
                        }
                        if (dr[4].ToString() == "Center")
                        {
                            grid.VerticalAlignment = VerticalAlignment.Center;
                        }
                        if (dr[4].ToString() == "Stretch")
                        {
                            grid.VerticalAlignment = VerticalAlignment.Stretch;
                        }
                        if (dr[4].ToString() == "Top")
                        {
                            grid.VerticalAlignment = VerticalAlignment.Top;
                        }

                        int marginLeft   = int.Parse(dr[5].ToString());
                        int marginRight  = int.Parse(dr[6].ToString());
                        int marginTop    = int.Parse(dr[7].ToString());
                        int marginBottom = int.Parse(dr[8].ToString());

                        grid.Margin     = new Thickness(marginLeft, marginTop, marginRight, marginBottom);
                        grid.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString(dr[9].ToString()));
                        grid.Name       = dr[0].ToString();

                        if (dr[10].ToString() != "")
                        {
                            grid.Width = double.Parse(dr[10].ToString());
                        }
                        if (dr[11].ToString() != "")
                        {
                            grid.Height = double.Parse(dr[11].ToString());
                        }
                        if (dr[2].ToString() == "MainGrid")
                        {
                            // 在主页面下

                            MainGrid.Children.Add(grid);
                        }
                        else
                        {
                            // 不在主页面下
                            string GridName = dr[2].ToString();
                            foreach (UIElement element in MainGrid.Children)
                            {
                                try
                                {
                                    Grid mygrid = (Grid)element;
                                    if (mygrid.Name == dr[2].ToString())
                                    {
                                        mygrid.Children.Add(grid);
                                    }
                                }
                                catch { }
                            }
                        }
                    }
                }
            }
            #endregion

            //  解析所有的MyTreeView
            #region
            where_cmd = "ParentWindow='" + subwindow.Name + "'";
            DataTable allMyTreeView = sql_builder.Select_Table("ALLMyTreeView", where_cmd);
            if (allMyTreeView != null)
            {
                if (allMyTreeView.Rows.Count > 0)
                {
                    foreach (DataRow dr in allMyTreeView.Rows)
                    {
                        DataTable  TreeViewItemsdt = sql_builder.Select_Table(dr[0].ToString());
                        MyTreeView treeview        = new MyTreeView(TreeViewItemsdt);
                        treeview.Name = dr[0].ToString();
                        if (dr[3].ToString() == "Left")
                        {
                            treeview.HorizontalAlignment = HorizontalAlignment.Left;
                        }
                        if (dr[3].ToString() == "Center")
                        {
                            treeview.HorizontalAlignment = HorizontalAlignment.Center;
                        }
                        if (dr[3].ToString() == "Right")
                        {
                            treeview.HorizontalAlignment = HorizontalAlignment.Right;
                        }
                        if (dr[3].ToString() == "Stretch")
                        {
                            treeview.HorizontalAlignment = HorizontalAlignment.Stretch;
                        }

                        // 垂直对齐
                        if (dr[4].ToString() == "Bottom")
                        {
                            treeview.VerticalAlignment = VerticalAlignment.Bottom;
                        }
                        if (dr[4].ToString() == "Center")
                        {
                            treeview.VerticalAlignment = VerticalAlignment.Center;
                        }
                        if (dr[4].ToString() == "Stretch")
                        {
                            treeview.VerticalAlignment = VerticalAlignment.Stretch;
                        }
                        if (dr[4].ToString() == "Top")
                        {
                            treeview.VerticalAlignment = VerticalAlignment.Top;
                        }

                        int marginLeft   = int.Parse(dr[5].ToString());
                        int marginRight  = int.Parse(dr[6].ToString());
                        int marginTop    = int.Parse(dr[7].ToString());
                        int marginBottom = int.Parse(dr[8].ToString());

                        treeview.Margin     = new Thickness(marginLeft, marginTop, marginRight, marginBottom);
                        treeview.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString(dr[9].ToString()));
                        treeview.Name       = dr[0].ToString();

                        if (dr[10].ToString() != "")
                        {
                            treeview.Width = double.Parse(dr[10].ToString());
                        }
                        if (dr[11].ToString() != "")
                        {
                            treeview.Height = double.Parse(dr[11].ToString());
                        }
                        if (dr[2].ToString() == "MainGrid")
                        {
                            // 在主页面下

                            MainGrid.Children.Add(treeview);
                        }
                        else
                        {
                            // 不在主页面下
                            string GridName = dr[2].ToString();
                            foreach (UIElement element in MainGrid.Children)
                            {
                                try
                                {
                                    Grid mygrid = (Grid)element;
                                    if (mygrid.Name == dr[2].ToString())
                                    {
                                        mygrid.Children.Add(treeview);
                                        break;
                                    }
                                }
                                catch { }
                            }
                        }
                    }
                }
            }
            #endregion

            // 解析所有的MyLabel
            #region
            DataTable AllMyLabeldt = sql_builder.Select_Table("AllMyLabel", where_cmd);
            if (AllMyLabeldt != null)
            {
                if (AllMyLabeldt.Rows.Count > 0)
                {
                    foreach (DataRow dr in AllMyLabeldt.Rows)
                    {
                        MyLabel mylabel = new MyLabel(dr, sql_builder, data);
                        if (dr[2].ToString() == "MainGrid")
                        {
                            // 在主页面下

                            MainGrid.Children.Add(mylabel);
                        }
                        else
                        {
                            // 不在主页面下
                            string GridName = dr[2].ToString();
                            foreach (UIElement element in MainGrid.Children)
                            {
                                try
                                {
                                    Grid mygrid = (Grid)element;
                                    if (mygrid.Name == dr[2].ToString())
                                    {
                                        mygrid.Children.Add(mylabel);
                                    }
                                }
                                catch { }
                            }
                        }
                    }
                }
            }
            #endregion

            // 解析所有的MyChart
            #region
            DataTable AllMyChart = sql_builder.Select_Table("ALLMyChart", where_cmd);
            if (AllMyChart != null)
            {
                if (AllMyChart.Rows.Count > 0)
                {
                    foreach (DataRow dr in AllMyChart.Rows)
                    {
                        MyChart mychart = new MyChart(dr, sql_builder);
                        if (dr[2].ToString() == "MainGrid")
                        {
                            // 在主页面下

                            MainGrid.Children.Add(mychart);
                        }
                        else
                        {
                            // 不在主页面下
                            string GridName = dr[2].ToString();
                            foreach (UIElement element in MainGrid.Children)
                            {
                                try
                                {
                                    Grid mygrid = (Grid)element;
                                    if (mygrid.Name == dr[2].ToString())
                                    {
                                        mygrid.Children.Add(mychart);
                                    }
                                }
                                catch { }
                            }
                        }
                    }
                }
            }
            #endregion

            // 解析所有的MyDataGridView
            // 表格分种类
            #region
            DataTable AllDataGridView = sql_builder.Select_Table("AllDataGrid", where_cmd);
            if (AllDataGridView != null)
            {
                if (AllDataGridView.Rows.Count > 0)
                {
                    foreach (DataRow dr in AllDataGridView.Rows)
                    {
                        // 顺序表
                        if (dr[1].ToString() == "OrderTable")
                        {
                            // 读取表格
                            DataTable gongyibiao = sql_builder.Select_Table(dr[0].ToString());
                            if (gongyibiao == null)
                            {
                                return;
                            }

                            MyOrderDataGridView datagridview = new MyOrderDataGridView(gongyibiao, dr);
                            if (dr[3].ToString() == "MainGrid")
                            {
                                // 在主页面下
                                MainGrid.Children.Add(datagridview);
                            }
                            else
                            {
                                // 不在主页面下
                                string GridName = dr[3].ToString();
                                foreach (UIElement element in MainGrid.Children)
                                {
                                    try
                                    {
                                        Grid mygrid = (Grid)element;
                                        if (mygrid.Name == dr[2].ToString())
                                        {
                                            mygrid.Children.Add(datagridview);
                                        }
                                    }
                                    catch { }
                                }
                            }
                        }
                    }
                }
            }
            #endregion
        }
コード例 #6
0
ファイル: StyleTests.cs プロジェクト: sung-su/maui
        public void MultipleStylesCanShareTheSameClassName()
        {
            var buttonStyle = new Style(typeof(Button))
            {
                Setters =
                {
                    new Setter {
                        Property = Button.TextColorProperty, Value = Colors.Pink
                    },
                },
                Class = "pink",
                ApplyToDerivedTypes = true,
            };
            var labelStyle = new Style(typeof(Label))
            {
                Setters =
                {
                    new Setter {
                        Property = Button.BackgroundColorProperty, Value = Colors.Pink
                    },
                },
                Class = "pink",
                ApplyToDerivedTypes = false,
            };


            var button = new Button
            {
                StyleClass = new[] { "pink" },
            };
            var myButton = new MyButton
            {
                StyleClass = new[] { "pink" },
            };

            var label = new Label
            {
                StyleClass = new[] { "pink" },
            };
            var myLabel = new MyLabel
            {
                StyleClass = new[] { "pink" },
            };


            new StackLayout
            {
                Resources = new ResourceDictionary {
                    buttonStyle, labelStyle
                },
                Children =
                {
                    button,
                    label,
                    myLabel,
                    myButton,
                }
            };

            Assert.AreEqual(Colors.Pink, button.TextColor);
            Assert.AreEqual(null, button.BackgroundColor);

            Assert.AreEqual(Colors.Pink, myButton.TextColor);
            Assert.AreEqual(null, myButton.BackgroundColor);

            Assert.AreEqual(Colors.Pink, label.BackgroundColor);
            Assert.AreEqual(null, label.TextColor);

            Assert.AreEqual(null, myLabel.BackgroundColor);
            Assert.AreEqual(null, myLabel.TextColor);
        }
コード例 #7
0
ファイル: Methods.cs プロジェクト: bracikaa/gms
        public void GetMembers(List <PartialMember> members)
        {
            try
            {
                using (SqlConnection connection = new SqlConnection(
                           global::GymMembershipSystem.Properties.Settings.Default.GymMembershipSystemDatabase))
                {
                    using (SqlCommand command = new SqlCommand("SELECT id, Name, Surname, Address, PhoneNumber, CardId, TypeId," +
                                                               " NumOfEntrances, Gender, LastEntrance FROM Member ORDER BY Surname ASC", connection))
                    {
                        command.CommandType = CommandType.Text;
                        connection.Open();
                        SqlDataReader dr = command.ExecuteReader();
                        while (dr.Read())
                        {
                            int      id           = Convert.ToInt32(dr["id"]);
                            string   name         = dr["Name"].ToString();
                            string   surname      = dr["Surname"].ToString();
                            string   address      = dr["Address"].ToString();
                            string   phonenum     = dr["PhoneNumber"].ToString();
                            string   typeid       = dr["TypeId"].ToString();
                            int      numofentr    = Convert.ToInt32(dr["NumOfEntrances"]);
                            Int64    cardid       = Convert.ToInt64(dr["CardId"]);
                            DateTime lastEntrance = Convert.ToDateTime(dr["LastEntrance"]);
                            string   gender       = dr["Gender"].ToString();

                            DateTime expDate = GetExpirationDate(id);

                            PartialMember newMember = new PartialMember();

                            newMember.Name           = name;
                            newMember.Surname        = surname;
                            newMember.Address        = address;
                            newMember.PhoneNumber    = phonenum;
                            newMember.TypeId         = typeid;
                            newMember.NumOfEntrances = numofentr;
                            newMember.ExpirationDate = expDate;
                            newMember.CardId         = cardid;
                            newMember.LastEntrance   = lastEntrance;
                            newMember.Gender         = gender;
                            newMember.id             = id;
                            newMember.NumOfDays      = GetNumberOfEntrances(cardid.ToString());
                            members.Add(newMember);
                        }
                        connection.Close();
                    }
                }
            }
            catch (Exception ex)
            {
                List <Label> Labels = new List <Label>();
                Labels.Add(MyLabel.SetOKLabel("General Error"));
                Labels.Add(MyLabel.SetOKLabel(ex.Message));

                List <Button> Buttons = new List <Button>();
                Buttons.Add(MyButton.SetOKThemeButton());
                MyMessageBox.Show(
                    Labels,
                    "",
                    Buttons,
                    MyImage.SetFailed());
            }
        }
コード例 #8
0
    public void CheckUpgrades()
    {
        bool special_skills_mode = (this is LevelList_Toy_Button_Driver);


        foreach (KeyValuePair <Toy_Button, Button> kvp in drivers[current_driver].button_map)
        {
            Toy_Button button = kvp.Key;
            if (parent == null && !special_skills_mode)
            {
                return;
            }
            Rune check_rune = getCheckRune(button);

            RuneType check_me_instead = RuneType.Sensible; // instead of parent.rune.runetype

            if (check_rune != null && UpgradeButton(button.type))

            {
//specialskillmode has a separate upgrade button
                //StateType status = (special_skills_mode) ? StateType.Yes : check_rune.CanUpgrade(button.effect_type, check_me_instead);
                StateType status     = check_rune.CanUpgrade(button.effect_type, check_me_instead);
                StateType have_skill = (check_rune.haveUpgrade(button.effect_type)) ? StateType.Yes : status;

                button.setState(status);
                button.setButtonImage(have_skill);
            }
            else if (!UpgradeButton(button.type))
            {
                if (check_rune == null)
                {
                    continue;
                }

                if (button.type.Equals("sell"))
                {
                    kvp.Value.gameObject.SetActive(!(check_rune.toy_type == ToyType.Hero ||
                                                     check_rune.runetype == RuneType.Castle));
                }
                else if (button.type.Equals("move_confirm"))
                {
                    kvp.Value.gameObject.SetActive(check_rune.toy_type == ToyType.Hero);
                }
                else if (button.type.Equals("reset_special_skills") || button.type.Equals("reset_skills"))
                {
                    kvp.Value.gameObject.SetActive(check_rune.toy_type == ToyType.Hero);
                }
            }
            else
            {
                button.setState(StateType.No);
                button.setButtonImage(StateType.No);
            }
        }
        StatSum statsum = null;

        if (!special_skills_mode)
        {
            statsum = parent.rune.GetStats(false);
        }
        List <MyLabel> labels = drivers[current_driver].labels;

        for (int i = 0; i < labels.Count; i++)
        {
            MyLabel label      = labels[i];
            Rune    check_rune = null;

            if (special_skills_mode)
            {
                check_rune = Central.Instance.getHeroRune(label.runetype);
            }
            else
            {
                check_rune = parent.rune;
            }

            statsum = (check_rune != null) ? check_rune.GetStats(special_skills_mode) : null;

            if (label.type.Equals("current_score"))
            {
                labels[i].text.text = Get.Round(ScoreKeeper.Instance.getTotalScore(), 0).ToString();
            }
        }
    }
コード例 #9
0
        private void LoadNonAssignedApplication()
        {
            List <ActiveApplication> titlesAllNotAssignedApplication = ActiveApplication_db.GetNonAssignedApplication();

            titlesAllNotAssignedApplication.AddRange(ActiveApplication_db.GetNonAssignedApplicationWithGroup());
            titlesAllNotAssignedApplication = titlesAllNotAssignedApplication.OrderByDescending(x => x.Date).ToList();
            Dictionary <string, string> titleMembership = Membership_db.GetNameGroupsDictionaryIfIsActive(false);

            titleMembership["0"] = "Brak przynależności";

            for (int i = 0; i < titlesAllNotAssignedApplication.Count; i++)
            {
                Thread.Sleep(10);
                Application.Current.Dispatcher.Invoke(() => {
                    nonAssignedAppCanvas = new Canvas();
                    nonAssignedAppCanvas = CanvasCreator.CreateCanvas(nonAssignedApplications, 560, 60,
                                                                      Color.FromArgb(0, 110, 0, 0), 0, 59 * i);
                });
                string titleApplication = string.Empty;
                titleApplication = (titlesAllNotAssignedApplication[i].Title.Length > 40) ?
                                   titlesAllNotAssignedApplication[i].Title.Remove(40, titlesAllNotAssignedApplication[i].Title.Length - 40) : titlesAllNotAssignedApplication[i].Title;

                Application.Current.Dispatcher.Invoke(() =>
                {
                    new MyCircle(nonAssignedAppCanvas, 46, 2, Color.FromArgb(255, 150, 150, 150), 8, 8, 1, true);

                    MyLabel l = new MyLabel(nonAssignedAppCanvas, "\t" + titleApplication,
                                            560, 60, 14, 0, 0, Color.FromArgb(255, 120, 120, 120), Color.FromArgb(30, 100, 100, 100), 1,
                                            HorizontalAlignment.Left, fontWeight: FontWeights.Bold);
                    l.ToolTip(titlesAllNotAssignedApplication[i].Title);

                    new MyLabel(nonAssignedAppCanvas, ActionOnString.GetFirstLetterFromString(titleApplication), 50, 50, 20, 6, 11, Color.FromArgb(255, 240, 240, 240),
                                Color.FromArgb(0, 100, 100, 100), 0, HorizontalAlignment.Center, fontWeight: FontWeights.ExtraBold);

                    new MyLabel(nonAssignedAppCanvas, titleMembership[titlesAllNotAssignedApplication[i].IdMembership.ToString()], 300, 30, 12, 60, 30,
                                Color.FromArgb(255, 120, 120, 120), Color.FromArgb(30, 100, 100, 100), horizontalAlignment: HorizontalAlignment.Left);

                    new MyLabel(nonAssignedAppCanvas, ActionOnTime.GetNumberDayAgo(titlesAllNotAssignedApplication[i].Date), 100, 30, 13, 466, 0, Color.FromArgb(255, 120, 120, 120),
                                Color.FromArgb(30, 100, 100, 100), horizontalAlignment: HorizontalAlignment.Left);

                    new MyLabel(nonAssignedAppCanvas, "(" + (titlesAllNotAssignedApplication.Count - i) + ")", 100, 30, 9, 420, 0, Color.FromArgb(255, 120, 120, 120),
                                Color.FromArgb(30, 100, 100, 100), horizontalAlignment: HorizontalAlignment.Left);

                    new MyCircle(nonAssignedAppCanvas, 25, 1, (Color.FromArgb(255, 0, 123, 255)), 525, 28, setFill: true);

                    Label buttonAddActivity = ButtonCreator.CreateButton(nonAssignedAppCanvas, "+", 25, 34, 20, 525, 28,
                                                                         Color.FromArgb(255, 255, 255, 255), Color.FromArgb(200, 255, 0, 0), 0, fontWeight: FontWeights.ExtraBold);
                    buttonAddActivity.Margin               = new Thickness(0, -8, 0, 0);
                    nonAssignedAppCanvas.Name              = "ID_" + titlesAllNotAssignedApplication[i].ID;
                    nonAssignedAppCanvas.Tag               = titlesAllNotAssignedApplication[i].IdMembership;
                    buttonAddActivity.MouseLeftButtonDown += buttonAddActivity_MouseLeftButtonDown;
                    nonAssignedApplications.Height        += 59;
                });
            }
            Application.Current.Dispatcher.Invoke(() =>
            {
                nonAssignedApplications.Height = ((nonAssignedApplications.Height - 300) < 300) ? 300 : nonAssignedApplications.Height - 299;
            });
            loadingWindow.notClose = false;
            Thread.Sleep(200);
            backgroundWorkerLoadingWindow.DoWork -= loadingWindow.Load;
            backgroundWorkerLoadingWindow.DoWork += loadingWindow.Close;
            backgroundWorkerLoadingWindow.RunWorkerAsync();
        }
コード例 #10
0
        public View GetView(bool WithBinding)
        {
            if (WithBinding)
            {
                this.SetBinding(CustomArticleListCell.ArticleIdProperty, "Id");
            }

            Grid GridWrapper = new Grid()
            {
                Padding           = new Thickness(5, 0),
                RowSpacing        = 1,
                ColumnSpacing     = 1,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                BackgroundColor   = Color.FromHex(WithBinding ? "#DCE6FA" : "#0062C4")
            };

            GridWrapper.RowDefinitions.Add(new RowDefinition()
            {
                Height = 25
            });
            GridWrapper.RowDefinitions.Add(new RowDefinition()
            {
                Height = WithBinding ? 45 : 25
            });

            GridWrapper.ColumnDefinitions.Add(new ColumnDefinition()
            {
                Width = new GridLength(4, GridUnitType.Star)
            });
            GridWrapper.ColumnDefinitions.Add(new ColumnDefinition()
            {
                Width = new GridLength(4, GridUnitType.Star)
            });
            GridWrapper.ColumnDefinitions.Add(new ColumnDefinition()
            {
                Width = new GridLength(0.5, GridUnitType.Star)
            });
            GridWrapper.ColumnDefinitions.Add(new ColumnDefinition()
            {
                Width = new GridLength(1, GridUnitType.Star)
            });
            GridWrapper.ColumnDefinitions.Add(new ColumnDefinition()
            {
                Width = new GridLength(2, GridUnitType.Star)
            });
            GridWrapper.ColumnDefinitions.Add(new ColumnDefinition()
            {
                Width = new GridLength(1, GridUnitType.Star)
            });
            GridWrapper.ColumnDefinitions.Add(new ColumnDefinition()
            {
                Width = new GridLength(2, GridUnitType.Star)
            });
            GridWrapper.ColumnDefinitions.Add(new ColumnDefinition()
            {
                Width = new GridLength(4, GridUnitType.Star)
            });

            Label CodeLabel     = null,
                  NameLabel     = null,
                  QuantityLabel = null,
                  PriceLabel    = null,
                  CurrentDiscountPercentLabel    = null,
                  DiscountAmountLabel            = null,
                  AfterDiscountReductionLabel    = null,
                  AddedDiscountPercentPlusLabel  = null,
                  AddedDiscountPercentMinusLabel = null;
            Label AddedDiscountPercentEntry      = null;


            CodeLabel = new Label()
            {
                LineBreakMode = LineBreakMode.HeadTruncation, TextColor = Color.FromHex(WithBinding ? "222" : "fff"), HorizontalOptions = LayoutOptions.End, HorizontalTextAlignment = TextAlignment.End, VerticalOptions = LayoutOptions.Center, FontSize = 16
            };
            NameLabel = new Label()
            {
                LineBreakMode = LineBreakMode.TailTruncation, TextColor = Color.FromHex(WithBinding ? "222" : "fff"), HorizontalOptions = LayoutOptions.End, HorizontalTextAlignment = TextAlignment.End, VerticalOptions = LayoutOptions.Center, FontSize = 16
            };
            QuantityLabel = new Label()
            {
                LineBreakMode = LineBreakMode.TailTruncation, TextColor = Color.FromHex(WithBinding ? "222" : "fff"), HorizontalOptions = LayoutOptions.End, HorizontalTextAlignment = TextAlignment.End, VerticalOptions = LayoutOptions.Center, FontSize = 16
            };
            PriceLabel = new Label()
            {
                LineBreakMode = LineBreakMode.TailTruncation, TextColor = Color.FromHex(WithBinding ? "222" : "fff"), HorizontalOptions = LayoutOptions.End, HorizontalTextAlignment = TextAlignment.Start, VerticalOptions = LayoutOptions.Center, FontSize = 16
            };
            CurrentDiscountPercentLabel = new Label()
            {
                LineBreakMode = LineBreakMode.TailTruncation, TextColor = Color.FromHex(WithBinding ? "222" : "fff"), HorizontalOptions = LayoutOptions.End, HorizontalTextAlignment = TextAlignment.Start, VerticalOptions = LayoutOptions.Center, FontSize = 16
            };
            AddedDiscountPercentEntry = new MyLabel()
            {
                LineBreakMode = LineBreakMode.TailTruncation, TextColor = Color.FromHex("222"), HorizontalOptions = LayoutOptions.FillAndExpand, HorizontalTextAlignment = TextAlignment.Center, VerticalOptions = LayoutOptions.Center, VerticalTextAlignment = TextAlignment.Center, FontSize = 16, Margin = 0, BackgroundColor = Color.FromHex("fff"), Padding = new Thickness(10)
            };
            AddedDiscountPercentPlusLabel = new RightEntryCompanionLabel()
            {
                Text = "+", TextColor = Color.FromHex("222"), HorizontalOptions = LayoutOptions.FillAndExpand, HorizontalTextAlignment = TextAlignment.Center, VerticalOptions = LayoutOptions.Center, FontSize = 16
            };
            AddedDiscountPercentMinusLabel = new LeftEntryCompanionLabel()
            {
                Text = "-", TextColor = Color.FromHex("222"), HorizontalOptions = LayoutOptions.FillAndExpand, HorizontalTextAlignment = TextAlignment.Center, VerticalOptions = LayoutOptions.Center, FontSize = 16
            };
            DiscountAmountLabel = new Label()
            {
                LineBreakMode = LineBreakMode.TailTruncation, TextColor = Color.FromHex(WithBinding ? "222" : "fff"), HorizontalOptions = LayoutOptions.End, HorizontalTextAlignment = TextAlignment.Start, VerticalOptions = LayoutOptions.Center, FontSize = 16
            };
            AfterDiscountReductionLabel = new Label()
            {
                LineBreakMode = LineBreakMode.TailTruncation, TextColor = Color.FromHex(WithBinding ? "222" : "fff"), HorizontalOptions = LayoutOptions.End, HorizontalTextAlignment = TextAlignment.Start, VerticalOptions = LayoutOptions.Center, FontSize = 16
            };

            GridWrapper.Children.Add(CodeLabel, 7, 0);
            GridWrapper.Children.Add(NameLabel, 1, 0);
            Grid.SetColumnSpan(NameLabel, 6);
            GridWrapper.Children.Add(QuantityLabel, 0, 0);

            GridWrapper.Children.Add(AfterDiscountReductionLabel, 0, 1);
            if (WithBinding)
            {
                GridWrapper.Children.Add(DiscountAmountLabel, 1, 1);
                GridWrapper.Children.Add(AddedDiscountPercentMinusLabel, 3, 1);
                GridWrapper.Children.Add(AddedDiscountPercentEntry, 4, 1);
                GridWrapper.Children.Add(AddedDiscountPercentPlusLabel, 5, 1);
                GridWrapper.Children.Add(CurrentDiscountPercentLabel, 6, 1);
            }
            else
            {
                GridWrapper.Children.Add(DiscountAmountLabel, 1, 1);
                GridWrapper.Children.Add(CurrentDiscountPercentLabel, 3, 1);
                Grid.SetColumnSpan(CurrentDiscountPercentLabel, 4);
            }
            GridWrapper.Children.Add(PriceLabel, 7, 1);

            if (WithBinding)
            {
                CodeLabel.SetBinding(Label.TextProperty, "StuffCode");
                NameLabel.SetBinding(Label.TextProperty, "StuffName");
                QuantityLabel.SetBinding(Label.TextProperty, "Quantity");
                PriceLabel.SetBinding(Label.TextProperty, "SalePrice");
                CurrentDiscountPercentLabel.SetBinding(Label.TextProperty, "CurrentDiscountPercent");
                AddedDiscountPercentEntry.SetBinding(Label.TextProperty, "AddedDiscountPercentLabel");
                DiscountAmountLabel.SetBinding(Label.TextProperty, "DiscountAmount");
                AfterDiscountReductionLabel.SetBinding(Label.TextProperty, "AfterDiscountReduction");
            }
            else
            {
                CodeLabel.Text     = "کد کالا";
                NameLabel.Text     = "نام کالا";
                QuantityLabel.Text = "تعداد";
                PriceLabel.Text    = "مبلغ ناخالص";
                CurrentDiscountPercentLabel.Text = "تخفیف(%)";
                DiscountAmountLabel.Text         = "تخفیف($)";
                AfterDiscountReductionLabel.Text = "با کسر تخفیف";
            }

            var AddedDiscountPercentPlusTapGestureRecognizer = new TapGestureRecognizer();

            AddedDiscountPercentPlusTapGestureRecognizer.Tapped += AddedDiscountPercentPlusTapEventHandler;
            AddedDiscountPercentPlusTapGestureRecognizer.SetBinding(TapGestureRecognizer.CommandParameterProperty, "Id");
            AddedDiscountPercentPlusLabel.GestureRecognizers.Add(AddedDiscountPercentPlusTapGestureRecognizer);

            var AddedDiscountPercentMinusTapGestureRecognizer = new TapGestureRecognizer();

            AddedDiscountPercentMinusTapGestureRecognizer.Tapped += AddedDiscountPercentMinusTapEventHandler;
            AddedDiscountPercentMinusTapGestureRecognizer.SetBinding(TapGestureRecognizer.CommandParameterProperty, "Id");
            AddedDiscountPercentMinusLabel.GestureRecognizers.Add(AddedDiscountPercentMinusTapGestureRecognizer);

            var AddedDiscountPercentTextBoxTapGestureRecognizer = new TapGestureRecognizer();

            AddedDiscountPercentTextBoxTapGestureRecognizer.Tapped += AddedDiscountPercentTextBoxTapEventHandler;
            AddedDiscountPercentTextBoxTapGestureRecognizer.SetBinding(TapGestureRecognizer.CommandParameterProperty, "Id");
            AddedDiscountPercentEntry.GestureRecognizers.Add(AddedDiscountPercentTextBoxTapGestureRecognizer);

            return(GridWrapper);
        }
コード例 #11
0
 public int UpdateLabelById(MyLabel updateId)
 {
     Dbobj.Entry <MyLabel>(updateId).State = Microsoft.EntityFrameworkCore.EntityState.Modified;
     return(Dbobj.SaveChanges());
 }
コード例 #12
0
 public int CreateLabel(MyLabel labelId)
 {
     Dbobj.MyLabels.Add(labelId);
     return(Dbobj.SaveChanges());
 }
コード例 #13
0
ファイル: MainWindow.xaml.cs プロジェクト: korolitskyi/Sudoku
        void Label_LostFocus(object sender, RoutedEventArgs e)
        {
            MyLabel lbl = (MyLabel)sender;

            controller.UnSelectLabels(lbl);
        }
コード例 #14
0
        public FontPageCs()
        {
            var label = new Label {
                Text = "Hello, Forms!",
                Font = Device.OnPlatform(
                    Font.OfSize("SF Hollywood Hills", 24),
                    Font.SystemFontOfSize(NamedSize.Medium),
                    Font.SystemFontOfSize(NamedSize.Large)
                    ),
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
            };

            var myLabel = new MyLabel {
                Text = "MyLabel for Android!",
                // temporarily disable the size setting, since it's breaking the custom font on 1.2.2 :-(
//				Font = Device.OnPlatform (
//					Font.SystemFontOfSize (NamedSize.Small),
//					Font.SystemFontOfSize (NamedSize.Medium), // will get overridden in custom Renderer
//					Font.SystemFontOfSize (NamedSize.Large)
//				),
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
            };

            var labelBold = new Label {
                Text              = "Bold",
                Font              = Font.SystemFontOfSize(14, FontAttributes.Bold),
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
            };
            var labelItalic = new Label {
                Text              = "Italic",
                Font              = Font.SystemFontOfSize(14, FontAttributes.Italic),
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
            };
            var labelBoldItalic = new Label {
                Text              = "BoldItalic",
                Font              = Font.SystemFontOfSize(14, FontAttributes.Bold | FontAttributes.Italic),
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
            };


            // Span formatting support
            var labelFormatted = new Label();
            var fs             = new FormattedString();

            fs.Spans.Add(new Span {
                Text = "Red, ", ForegroundColor = Color.Red, Font = Font.SystemFontOfSize(20, FontAttributes.Italic)
            });
            fs.Spans.Add(new Span {
                Text = " blue, ", ForegroundColor = Color.Blue, Font = Font.SystemFontOfSize(32)
            });
            fs.Spans.Add(new Span {
                Text = " and green!", ForegroundColor = Color.Green, Font = Font.SystemFontOfSize(12)
            });
            labelFormatted.FormattedText = fs;


            Content = new StackLayout {
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                Children          =
                {
                    label, myLabel, labelBold, labelItalic, labelBoldItalic, labelFormatted
                }
            };
        }
コード例 #15
0
 private void PasswordChange_Load(object sender, EventArgs e)
 {
     MyLabel.Hide();
     button2.Hide();
 }
コード例 #16
0
        public FileTransferPage() : base("File Transfer")
        {
            MyLogger.TestMethodAdded += (name, task) =>
            {
                var ti = new MyToolbarItem(name);
                ti.Clicked += async delegate { await task(); };
                this.ToolbarItems.Add(ti);
            };
            {
                GDmain = new MyGrid();
                GDmain.RowDefinitions.Add(new Xamarin.Forms.RowDefinition {
                    Height = new Xamarin.Forms.GridLength(1, Xamarin.Forms.GridUnitType.Auto)
                });
                GDmain.RowDefinitions.Add(new Xamarin.Forms.RowDefinition {
                    Height = new Xamarin.Forms.GridLength(1, Xamarin.Forms.GridUnitType.Star)
                });
                {
                    GDctrl = new MyGrid();
                    GDctrl.ColumnDefinitions.Add(new Xamarin.Forms.ColumnDefinition {
                        Width = new Xamarin.Forms.GridLength(3, Xamarin.Forms.GridUnitType.Star)
                    });
                    GDctrl.ColumnDefinitions.Add(new Xamarin.Forms.ColumnDefinition {
                        Width = new Xamarin.Forms.GridLength(1, Xamarin.Forms.GridUnitType.Star)
                    });
                    GDctrl.ColumnDefinitions.Add(new Xamarin.Forms.ColumnDefinition {
                        Width = new Xamarin.Forms.GridLength(2, Xamarin.Forms.GridUnitType.Star)
                    });
                    GDctrl.ColumnDefinitions.Add(new Xamarin.Forms.ColumnDefinition {
                        Width = new Xamarin.Forms.GridLength(4, Xamarin.Forms.GridUnitType.Star)
                    });
                    GDctrl.ColumnDefinitions.Add(new Xamarin.Forms.ColumnDefinition {
                        Width = new Xamarin.Forms.GridLength(1, Xamarin.Forms.GridUnitType.Star)
                    });
                    GDctrl.ColumnDefinitions.Add(new Xamarin.Forms.ColumnDefinition {
                        Width = new Xamarin.Forms.GridLength(1, Xamarin.Forms.GridUnitType.Star)
                    });
                    GDctrl.ColumnDefinitions.Add(new Xamarin.Forms.ColumnDefinition {
                        Width = new Xamarin.Forms.GridLength(1, Xamarin.Forms.GridUnitType.Star)
                    });
                    GDctrl.ColumnDefinitions.Add(new Xamarin.Forms.ColumnDefinition {
                        Width = new Xamarin.Forms.GridLength(1, Xamarin.Forms.GridUnitType.Star)
                    });
                    GDctrl.ColumnDefinitions.Add(new Xamarin.Forms.ColumnDefinition {
                        Width = new Xamarin.Forms.GridLength(1, Xamarin.Forms.GridUnitType.Star)
                    });
                    int columnNumber = 0;
                    {
                        var sw = new MySwitch("Auto Restart Failed tasks", "Manual Restart Failed Tasks", false);
                        FTmain       = new FileTransferContentView();
                        sw.Toggled  += delegate { FTmain.SetAutoRestartFailedTasks(sw.IsToggled); };
                        sw.IsToggled = true;
                        GDctrl.Children.Add(sw, columnNumber++, 0);
                    }
                    {
                        var toSpeedText = new Func <long, string>((value) =>
                        {
                            double v = value;
                            if (v <= 1023)
                            {
                                return($"{v.ToString("F5").Remove(5).PadRight(5, '0')} B/s");
                            }
                            v /= 1024;
                            if (v <= 1023)
                            {
                                return($"{v.ToString("F5").Remove(5).PadRight(5, '0')} KB/s");
                            }
                            v /= 1024;
                            return($"{v.ToString("F5").Remove(5).PadRight(5, '0')} MB/s");
                        });
                        var lbl = new MyLabel($"{toSpeedText(0)}")
                        {
                            VerticalTextAlignment = TextAlignment.Center
                        };
                        System.Threading.SemaphoreSlim semaphoreSlim = new System.Threading.SemaphoreSlim(1, 1);
                        long totalAmountSent = 0;
                        CloudFile.Networker.ChunkProcceeded += async(coda) =>
                        {
                            totalAmountSent += coda;
                            DateTime startTime = DateTime.Now;
                            await semaphoreSlim.WaitAsync();

                            while ((DateTime.Now - startTime).TotalSeconds <= 5)
                            {
                                lbl.Text = $"{toSpeedText(totalAmountSent / 5)}";
                                await Task.Delay(100);
                            }
                            totalAmountSent -= coda;
                            lbl.Text         = toSpeedText(totalAmountSent / 5);
                            lock (semaphoreSlim) semaphoreSlim.Release();
                        };
                        GDctrl.Children.Add(lbl, columnNumber++, 0);
                    }
                    {
                        var btn = new MyButton("Reset");
                        GDctrl.Children.Add(btn, columnNumber++, 0);
                        var lbl = new MyLabel("")
                        {
                            VerticalTextAlignment = TextAlignment.Center
                        };
                        long totalAmountLeft = 0, totalFilesLeft = 0, totalFoldersLeft = 0;
                        long totalAmount = 0, totalFiles = 0, totalFolders = 0;
                        btn.Clicked += async delegate
                        {
                            btn.IsEnabled = false;
                            if (await MyLogger.Ask("Are you sure to reset the statistic data?\r\nIncluding: total data amount, file count, folder count"))
                            {
                                totalAmount = totalFiles = totalFolders = 0;
                            }
                            btn.IsEnabled = true;
                        };
                        var toSizeText = new Func <long, string>((value) =>
                        {
                            double v = value;
                            if (v <= 1023)
                            {
                                return($"{v.ToString("F5").Remove(5)} B");
                            }
                            v /= 1024;
                            if (v <= 1023)
                            {
                                return($"{v.ToString("F5").Remove(5)} KB");
                            }
                            v /= 1024;
                            if (v <= 1023)
                            {
                                return($"{v.ToString("F5").Remove(5)} MB");
                            }
                            v /= 1024;
                            if (v <= 1023)
                            {
                                return($"{v.ToString("F5").Remove(5)} GB");
                            }
                            v /= 1024;
                            return($"{v.ToString("F5").Remove(5)} TB");
                        });
                        System.Threading.SemaphoreSlim semaphoreSlim = new System.Threading.SemaphoreSlim(1, 1);
                        DateTime lastUpdate = DateTime.MinValue;
                        var      showResult = new Func <Task>(async() =>
                        {
                            var updateTime = DateTime.Now;
                            await semaphoreSlim.WaitAsync();
                            if (updateTime <= lastUpdate)
                            {
                                return;
                            }
                            lbl.Text = $"{toSizeText(totalAmountLeft)} / {toSizeText(totalAmount)}   \t{totalFilesLeft } / {totalFiles} files   \t{totalFoldersLeft } / {totalFolders} folders";
                            await Task.Delay(100);
                            lock (semaphoreSlim) semaphoreSlim.Release();
                        });
                        CloudFile.Networker.TotalAmountRemainChanged += async(coda) => { if (coda < 0)
                                                                                         {
                                                                                             totalAmount -= coda;
                                                                                         }
                                                                                         totalAmountLeft += coda; await showResult(); };
                        CloudFile.Networker.TotalFilesRemainChanged += async(coda) => { if (coda < 0)
                                                                                        {
                                                                                            totalFiles -= coda;
                                                                                        }
                                                                                        totalFilesLeft += coda; await showResult(); };
                        CloudFile.Networker.TotalFoldersRemainChanged += async(coda) => { if (coda < 0)
                                                                                          {
                                                                                              totalFolders -= coda;
                                                                                          }
                                                                                          totalFoldersLeft += coda; await showResult(); };
                        GDctrl.Children.Add(lbl, columnNumber++, 0);
                    }
                    {
                        var actions = new Dictionary <CloudFile.Networker.NetworkStatus, Func <int, Task> >();
                        foreach (var status in Enum.GetValues(typeof(CloudFile.Networker.NetworkStatus)).Cast <CloudFile.Networker.NetworkStatus>())
                        {
                            networkers[status] = new HashSet <CloudFile.Networker>();
                            string text;
                            Func <CloudFile.Networker, Task> clickAction = null;
                            switch (status)
                            {
                            case CloudFile.Networker.NetworkStatus.Completed: text = "\u2714"; break;

                            case CloudFile.Networker.NetworkStatus.ErrorNeedRestart:
                            {
                                text        = "\u26a0";
                                clickAction = new Func <CloudFile.Networker, Task>(async(networker) =>
                                    {
                                        await networker.ResetAsync();
                                        await networker.StartAsync();
                                    });
                            }
                            break;

                            case CloudFile.Networker.NetworkStatus.Networking:
                            {
                                text        = "\u23f8";
                                clickAction = new Func <CloudFile.Networker, Task>(async(networker) =>
                                    {
                                        await networker.PauseAsync();
                                    });
                            }
                            break;

                            case CloudFile.Networker.NetworkStatus.NotStarted:
                            {
                                text        = "\u23f0";
                                clickAction = new Func <CloudFile.Networker, Task>(async(networker) =>
                                    {
                                        await networker.StartAsync();
                                    });
                            }
                            break;

                            case CloudFile.Networker.NetworkStatus.Paused:
                            {
                                text        = "\u25b6";
                                clickAction = new Func <CloudFile.Networker, Task>(async(networker) =>
                                    {
                                        await networker.StartAsync();
                                    });
                            }
                            break;

                            default: throw new Exception($"status: {status}");
                            }
                            MyButton btn = new MyButton(text)
                            {
                                Opacity = 0
                            };
                            if (status == CloudFile.Networker.NetworkStatus.Completed)
                            {
                                btn.IsEnabled = false;
                            }
                            btn.Clicked += async delegate
                            {
                                IEnumerable <Task> tasks;
                                lock (networkers)
                                {
                                    tasks = networkers[status].ToList().Select(async(networker) => { await clickAction(networker); });
                                }
                                await Task.WhenAll(tasks);
                            };
                            int number = 0;
                            System.Threading.SemaphoreSlim semaphoreSlim = new System.Threading.SemaphoreSlim(1, 1);
                            DateTime lastUpdate = DateTime.Now;
                            actions[status] = new Func <int, Task>(async(difference) =>
                            {
                                bool isZeroBefore   = (number == 0);
                                number             += difference;
                                DateTime updateTime = DateTime.Now;
                                await semaphoreSlim.WaitAsync();
                                try
                                {
                                    if (updateTime <= lastUpdate)
                                    {
                                        return;
                                    }
                                    lastUpdate = updateTime;
                                    btn.Text   = $"{text}{number}";
                                    if (number == 0 && !isZeroBefore)
                                    {
                                        await btn.FadeTo(0, 500);
                                    }
                                    if (number != 0 && isZeroBefore)
                                    {
                                        await btn.FadeTo(1, 500);
                                    }
                                    await Task.Delay(100);
                                }
                                finally
                                {
                                    lock (semaphoreSlim) semaphoreSlim.Release();
                                }
                            });
                            GDctrl.Children.Add(btn, columnNumber++, 0);
                        }
                        FTmain.StatusEnter += async(networker, status) =>
                        {
                            networkers[status].Add(networker);
                            await actions[status](1);
                        };
                        FTmain.StatusLeave += async(networker, status) =>
                        {
                            networkers[status].Remove(networker);
                            await actions[status](-1);
                        };
                    }
                    GDmain.Children.Add(GDctrl, 0, 0);
                }
                {
                    GDmain.Children.Add(new Frame {
                        OutlineColor = Color.Accent, Padding = new Thickness(5), Content = FTmain
                    }, 0, 1);
                }
                this.Content = GDmain;
            }
        }
コード例 #17
0
ファイル: Form1.cs プロジェクト: lonely-bird/pang
 private void InitializeControls()
 {
     this.FormClosing += Form1_FormClosing;
     {
         TLP = new MyTableLayoutPanel(5, 1, "PAAAA", "P");
         {
             {
                 LBL    = new MyLabel("");
                 status = "Q, W, O: control\r\nP: restart all";
                 TLP.AddControl(LBL, 0, 0);
             }
             {
                 MyTableLayoutPanel tlp = new MyTableLayoutPanel(1, 2, "A", "AA");
                 {
                     PBX          = new PictureBox();
                     PBX.Dock     = DockStyle.Fill;
                     PBX.SizeMode = PictureBoxSizeMode.AutoSize;
                     PBX.Image    = Properties.Resources.buttonDark;
                     tlp.AddControl(PBX, 0, 0);
                 }
                 {
                     Panel pnl = new Panel();
                     pnl.Dock         = DockStyle.Fill;
                     pnl.AutoSize     = true;
                     pnl.AutoSizeMode = AutoSizeMode.GrowAndShrink;
                     PictureBox pbx = new PictureBox();
                     pbx.Dock     = DockStyle.Fill;
                     pbx.SizeMode = PictureBoxSizeMode.Zoom;
                     pbx.Image    = Properties.Resources.computer;
                     MyLabel lbl = new MyLabel("");
                     lbl.Font      = new Font("Consolas", 8, FontStyle.Bold);
                     lbl.Dock      = DockStyle.None;
                     lbl.ForeColor = Color.FromArgb(64, 0, 0, 0);
                     lbl.BackColor = Color.Transparent;
                     lbl.Parent    = pbx;
                     //{
                     //    Bitmap bmp = new Bitmap(1, 1);
                     //    bmp.SetPixel(0, 0, Color.Transparent);
                     //    lbl.BackgroundImage = bmp;
                     //}
                     //pnl.Controls.Add(lbl);
                     pnl.Controls.Add(pbx);
                     tlp.AddControl(pnl, 0, 1);
                     Thread thread = new Thread(() =>
                     {
                         Thread.Sleep(3000);
                         while (true)
                         {
                             Thread.Sleep(20);
                             StringBuilder s = new StringBuilder();
                             for (int i = 0; i < 10; i++)
                             {
                                 for (int j = 0; j < 30; j++)
                                 {
                                     s.Append(random.Next(0, 2) == 0 ? '0' : '1');
                                 }
                                 s.Append("\r\n");
                             }
                             lbl.Invoke(new Action(() => { lbl.Text = s.ToString(); }));
                         }
                     });
                     thread.IsBackground = true;
                     thread.Start();
                 }
                 TLP.AddControl(tlp, 1, 0);
             }
             {
                 TB         = new TrackBar();
                 TB.Dock    = DockStyle.Fill;
                 TB.Minimum = 0;
                 TB.Maximum = 1000;
                 TLP.AddControl(TB, 2, 0);
             }
             {
                 TXB              = new MyTextBox(false);
                 TXB.KeyDown     += Form1_KeyDown;
                 TXB.KeyUp       += Form1_KeyUp;
                 TXB.TextChanged += (object s, EventArgs e1) => { TXB.Text = null; };
                 TLP.AddControl(TXB, 3, 0);
             }
             {
                 IFD = new MyInputField();
                 IFD.AddField("Play speed (FPS)", FPS.ToString()).TextChanged += (object s, EventArgs e1) => {
                     double t;
                     if (!double.TryParse((s as TextBox).Text, out t))
                     {
                         MessageBox.Show("格式不正確");
                     }
                     else
                     {
                         FPS = t;
                     }
                 };
                 TLP.AddControl(IFD, 4, 0);
             }
         }
         this.Controls.Add(TLP);
     }
 }
コード例 #18
0
ファイル: FlightData.cs プロジェクト: 415porto/ardupilotone
        private void tabControl1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (tabControl1.SelectedTab == tabStatus)
            {
                tabControl1.SuspendLayout();

                foreach (Control temp in tabStatus.Controls)
                {
                    temp.DataBindings.Clear();
                    //temp.Dispose();
                }
                //tabStatus.Controls.Clear();

                int x = 10;
                int y = 10;

                object thisBoxed = MainV2.cs;
                Type test = thisBoxed.GetType();

                foreach (var field in test.GetProperties())
                {
                    // field.Name has the field's name.
                    object fieldValue;
                    try
                    {
                        fieldValue = field.GetValue(thisBoxed, null); // Get value
                    }
                    catch { continue; }

                    // Get the TypeCode enumeration. Multiple types get mapped to a common typecode.
                    TypeCode typeCode = Type.GetTypeCode(fieldValue.GetType());

                    bool add = true;

                    MyLabel lbl1 = new MyLabel();
                    MyLabel lbl2 = new MyLabel();
                    try
                    {
                        lbl1 = (MyLabel)tabStatus.Controls.Find(field.Name, false)[0];

                        lbl2 = (MyLabel)tabStatus.Controls.Find(field.Name + "value", false)[0];

                        add = false;
                    }
                    catch { }

                    lbl1.Location = new Point(x, y);
                    lbl1.Size = new System.Drawing.Size(75, 13);
                    lbl1.Text = field.Name;
                    lbl1.Name = field.Name;
                    lbl2.AutoSize = false;

                    lbl2.Location = new Point(lbl1.Right + 5, y);
                    lbl2.Size = new System.Drawing.Size(50, 13);
                    //if (lbl2.Name == "")
                    lbl2.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.bindingSource1, field.Name, true, System.Windows.Forms.DataSourceUpdateMode.OnValidation, ""));
                    lbl2.Name = field.Name + "value";
                    //lbl2.Text = fieldValue.ToString();

                    if (add)
                    {
                        tabStatus.Controls.Add(lbl1);
                        tabStatus.Controls.Add(lbl2);
                    }

                    //Application.DoEvents();

                    x += 0;
                    y += 15;

                    if (y > tabStatus.Height - 30)
                    {
                        x += 140;
                        y = 10;
                    }
                }

                tabStatus.Width = x;

                tabControl1.ResumeLayout();
            }
            else
            {
                foreach (Control temp in tabStatus.Controls)
                {
                    temp.DataBindings.Clear();
                }
            }
        }
コード例 #19
0
        public FontPageCs()
        {
            var label = new Label {
                Text       = "Hello, Forms!",
                FontFamily = Device.OnPlatform(
                    "SF Hollywood Hills",
                    null,
                    null
                    ),             // set only for iOS
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
            };

            label.FontSize = Device.OnPlatform(
                24,
                Device.GetNamedSize(NamedSize.Medium, label),
                Device.GetNamedSize(NamedSize.Large, label)
                );

            var myLabel = new MyLabel {
                Text              = "MyLabel for Android!",
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
            };

            myLabel.FontSize = Device.OnPlatform(
                Device.GetNamedSize(NamedSize.Small, myLabel),
                Device.GetNamedSize(NamedSize.Medium, myLabel),                  // will get overridden in custom Renderer
                Device.GetNamedSize(NamedSize.Large, myLabel)
                );

            var labelBold = new Label {
                Text              = "Bold",
                FontSize          = 14,
                FontAttributes    = FontAttributes.Bold,
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
            };
            var labelItalic = new Label {
                Text              = "Italic",
                FontSize          = 14,
                FontAttributes    = FontAttributes.Italic,
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
            };
            var labelBoldItalic = new Label {
                Text              = "BoldItalic",
                FontSize          = 14,
                FontAttributes    = FontAttributes.Bold | FontAttributes.Italic,
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
            };


            // Span formatting support
            var labelFormatted = new Label();
            var fs             = new FormattedString();

            fs.Spans.Add(new Span {
                Text = "Red, ", ForegroundColor = Color.Red, FontSize = 20, FontAttributes = FontAttributes.Italic
            });
            fs.Spans.Add(new Span {
                Text = " blue, ", ForegroundColor = Color.Blue, FontSize = 32
            });
            fs.Spans.Add(new Span {
                Text = " and green!", ForegroundColor = Color.Green, FontSize = 12
            });
            labelFormatted.FormattedText = fs;


            Content = new StackLayout {
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                Children          =
                {
                    label, myLabel, labelBold, labelItalic, labelBoldItalic, labelFormatted
                }
            };
        }
コード例 #20
0
        private void button2_Click(object sender, EventArgs e)
        {
            if (itemId == "0")
            {
                try
                {
                    using (SqlConnection connection = new SqlConnection(global::GymMembershipSystem.Properties.Settings.Default.GymMembershipSystemDatabase))
                    {
                        using (SqlCommand command2 = new SqlCommand("INSERT INTO Items(ItemName, ItemId, ItemPrice, ItemCount, ItemDescription) " +
                                                                    "VALUES(@ItemName, @ItemId, @ItemPrice, @ItemCount, @ItemDescription)", connection))
                        {
                            command2.Parameters.AddWithValue("@ItemName", itemname.Text.ToUpper());
                            command2.Parameters.AddWithValue("@ItemId", Convert.ToInt32(itemid2.Text));
                            command2.Parameters.AddWithValue("@ItemPrice", itemprice2.Text);
                            command2.Parameters.AddWithValue("@ItemCount", Convert.ToInt32(itemcount1.Text));
                            command2.Parameters.AddWithValue("@ItemDescription", itemdesc1.Text);

                            command2.Connection.Open();
                            command2.ExecuteNonQuery();
                            command2.Connection.Close();

                            saveImage();

                            itemname.Clear();
                            getLastIndex();
                            itemprice2.Clear();
                            itemcount1.Clear();
                            itemdesc1.Clear();

                            List <Label> Labels = new List <Label>();
                            Labels.Add(MyLabel.SetOKLabel("Adding Items"));
                            Labels.Add(MyLabel.SetOKLabel("Sucessfully added item."));

                            List <Button> Buttons = new List <Button>();
                            Buttons.Add(MyButton.SetOKThemeButton());
                            MyMessageBox.Show(
                                Labels,
                                "",
                                Buttons,
                                MyImage.SetSuccess());
                        }
                    }
                }
                catch (Exception ex)
                {
                    List <Label> Labels = new List <Label>();
                    Labels.Add(MyLabel.SetOKLabel("General Error"));
                    Labels.Add(MyLabel.SetOKLabel(ex.Message));

                    List <Button> Buttons = new List <Button>();
                    Buttons.Add(MyButton.SetOKThemeButton());
                    MyMessageBox.Show(
                        Labels,
                        "",
                        Buttons,
                        MyImage.SetFailed());
                }
            }
            else
            {
                try
                {
                    using (SqlConnection connection = new SqlConnection(global::GymMembershipSystem.Properties.Settings.Default.GymMembershipSystemDatabase))
                    {
                        using (SqlCommand command = new SqlCommand("UPDATE Items SET ItemCount" +
                                                                   "=@Count, ItemPrice=@Price WHERE ItemId=@itemid", connection))
                        {
                            command.Parameters.AddWithValue("@Count", itemcount1.Text);
                            command.Parameters.AddWithValue("@Price", itemprice2.Text);
                            command.Parameters.AddWithValue("@itemid", itemId);
                            command.Connection.Open();
                            command.ExecuteNonQuery();
                            command.Connection.Close();

                            List <Label> Labels = new List <Label>();
                            Labels.Add(MyLabel.SetOKLabel("Updating Items"));
                            Labels.Add(MyLabel.SetOKLabel("Sucessfully updated item."));

                            List <Button> Buttons = new List <Button>();
                            Buttons.Add(MyButton.SetOKThemeButton());
                            MyMessageBox.Show(
                                Labels,
                                "",
                                Buttons,
                                MyImage.SetSuccess());
                        }
                    }
                }
                catch (Exception ex)
                {
                    List <Label> Labels = new List <Label>();
                    Labels.Add(MyLabel.SetOKLabel("General Error"));
                    Labels.Add(MyLabel.SetOKLabel(ex.Message));

                    List <Button> Buttons = new List <Button>();
                    Buttons.Add(MyButton.SetOKThemeButton());
                    MyMessageBox.Show(
                        Labels,
                        "",
                        Buttons,
                        MyImage.SetFailed());
                }
            }
        }
コード例 #21
0
    public void setText(MyLabel label, EffectType type, Rune r, bool verbose)
    {
        if (verbose_label.text != null)
        {
            verbose_label.text.text = (type == EffectType.Null) ? "" : type.ToString();
        }

        setVerboseImageLabels(verbose_label, type);

        //   Debug.Log("Setting label for " + type + "\n");

        MyText current_desc = label.getText(LabelName.CurrentLvlSkillDesc);
        //  MyText next_desc = label.getText(LabelName.NextLvlSkillDesc);
        MyText generic_desc = label.getText(LabelName.Null);

        if (r == null || type == EffectType.Null || selected_button == null)
        {
            if (current_desc != null)
            {
                current_desc.gameObject.SetActive(false);
            }
            //    if (next_desc != null) next_desc.gameObject.SetActive(false);
        }
        else
        {
            StatBit stat = r.getStat(type);
            if (stat == null)
            {
                return;
            }

            if (current_desc != null)
            {
                current_desc.gameObject.SetActive(true);

                if (r.getLevel(type) > 0 || type == EffectType.Range)
                {
                    /*
                     * if (verbose)
                     *   current_desc.setText(stat.getCompactDescription(LabelName.CurrentLvlSkillDesc));
                     * else
                     * {*/
                    if (r.CanUpgrade(type, r.runetype, true) == StateType.No || !r.haveUpgrade(type))
                    {
                        current_desc.setText(stat.getCompactDescription(LabelName.CurrentLvlSkillDesc));
                    }
                    else
                    {
                        current_desc.setText(stat.getCompactDescription(LabelName.CurrentLvlSkillDesc, 1));
                    }
                    //}
                }
                else
                {
                    current_desc.setText(stat.getCompactDescription(LabelName.NextLvlSkillDesc, 1));
                }


                if (generic_desc != null)
                {
                    generic_desc.gameObject.SetActive(true);

                    if (!verbose)
                    {
                        generic_desc.setText(stat.getCompactDescription(LabelName.Null));
                    }
                }
            }
        }
    }
コード例 #22
0
        public HomeScreen()
        {
            this.Title = " Best Store in Town";
            NavigationPage.SetBackButtonTitle (this, "Home");

            // provide the heading label
            var headingLabel = new MyLabel {
                XAlign = TextAlignment.Center,
                YAlign = TextAlignment.Center,
                Text = "ANFIELD",
                FontFamily = Device.OnPlatform (
                    "Exo2-ExtraBold",
                    "Money Money",
                    null),
                FontSize = Device.OnPlatform (54,45,99),
                TextColor = Color.FromHex ("#D84315")

            };

            var SignUpButton = new Button {
                Text = "Sign Up",
                TextColor = Color.White,
                BackgroundColor = Color.Accent,
                Font = Font.SystemFontOfSize( 20 ),
                WidthRequest = 05,
                HeightRequest = 40

            };

            var LogInButton = new Button {
                Text = "Log In",
                TextColor = Color.White,
                BackgroundColor = Color.FromHex ("#2196F3"),
                Font = Font.SystemFontOfSize( 20 ),
                WidthRequest = 05,
                HeightRequest = 40,

            };

            var LookAroundButton = new Button {
                Text = "Look Around",
                TextColor = Color.White,
                BackgroundColor = Color.FromHex ("#2196F3"),
                Font = Font.SystemFontOfSize( 20 ),
                WidthRequest = 05,
                HeightRequest = 40

            };

            SignUpButton.Clicked += (o,e) =>
            {Navigation.PushAsync (new SignUp());};

            LogInButton.Clicked += (o,e) =>
            {Navigation.PushAsync (new LogInPage());};

            LookAroundButton.Clicked += (o,e) =>
            {
            //				if(Application.Current.Properties.ContainsKey("UserId")){
            //					Navigation.PushAsync (new NavigationPage(new LookAround()));
            //				}
            //				else{
                    Navigation.PushAsync (new UnauthorizedLookAround());
                //}
            };

            var layout = new StackLayout();

            //			if(Device.OS == TargetPlatform.iOS) {
            //				layout.Padding = new Thickness (20,2,0,2);
            //
            //			}
            //			if (Device.OS == TargetPlatform.Android) {
            //				layout.Padding = new Thickness (35, 2, 0, 2);
            //				headingLabel.TextColor = Color.Black;
            //			}
            //			else {
            //				layout.Padding = new Thickness (35, 2, 0, 2);
            //			}

            layout.Children.Add (new BoxView {Color = Color.Transparent, HeightRequest = 50});
            layout.Children.Add (headingLabel);
            layout.Children.Add (new BoxView {Color = Color.Transparent, HeightRequest = 50});
            layout.Children.Add (SignUpButton);

            layout.Children.Add (new BoxView {Color = Color.Transparent, HeightRequest = 20});
            layout.Children.Add(new BoxView() { Color = Color.FromHex ("EEEEEE"), WidthRequest = 100, HeightRequest = 2 });
            layout.Children.Add (LogInButton);
            layout.Children.Add (LookAroundButton);

            // provide the background image
            var homeScreenImage = new Image {Aspect = Aspect.Fill };

            homeScreenImage.Source =  Device.OnPlatform(
                ImageSource.FromFile("21.jpg"),
                ImageSource.FromFile("home.jpg"),
                null);

            // merge views and create a layout
            var relativeLayout = new RelativeLayout ();

            relativeLayout.Children.Add(homeScreenImage,
                Constraint.RelativeToParent (
                    ((parent)=>{return 0;})
                ));

            relativeLayout.Children.Add(layout,
                Constraint.RelativeToParent((parent) => {return parent.Width/6.5;} ),
                Constraint.RelativeToParent((parent) => {return parent.Height/4;} ));

            Content = relativeLayout;
        }
コード例 #23
0
        private void tabAll_Enter(object sender, EventArgs e)
        {
            int x = 10;
            int y = 10;

            object thisBoxed = MainV2.comPort.MAV.cs;
            Type   test      = thisBoxed.GetType();

            PropertyInfo[] props = test.GetProperties();

            //props

            foreach (var field in props)
            {
                // field.Name has the field's name.
                object   fieldValue;
                TypeCode typeCode;
                try
                {
                    fieldValue = field.GetValue(thisBoxed, null); // Get value

                    // Get the TypeCode enumeration. Multiple types get mapped to a common typecode.
                    typeCode = Type.GetTypeCode(fieldValue.GetType());
                }
                catch { continue; }

                bool add = true;

                MyLabel lbl1 = new MyLabel();
                MyLabel lbl2 = new MyLabel();
                try
                {
                    lbl1 = (MyLabel)tabAll.Controls.Find(field.Name, false)[0];

                    lbl2 = (MyLabel)tabAll.Controls.Find(field.Name + "value", false)[0];

                    add = false;
                }
                catch { }

                if (add)
                {
                    lbl1.Location = new Point(x, y);
                    lbl1.Size     = new System.Drawing.Size(75, 13);
                    lbl1.Text     = field.Name;
                    lbl1.Name     = field.Name;
                    lbl1.Visible  = true;
                    lbl2.AutoSize = false;

                    lbl2.Location = new Point(lbl1.Right + 5, y);
                    lbl2.Size     = new System.Drawing.Size(50, 13);
                    //if (lbl2.Name == "")
                    lbl2.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.bindingSource, field.Name, false, System.Windows.Forms.DataSourceUpdateMode.Never, "0"));
                    lbl2.Name    = field.Name + "value";
                    lbl2.Visible = true;
                    //lbl2.Text = fieldValue.ToString();


                    tabAll.Controls.Add(lbl1);
                    tabAll.Controls.Add(lbl2);
                }
                else
                {
                    lbl1.Location = new Point(x, y);
                    lbl2.Location = new Point(lbl1.Right + 5, y);
                }

                //Application.DoEvents();

                x += 0;
                y += 15;

                if (y > tabAll.Height - 30)
                {
                    x += 140;
                    y  = 10;
                }
            }

            tabAll.Width = x;

            ThemeManager.ApplyThemeTo(tabAll);

            //   tabStatus.ResumeLayout();
        }
コード例 #24
0
        private void button1_Click(object sender, EventArgs e)
        {
            string Height       = textBox1.Text;
            string Weight       = textBox2.Text;
            string Neck         = textBox3.Text;
            string BodyFat      = textBox4.Text;
            string Shoulders    = textBox6.Text;
            string LeftBicep    = textBox5.Text;
            string LeftForearm  = textBox7.Text;
            string RightBicep   = textBox9.Text;
            string RightForearm = textBox8.Text;
            string Chest        = textBox11.Text;
            string Waist        = textBox10.Text;
            string Hips         = textBox13.Text;
            string LeftThighs   = textBox12.Text;
            string RightThighs  = textBox15.Text;
            string LeftCalves   = textBox14.Text;
            string RightCalves  = textBox16.Text;

            try
            {
                using (SqlConnection connection2 = new SqlConnection(
                           global::GymMembershipSystem.Properties.Settings.Default.GymMembershipSystemDatabase))
                {
                    using (SqlCommand cmd = new SqlCommand("INSERT INTO Measurement(Height, Weight, Neck, BodyFat, Shoulders," +
                                                           "LeftBicep, LeftForearm, RightBicep, RightForearm, Chest, Waist, Hips," +
                                                           "LeftThighs, RightThighs, LeftCalves, RightCalves, MemberId, Timestamp)" +
                                                           "VALUES(@Height, @Weight, @Neck, @BodyFat, @Shoulders, @LeftBicep, @LeftForearm, @RightBicep, @RightForearm, @Chest, @Waist, @Hips," +
                                                           "@LeftThighs, @RightThighs, @LeftCalves, @RightCalves, @UserId, @Timestamp)", connection2))
                    {
                        cmd.Parameters.AddWithValue("@Height", textBox1.Text);
                        cmd.Parameters.AddWithValue("@Weight", textBox2.Text);
                        cmd.Parameters.AddWithValue("@Neck", textBox3.Text);
                        cmd.Parameters.AddWithValue("@BodyFat", textBox4.Text);
                        cmd.Parameters.AddWithValue("@Shoulders", textBox6.Text);
                        cmd.Parameters.AddWithValue("@LeftBicep", textBox5.Text);
                        cmd.Parameters.AddWithValue("@LeftForearm", textBox7.Text);
                        cmd.Parameters.AddWithValue("@RightBicep", textBox9.Text);
                        cmd.Parameters.AddWithValue("@RightForearm", textBox8.Text);
                        cmd.Parameters.AddWithValue("@Chest", textBox11.Text);
                        cmd.Parameters.AddWithValue("@Waist", textBox10.Text);
                        cmd.Parameters.AddWithValue("@Hips", textBox13.Text);
                        cmd.Parameters.AddWithValue("@LeftThighs", textBox12.Text);
                        cmd.Parameters.AddWithValue("@RightThighs", textBox15.Text);
                        cmd.Parameters.AddWithValue("@LeftCalves", textBox14.Text);
                        cmd.Parameters.AddWithValue("@RightCalves", textBox16.Text);
                        cmd.Parameters.AddWithValue("@UserId", comboBox1.SelectedValue);
                        cmd.Parameters.AddWithValue("@Timestamp", DateTime.Now);

                        cmd.Connection.Open();

                        if (cmd.ExecuteNonQuery().ToString() == "1")
                        {
                            List <Label> Labels = new List <Label>();
                            Labels.Add(MyLabel.SetOKLabel("Measurement Update"));
                            Labels.Add(MyLabel.SetOKLabel("Measurement update passed"));

                            List <Button> Buttons = new List <Button>();
                            Buttons.Add(MyButton.SetOKThemeButton());
                            MyMessageBox.Show(
                                Labels,
                                "",
                                Buttons,
                                MyImage.SetSuccess());
                        }
                        else
                        {
                            List <Label> Labels = new List <Label>();
                            Labels.Add(MyLabel.SetOKLabel("Measurement Update"));
                            Labels.Add(MyLabel.SetOKLabel("Measurement update failed"));

                            List <Button> Buttons = new List <Button>();
                            Buttons.Add(MyButton.SetOKThemeButton());
                            MyMessageBox.Show(
                                Labels,
                                "",
                                Buttons,
                                MyImage.SetFailed());
                        }
                    }

                    connection2.Close();
                }
            }
            catch (Exception ex)
            {
                List <Label> Labels = new List <Label>();
                Labels.Add(MyLabel.SetOKLabel("General Error"));
                Labels.Add(MyLabel.SetOKLabel(ex.Message));

                List <Button> Buttons = new List <Button>();
                Buttons.Add(MyButton.SetOKThemeButton());
                MyMessageBox.Show(
                    Labels,
                    "",
                    Buttons,
                    MyImage.SetFailed());
            }
        }
コード例 #25
0
        private void DrawSaleChart()
        {
            string[] monthsName = { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" };
            lstTotalByDate.Clear();
            string month = (cbxMonthsSale.SelectedIndex + 1).ToString();

            dgvTopBook.DataSource     = BookDAO.GetTopBookByMonth(month);
            dgvTopEmployee.DataSource = AccountDAO.GetTopEmployeeByMonth(month);

            for (int i = 0; i < DateTime.DaysInMonth(DateTime.Now.Year, Convert.ToInt32(month)); i++)
            {
                string year = "2020";

                string date    = (i + 1).ToString();
                string conDate = year + "-" + month + "-" + date;

                try
                {
                    DateTime dt    = Convert.ToDateTime(conDate);
                    double   value = BillDAO.getTotalByDate(conDate);
                    lstTotalByDate.Add(value);
                } catch (FormatException)
                {
                    lstTotalByDate.Add(0);
                }
            }
            int    basehei = 200;
            double maxVal  = 0;
            double minVal  = 0;

            foreach (double d in lstTotalByDate)
            {
                if (d > maxVal)
                {
                    maxVal = d;
                }
            }
            minVal = maxVal;
            foreach (double d in lstTotalByDate)
            {
                if (d < minVal)
                {
                    minVal = d;
                }
            }
            flpDisplaySale.Controls.Clear();
            for (int i = 0; i < lstTotalByDate.Count; i++)
            {
                int height = CalToCol(basehei, maxVal, lstTotalByDate[i]);

                MyLabel l = new MyLabel();
                l.Height      = height;
                l.BackColor   = Color.Gray;
                l.Months      = i;
                l.MouseHover += L_MouseHover;
                l.MouseLeave += L_MouseLeave;
                MyLabel l2 = new MyLabel();
                l2.Text   = (i + 1).ToString();
                l2.Height = 25;
                FlowLayoutPanel fl1 = new FlowLayoutPanel();
                fl1.Width         = 30;
                fl1.Height        = 300;
                fl1.FlowDirection = FlowDirection.BottomUp;
                fl1.Controls.Add(l2);
                fl1.Controls.Add(l);


                flpDisplaySale.Controls.Add(fl1);
            }
            lblSaleHighest.Text = String.Format("Heightest Of" + monthsName[Convert.ToInt32(month) - 1] + ": {0:n0} VND ", maxVal);
            lblLowest.Text      = String.Format("Lowest Of" + monthsName[Convert.ToInt32(month) - 1] + ": {0:n0} VND ", minVal);
            double aver = 0;

            foreach (double d in lstTotalByDate)
            {
                aver += d;
            }
            lblSaleAver.Text = String.Format("Average : {0:n0} VND / Day", (aver / lstTotalByDate.Count));
        }
コード例 #26
0
        private void comboBox1_SelectionChangeCommitted(object sender, EventArgs e)
        {
            try
            {
                using (SqlConnection connection = new SqlConnection(
                           global::GymMembershipSystem.Properties.Settings.Default.GymMembershipSystemDatabase))
                {
                    using (SqlCommand cmd2 = new SqlCommand("SELECT TOP 1 * FROM Measurement WHERE MemberId='" + comboBox1.SelectedValue + "' ORDER BY Timestamp DESC", connection))
                    {
                        cmd2.CommandType = CommandType.Text;
                        cmd2.Connection.Open();
                        SqlDataReader dr = cmd2.ExecuteReader();

                        if (dr.HasRows == false)
                        {
                            button2.Enabled = false;
                            textBox1.Clear();
                            textBox2.Clear();
                            textBox3.Clear();
                            textBox4.Clear();
                            textBox6.Clear();
                            textBox5.Clear();
                            textBox7.Clear();
                            textBox9.Clear();
                            textBox8.Clear();
                            textBox11.Clear();
                            textBox10.Clear();
                            textBox13.Clear();
                            textBox12.Clear();
                            textBox15.Clear();
                            textBox14.Clear();
                            textBox16.Clear();
                        }

                        while (dr.Read())
                        {
                            button2.Enabled = true;
                            string Height       = dr["Height"].ToString();
                            string Weight       = dr["Weight"].ToString();
                            string BodyFat      = dr["BodyFat"].ToString();
                            string Neck         = dr["Neck"].ToString();
                            string Shoulders    = dr["Shoulders"].ToString();
                            string LeftBicep    = dr["LeftBicep"].ToString();
                            string LeftForearm  = dr["LeftForearm"].ToString();
                            string RightBicep   = dr["RightBicep"].ToString();
                            string RightForearm = dr["RightForearm"].ToString();
                            string Chest        = dr["Chest"].ToString();
                            string Waist        = dr["Waist"].ToString();
                            string Hips         = dr["Hips"].ToString();
                            string LeftThighs   = dr["LeftThighs"].ToString();
                            string RightThighs  = dr["RightThighs"].ToString();
                            string LeftCalves   = dr["LeftCalves"].ToString();
                            string RightCalves  = dr["RightCalves"].ToString();

                            textBox1.Text  = Height;
                            textBox2.Text  = Weight;
                            textBox3.Text  = Neck;
                            textBox4.Text  = BodyFat;
                            textBox6.Text  = Shoulders;
                            textBox5.Text  = LeftBicep;
                            textBox7.Text  = LeftForearm;
                            textBox9.Text  = RightBicep;
                            textBox8.Text  = RightForearm;
                            textBox11.Text = Chest;
                            textBox10.Text = Waist;
                            textBox13.Text = Hips;
                            textBox12.Text = LeftThighs;
                            textBox15.Text = RightThighs;
                            textBox14.Text = LeftCalves;
                            textBox16.Text = RightCalves;
                        }
                        cmd2.Connection.Close();
                    }

                    connection.Close();
                }
            }
            catch (Exception ex)
            {
                List <Label> Labels = new List <Label>();
                Labels.Add(MyLabel.SetOKLabel("General Error"));
                Labels.Add(MyLabel.SetOKLabel(ex.Message));

                List <Button> Buttons = new List <Button>();
                Buttons.Add(MyButton.SetOKThemeButton());
                MyMessageBox.Show(
                    Labels,
                    "",
                    Buttons,
                    MyImage.SetFailed());
            }
        }
コード例 #27
0
        void doButtontoUI(string name, int x, int y)
        {
            MyLabel  butlabel      = new MyLabel();
            ComboBox butnumberlist = new ComboBox();

            Controls.MyButton     but_detect = new Controls.MyButton();
            HorizontalProgressBar hbar       = new HorizontalProgressBar();
            ComboBox cmbaction = new ComboBox();

            Controls.MyButton but_settings = new Controls.MyButton();

            var config = Joystick.self.getButton(int.Parse(name));

            // do this here so putting in text works
            this.Controls.AddRange(new Control[] { butlabel, butnumberlist, but_detect, hbar, cmbaction, but_settings });

            butlabel.Location = new Point(x, y);
            butlabel.Size     = new Size(47, 13);
            butlabel.Text     = "Button " + (int.Parse(name) + 1);

            butnumberlist.Location      = new Point(72, y);
            butnumberlist.Size          = new Size(70, 21);
            butnumberlist.DataSource    = getButtonNumbers();
            butnumberlist.DropDownStyle = ComboBoxStyle.DropDownList;
            butnumberlist.Name          = "cmbbutton" + name;
            //if (MainV2.config["butno" + name] != null)
            //  butnumberlist.Text = (MainV2.config["butno" + name].ToString());
            //if (config.buttonno != -1)
            butnumberlist.Text = config.buttonno.ToString();
            butnumberlist.SelectedIndexChanged += new EventHandler(cmbbutton_SelectedIndexChanged);

            but_detect.Location = new Point(BUT_detch1.Left, y);
            but_detect.Size     = BUT_detch1.Size;
            but_detect.Text     = BUT_detch1.Text;
            but_detect.Name     = "mybut" + name;
            but_detect.Click   += new EventHandler(BUT_detbutton_Click);

            hbar.Location = new Point(progressBarRoll.Left, y);
            hbar.Size     = progressBarRoll.Size;
            hbar.Name     = "hbar" + name;

            cmbaction.Location = new Point(hbar.Right + 5, y);
            cmbaction.Size     = new Size(100, 21);

            cmbaction.DataSource = Enum.GetNames(typeof(Joystick.buttonfunction)); //Common.getModesList(MainV2.comPort.MAV.cs);
            //cmbaction.ValueMember = "Key";
            //cmbaction.DisplayMember = "Value";
            cmbaction.Tag           = name;
            cmbaction.DropDownStyle = ComboBoxStyle.DropDownList;
            cmbaction.Name          = "cmbaction" + name;
            //if (MainV2.config["butaction" + name] != null)
            //  cmbaction.Text = MainV2.config["butaction" + name].ToString();
            //if (config.function != Joystick.buttonfunction.ChangeMode)
            cmbaction.Text = config.function.ToString();
            cmbaction.SelectedIndexChanged += cmbaction_SelectedIndexChanged;

            but_settings.Location = new Point(cmbaction.Right + 5, y);
            but_settings.Size     = BUT_detch1.Size;
            but_settings.Text     = "Settings";
            but_settings.Name     = "butsettings" + name;
            but_settings.Click   += but_settings_Click;
            but_settings.Tag      = cmbaction;

            if ((but_settings.Bottom + 30) > this.Height)
            {
                this.Height += 25;
            }
        }
コード例 #28
0
 partial void BtnClick()
 {
     MyLabel.SetText("NewText");
 }
コード例 #29
0
		public FontPageCs ()
		{
			var label = new Label {
				Text = "Hello, Xamarin.Forms!",
				FontFamily = Device.OnPlatform (
					"SF Hollywood Hills",
					null,
					@"\Assets\Fonts\SF Hollywood Hills.ttf#SF Hollywood Hills"
				), // set for iOS & Windows Phone (Android done in custom renderer)
				VerticalOptions = LayoutOptions.CenterAndExpand,
				HorizontalOptions = LayoutOptions.CenterAndExpand,

			};
			label.FontSize = Device.OnPlatform (
				24, 
				Device.GetNamedSize (NamedSize.Medium, label), 
				Device.GetNamedSize (NamedSize.Large, label)
			);

			var myLabel = new MyLabel {
				VerticalOptions = LayoutOptions.CenterAndExpand,
				HorizontalOptions = LayoutOptions.CenterAndExpand,
			};
            myLabel.Text = Device.OnPlatform(
                "MyLabel for iOS!",
                "MyLabel for Android!",
                "MyLabel for Windows Phone!"
            );
			myLabel.FontSize = Device.OnPlatform (
				Device.GetNamedSize (NamedSize.Small, myLabel),
				Device.GetNamedSize (NamedSize.Medium, myLabel), // will get overridden in custom Renderer
				Device.GetNamedSize (NamedSize.Large, myLabel)
			);

			var labelBold = new Label {
				Text = "Bold",
				FontSize = 14, 
				FontAttributes = FontAttributes.Bold,
				VerticalOptions = LayoutOptions.CenterAndExpand,
				HorizontalOptions = LayoutOptions.CenterAndExpand,
			};
			var labelItalic = new Label {
				Text = "Italic",
				FontSize = 14, 
				FontAttributes = FontAttributes.Italic,
				VerticalOptions = LayoutOptions.CenterAndExpand,
				HorizontalOptions = LayoutOptions.CenterAndExpand,
			};
			var labelBoldItalic = new Label {
				Text = "BoldItalic",
				FontSize = 14, 
				FontAttributes = FontAttributes.Bold | FontAttributes.Italic,
				VerticalOptions = LayoutOptions.CenterAndExpand,
				HorizontalOptions = LayoutOptions.CenterAndExpand,
			};


			// Span formatting support
			var labelFormatted = new Label ();
			var fs = new FormattedString ();
			fs.Spans.Add (new Span { Text="Red, ", ForegroundColor = Color.Red, FontSize = 20, FontAttributes = FontAttributes.Italic });
			fs.Spans.Add (new Span { Text=" blue, ", ForegroundColor = Color.Blue, FontSize = 32 });
			fs.Spans.Add (new Span { Text=" and green!", ForegroundColor = Color.Green, FontSize = 12 });
			labelFormatted.FormattedText = fs;


			Content = new StackLayout { 
				VerticalOptions = LayoutOptions.CenterAndExpand,
				HorizontalOptions = LayoutOptions.CenterAndExpand,
				Children = {
					label, myLabel, labelBold, labelItalic, labelBoldItalic, labelFormatted
				}
			};
		}
コード例 #30
0
        public FontPageCs()
        {
            var label = new Label {
                Text       = "Hello, Xamarin.Forms!",
                FontFamily = Device.OnPlatform(
                    "Lobster-Regular",                                   // iOS
                    null,                                                // see Android custom renderer
                    @"\Assets\Fonts\Lobster-Regular.ttf#Lobster-Regular" // WinPhone
                    ),
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
            };

            label.FontSize = Device.OnPlatform(
                24,
                Device.GetNamedSize(NamedSize.Medium, label),
                Device.GetNamedSize(NamedSize.Large, label)
                );

            var myLabel = new MyLabel {
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
            };

            myLabel.Text = Device.OnPlatform(
                "MyLabel for iOS!",
                "MyLabel for Android!",
                "MyLabel for Windows!"
                );
            myLabel.FontSize = Device.OnPlatform(
                Device.GetNamedSize(NamedSize.Small, myLabel),
                Device.GetNamedSize(NamedSize.Medium, myLabel),                  // will get overridden in custom Renderer
                Device.GetNamedSize(NamedSize.Large, myLabel)
                );

            var labelBold = new Label {
                Text              = "Bold",
                FontSize          = 14,
                FontAttributes    = FontAttributes.Bold,
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
            };
            var labelItalic = new Label {
                Text              = "Italic",
                FontSize          = 14,
                FontAttributes    = FontAttributes.Italic,
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
            };
            var labelBoldItalic = new Label {
                Text              = "BoldItalic",
                FontSize          = 14,
                FontAttributes    = FontAttributes.Bold | FontAttributes.Italic,
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
            };


            // Span formatting support
            var labelFormatted = new Label();
            var fs             = new FormattedString();

            fs.Spans.Add(new Span {
                Text = "Red, ", ForegroundColor = Color.Red, FontSize = 20, FontAttributes = FontAttributes.Italic
            });
            fs.Spans.Add(new Span {
                Text = " blue, ", ForegroundColor = Color.Blue, FontSize = 32
            });
            fs.Spans.Add(new Span {
                Text = " and green!", ForegroundColor = Color.Green, FontSize = 12
            });
            labelFormatted.FormattedText = fs;


            Content = new StackLayout {
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                Children          =
                {
                    label, myLabel, labelBold, labelItalic, labelBoldItalic, labelFormatted
                }
            };
        }
コード例 #31
0
        void doButtontoUI(string name, int x, int y)
        {
            MyLabel lbl = new MyLabel();
            ComboBox cmbbutton = new ComboBox();
            ArdupilotMega.Controls.MyButton mybut = new ArdupilotMega.Controls.MyButton();
            HorizontalProgressBar hbar = new HorizontalProgressBar();
            ComboBox cmbaction = new ComboBox();

            // do this here so putting in text works
            this.Controls.AddRange(new Control[] { lbl, cmbbutton, mybut, hbar, cmbaction });

            lbl.Location = new Point(x, y);
            lbl.Size = new Size(47, 13);
            lbl.Text = "Button " + name;

            cmbbutton.Location = new Point(72, y);
            cmbbutton.Size = new Size(70, 21);
            cmbbutton.DataSource = getButtonNumbers();
            cmbbutton.DropDownStyle = ComboBoxStyle.DropDownList;
            cmbbutton.Name = "cmbbutton" + name;
            if (MainV2.config["butno" + name] != null)
                cmbbutton.Text = (MainV2.config["butno" + name].ToString());
            cmbbutton.SelectedIndexChanged += new EventHandler(cmbbutton_SelectedIndexChanged);

            mybut.Location = new Point(BUT_detch1.Left, y);
            mybut.Size = BUT_detch1.Size;
            mybut.Text = BUT_detch1.Text;
            mybut.Name = "mybut" + name;
            mybut.Click += new EventHandler(BUT_detbutton_Click);

            hbar.Location = new Point(progressBar1.Left, y);
            hbar.Size = progressBar1.Size;
            hbar.Name = "hbar" + name;

            cmbaction.Location = new Point(hbar.Right + 5, y);
            cmbaction.Size = new Size(100, 21);

            cmbaction.DataSource = Common.getModesList();
            cmbaction.ValueMember = "Key";
            cmbaction.DisplayMember = "Value";

            cmbaction.DropDownStyle = ComboBoxStyle.DropDownList;
            cmbaction.Name = "cmbaction" + name;
            if (MainV2.config["butaction" + name] != null)
                cmbaction.Text = MainV2.config["butaction" + name].ToString();

            this.Height += 25;
        }
コード例 #32
0
    /////////////////////////////////////////////////////////////////////////////////////

    #region [ Overriden Base Methods ]

    /// <summary>
    /// Initializes UI components of the MdiForm.
    /// </summary>
    ///
    protected override void InitializeComponents()
    {
        /////////////////////////////////////////////////////////////////////////////////
        // Table layout grid definition, with rows and columns in Em units.

        float[] col = { 3, 18, 47, 63, 79 };
        float[] row = { 2, 4, 6, 8, 10, 12, 14, 17, 19, 21, 22 };

        float maxLen = 24; // Maximum text length

        /////////////////////////////////////////////////////////////////////////////////
        // Static text

        int r = 0, c = 0;

        NewStaticText(col[c] - 2, row[r++], "*");

        NewStaticText(col[c], row[r++], "First Release:");
        NewStaticText(col[c], row[r++], "Duration:");
        NewStaticText(col[c], row[r++], "Country:");
        NewStaticText(col[c], row[r++], "Language:");
        NewStaticText(col[c], row[r++], "PG-Rate:");
        NewStaticText(col[c], row[r++], "IMDB:");

        NewStaticText(col[c] + 21, row[2], "(min)");

        /////////////////////////////////////////////////////////////////////////////////
        // TextBox fields

        r = 0; c = 1;

        this.labelTitle             = NewLabel(col[0], row[0], 10);
        this.labelTitle.UseMnemonic = true;
        this.labelTitle.Text        = "&Title:";

        // Always move focus from title label to movie title
        //
        this.labelTitle.GotFocus += (sender, e) => this.movieTitle.Focus();

        this.movieTitle = NewTextField(col[c], row[r++], maxLen);
        this.release    = NewTextField(col[c], row[r++], maxLen);
        this.duration   = NewTextField(col[c], row[r++], 5);
        this.country    = NewTextField(col[c], row[r++], maxLen);
        this.language   = NewTextField(col[c], row[r++], maxLen);
        this.pgRate     = NewTextField(col[c], row[r++], maxLen);
        this.imdb       = NewTextField(col[c], row[r++], maxLen);

        /////////////////////////////////////////////////////////////////////////////////
        // ChecBoxes for Genre

        MyGroupBox genreBox = NewGroupBox("&Genre",
                                          col[2] - 3, row[0] - (Em.IsGUI ? 0.5f : 0f), 34, 14);

        this.genre = new MyCheckBoxCollection(typeof(Genre));

        r = 0; c = 0;
        foreach (CheckBox cb in this.genre)
        {
            cb.Parent   = genreBox;
            cb.TabIndex = NextTabIndex;
            cb.Left     = (int)((2f + c * 16f) * Em.Width);
            cb.Top      = (int)(Em.IsGUI ? 1.4f * Em.Height : 2f * Em.Height);
            #if TEXTUI
            cb.Height = Em.Height;
            cb.Width  = 15 * Em.Width;
            #else
            cb.AutoSize = true;
            #endif
            cb.Top += (r++) * (Em.IsGUI ? Em.Height + 3 : Em.Height);
            if (r >= 10)
            {
                r = 0; if (++c > 3)
                {
                    break;
                }
            }
        }

        /////////////////////////////////////////////////////////////////////////////////
        // Multiline TextBox: Directors

        r = 7; c = 1;

        if (Em.IsGUI)
        {
            row[8] -= 0.4f;
        }

        this.labelDirectors             = NewLabel(col[0], row[r], 18);
        this.labelDirectors.UseMnemonic = true;
        this.labelDirectors.Text        = "Di&rectors";
        this.labelDirectors.Height      = Em.Height;

        this.directors               = NewTextField(col[0], row[r + 1], 18);
        this.directors.Multiline     = true;
        this.directors.Height        = 5 * Em.Height + (Em.IsGUI ? 4 : 0);
        this.directors.AutoScrollBar = true;

        // Always move focus from directors label to directors field
        //
        this.labelDirectors.GotFocus += (source, e) => this.directors.Focus();

        /////////////////////////////////////////////////////////////////////////////////
        // Multiline TextBox: Writers

        this.labelWriters             = NewLabel(col[0] + 20, row[r], 18);
        this.labelWriters.UseMnemonic = true;
        this.labelWriters.Text        = "&Writers";
        this.labelWriters.Height      = Em.Height;

        this.writers               = NewTextField(col[0] + 20, row[r + 1], 18);
        this.writers.Multiline     = true;
        this.writers.Height        = 5 * Em.Height + (Em.IsGUI ? 4 : 0);
        this.writers.AutoScrollBar = true;

        // Always move focus from writers label to writers field
        //
        this.labelWriters.GotFocus += (source, e) => this.writers.Focus();

        /////////////////////////////////////////////////////////////////////////////////
        // Multiline TextBox: Actors

        this.labelActors             = NewLabel(col[0] + 40, row[r], 18);
        this.labelActors.UseMnemonic = true;
        this.labelActors.Text        = "&Actors";
        this.labelActors.Height      = Em.Height;

        this.actors               = NewTextField(col[0] + 40, row[r + 1], 34);
        this.actors.Multiline     = true;
        this.actors.Height        = 5 * Em.Height + (Em.IsGUI ? 4 : 0);
        this.actors.AutoScrollBar = true;

        // Always move focus from actors label to actors field
        //
        this.labelActors.GotFocus += (source, e) => this.actors.Focus();

        /////////////////////////////////////////////////////////////////////////////////
        // Field validation event handlers

        this.movieTitle.Validating += (sender, e) =>
        {
            MdiForm.ErrorMessage = null;

            if (ReadOnly || !this.movieTitle.ContentsChanged)
            {
                return;
            }

            ValidateNotNull("Movie title", this.movieTitle.Text, e);
        };

        this.release.Validating += (sender, e) =>
        {
            MdiForm.ErrorMessage = null;

            if (ReadOnly || !this.release.ContentsChanged)
            {
                return;
            }

            ValidateDate("First release (if specified)", this.release.Text, "yyyy-M-d",
                         " in ISO format (yyyy-mm-dd).", e);
        };

        this.duration.Validating += (sender, e) =>
        {
            MdiForm.ErrorMessage = null;

            if (ReadOnly || !this.duration.ContentsChanged)
            {
                return;
            }

            string fieldName = "Duration in minutes, if specified,";

            int fieldValue = 1; // default value to satisfy validation if null

            ValidateInteger(fieldName, this.duration.Text, e, ref fieldValue);

            // Duration must be either null or an integer >= 1
            //
            if (!e.Cancel && fieldValue < 1)
            {
                MdiForm.ErrorMessage = fieldName + " must be greater than zero.";
                MdiForm.Beep();
                e.Cancel = true;
            }
            else if (!e.Cancel && fieldValue > 24 * 60)
            {
                MdiForm.ErrorMessage = fieldName + " must be less than 24 hours.";
                MdiForm.Beep();
                e.Cancel = true;
            }
        };

        /////////////////////////////////////////////////////////////////////////////////

        base.InitializeComponents();
    }