public void ValidateColor(TLabel color, string msg)
 {
     if (EqualityComparer <TLabel> .Default.Equals(color, default(TLabel)))
     {
         throw new ArgumentNullException(nameof(color), msg);
     }
 }
            protected override bool MoveNextCore()
            {
                if (!_input.MoveNext())
                {
                    return(false);
                }
                if (!_newGroupInInputCursorDel())
                {
                    return(true);
                }

                // If this is the first step, we need to move next on _groupCursor. Otherwise, the position of _groupCursor is
                // at the start of the next group.
                if (_groupCursor.State == CursorState.NotStarted)
                {
                    // The two cursors should have the same number of elements, so if _input.MoveNext() returned true,
                    // then it must return true here too.
                    var good = _groupCursor.MoveNext() && _newGroupInGroupCursorDel();
                    Ch.Assert(good);
                }

                // Read the whole group from the auxiliary cursor.
                while (_groupCursor.State != CursorState.Done && !_newGroupInGroupCursorDel())
                {
                    TLabel label = default(TLabel);
                    TScore score = default(TScore);
                    _labelGetter(ref label);
                    _scoreGetter(ref score);
                    _parent.ProcessExample(_state, label, score);
                    _groupCursor.MoveNext();
                }

                _parent.UpdateState(_state);
                return(true);
            }
 public State(TLabel label, Action onStart, Action onUpdate, Action onStop)
 {
     this.onStart  = onStart;
     this.onUpdate = onUpdate;
     this.onStop   = onStop;
     this.label    = label;
 }
 public ClosestPair(TLabel color1, UnsignedPoint p1, TLabel color2, UnsignedPoint p2, long sqDist)
 {
     Color1         = color1;
     Point1         = p1;
     Color2         = color2;
     Point2         = p2;
     SquareDistance = sqDist;
     Validate();
 }
示例#5
0
 public static void ApplyLabel(Label Label, TLabel ThemeLabel)
 {
     Label.Visibility = ThemeLabel.Enabled ? Visibility.Visible : Visibility.Hidden;
     Label.Background = ConvertColor(ThemeLabel.BackColor);
     Label.Foreground = ConvertColor(ThemeLabel.TextColor);
     Label.FontFamily = new FontFamily(ThemeLabel.Font.Name);
     Label.FontSize   = ThemeLabel.Font.Size;
     Label.Content    = ThemeLabel.Text;
 }
 public ClosestPair(TLabel color1, UnsignedPoint p1, TLabel color2, UnsignedPoint p2)
 {
     Color1         = color1;
     Point1         = p1;
     Color2         = color2;
     Point2         = p2;
     SquareDistance = Point1.Measure(Point2);
     Validate();
 }
示例#7
0
        private void ViewLabelButton_Click(object sender, RoutedEventArgs e)
        {
            var button     = sender as Button;
            var parentItem = FindControlParent(button, typeof(ListViewItem)) as ListViewItem;

            SelectedLabel = ViewLabelsList.ItemContainerGenerator.ItemFromContainer(parentItem) as TLabel;
            if (SelectedLabel != null)
            {
                _viewModel.GenerateLabelView(SelectedLabel);
            }
        }
 /// <summary>
 /// If Color1 does not match color1, swap Color1 and Color2 and Point1 with Point2.
 /// </summary>
 /// <param name="color1">The color that should match Color1.</param>
 public ClosestPair Swap(TLabel color1)
 {
     ValidateColor(Color1, "Swapping with null Color1");
     if (!Color1.Equals(color1))
     {
         var tempColor = Color1;
         Color1 = Color2;
         Color2 = tempColor;
         var tempPoint = Point1;
         Point1 = Point2;
         Point2 = tempPoint;
     }
     return(this);
 }
示例#9
0
        private void ButtonPrint_Click(object sender, RoutedEventArgs e)
        {
            var button     = sender as Button;
            var ParentItem = FindControlParent(button, typeof(ListViewItem)) as ListViewItem;

            SelectedLabel = LabelListView.ItemContainerGenerator.ItemFromContainer(ParentItem) as TLabel;
            if (SelectedLabel != null)
            {
                var result = (Forms.DialogResult)PMessageBox.Show("Print for: " + SelectedLabel.Name + "\nCollection Date is: " + SelectedLabel.DeliveryDate, "Print for: " + SelectedLabel.Name, Forms.MessageBoxButtons.YesNo);
                if (result == Forms.DialogResult.Yes)
                {
                    MainWindow.PrintManage.Print(SelectedLabel);
                }
            }
        }
示例#10
0
        private void ButtonAddDatabase_Click(object sender, RoutedEventArgs e)
        {
            var button     = sender as Button;
            var ParentItem = FindControlParent(button, typeof(ListViewItem)) as ListViewItem;

            SelectedLabel = LabelListView.ItemContainerGenerator.ItemFromContainer(ParentItem) as TLabel;
            var newCustomer = new Customer();

            if (SelectedLabel != null)
            {
                newCustomer.Name      = SelectedLabel.Name;
                newCustomer.AllLabels = new List <TLabel>();
                newCustomer.AllLabels.Add(SelectedLabel);
                MainWindow.FirebaseManage.InsertCustomer(newCustomer, MainWindow.customersPage.CustomersList);
            }
        }
示例#11
0
        public void d_Add_Steve_LabelPage()
        {
            TLabel L = new TLabel
            {
                Name              = "MARIA TANYANYIWA",
                Address           = "FLAT 8,\r\nRADLEY COURT,\r\n34 BEACHBOROUGH ROAD,\r\nBROMLEY",
                Barcode           = "ABR1 540617530372272001",
                DeliveryDate      = "07/09/2018",
                ConsignmentNumber = "40617530372272",
                PostCode          = "BR1 5RL",
                Telephone         = "+44 7887 420381",
                Location          = "DARTFORD",
                LocationNumber    = "30",
                ParcelNumber      = "001",
                ParcelSize        = "L",
                Weight            = "up to 15.0 kg"
            };

            FirebaseManage.InsertLabel(L);
        }
示例#12
0
 private void Shift(
     ParseTree <TLabel> currentToken,
     IDfa <Optional <Rule <TLabel> >, TLabel> dfa,
     IState state,
     TLabel currentCategory,
     IEnumerator enumerator)
 {
     this.nodesStack.Peek().Add(currentToken);
     this.statesStack.Pop();
     this.statesStack.Push(dfa.Transitions(state)[currentCategory]);
     if (!enumerator.MoveNext())
     {
         this.diagnostics.Add(new Diagnostic(
                                  DiagnosticStatus.Error,
                                  PrematureEofDiagnosticType,
                                  "Parsing finished before reading all tokens",
                                  new List <Range>()));
         throw new ParseException("Premature EOF");
     }
 }
示例#13
0
 private void RMenuItem_Click(object sender, RoutedEventArgs e)
 {
     SelectedLabel = (TLabel)LabelListView.SelectedItem;
     Console.WriteLine("Name: " + SelectedLabel.Name);
 }
示例#14
0
 public void GenerateLabelView(TLabel SelectedLabel)
 {
     ViewSelectedLabelSource = SelectedLabel;
 }
示例#15
0
        private void Form1_Load(object sender, EventArgs e)
        {
            //UnitTest3 test = new UnitTest3();
            //UnitTest4 test = new UnitTest4();
            //UnitTest2 test = new UnitTest2();
            //UnitTest1 test = new UnitTest1();
            //test.TestTunnelMonth();
            //test.test();


            // http get请求
            //string strURL = "http://localhost/WinformSubmit.php?tel=11111&name=张三";
            //System.Net.HttpWebRequest request;
            //// 创建一个HTTP请求
            //request = (System.Net.HttpWebRequest)WebRequest.Create(strURL);
            ////request.Method="get";
            //try
            //{
            //    System.Net.HttpWebResponse response;
            //    response = (System.Net.HttpWebResponse)request.GetResponse();
            //    System.IO.StreamReader myreader = new System.IO.StreamReader(response.GetResponseStream(), Encoding.UTF8);
            //    string responseText = myreader.ReadToEnd();
            //    myreader.Close();
            //    MessageBox.Show(responseText);
            //}
            //catch(Exception ex)
            //{
            //    MessageBox.Show("连接远程服务器失败!");
            //    Console.Write("finished");
            //}

            // 创建侧线图
            Panel tableP = new Panel();

            tableP.Location  = new Point(20, 20);
            tableP.Width     = 1054;
            tableP.Height    = 660;
            tableP.BackColor = Color.White;
            tableP.Paint    += new PaintEventHandler(panel1_Paint1);

            Panel cexianPanel = new Panel();

            cexianPanel.Width     = 1025;
            cexianPanel.Height    = 616;
            cexianPanel.Location  = new Point(25, 2);
            cexianPanel.BackColor = Color.Transparent;

            TLabel title_label = new TLabel()
            {
                Angle = -90
            };

            title_label.Text     = "喷射混凝土厚度(cm)";
            title_label.Visible  = true;
            title_label.Width    = 15;
            title_label.Height   = 200;
            title_label.Font     = new Font("黑体", 9, FontStyle.Regular);
            title_label.Location = new Point(10, 200);
            //cexianPanel.Controls.Add(title_label);

            TLabel b = new TLabel();

            b.Text     = "里 程";
            b.Visible  = true;
            b.Width    = 100;
            b.Height   = 20;
            b.Font     = new Font("黑体", 9, FontStyle.Regular);
            b.Location = new Point(450, 595);
            cexianPanel.Controls.Add(b);

            List <String> item = new List <String>()
            {
                "G测线", "E测线", "C测线", "A测线", "B测线", "D测线", "F测线"
            };
            List <String> x = new List <String>()
            {
                "K10+450", " ", "K10+450", " ", "K10+450", " ", "K10+450", " ", "K10+450", " ", " ", " ", " ", " ", " ", " ", " "
            };
            List <String> null_x = new List <String>()
            {
                " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "
            };
            List <String> y = new List <String>()
            {
                "25", "35", "30", "25", "35", "25", "35", "30", "25", "35", null, null, null, null, null, null, null
            };

            for (var i = 0; i < item.Count; i++)
            {
                var isLast = i == item.Count - 1 ? true : false;
                cexianPanel.Controls.Add(createChart(item[i], i, isLast, x, null_x, y));
            }



            int startW = 2;

            for (var i = 0; i < 11; i++)
            {
                string text  = " ";
                Font   font  = new Font("黑体", 8);
                int    width = 0;
                Label  label = new Label();
                if (i == 0)
                {
                    text  = "贵州省交通建设工程检测中心有限责任公司";
                    width = 270;
                }
                if (i == 1)
                {
                    text  = "保泸高速土建S1合同";
                    width = 120;
                }
                if (i == 2)
                {
                    text  = "老营特长隧道右幅进口喷射混凝土厚度图";
                    width = 241;
                }
                if (i == 3)
                {
                    text  = "制图";
                    width = 60;
                }
                if (i == 3)
                {
                    text  = "王宝强";
                    width = 70;
                }
                if (i == 4)
                {
                    text  = "复核";
                    width = 50;
                }
                if (i == 5)
                {
                    text  = "贾乃亮";
                    width = 60;
                }
                if (i == 6)
                {
                    text  = "图号";
                    width = 50;
                }
                if (i == 7)
                {
                    text  = "附图1";
                    width = 60;
                }
                if (i == 8)
                {
                    text  = "日期";
                    width = 50;
                }
                if (i == 9)
                {
                    text  = DateTime.Now.ToString("yyyy.MM.dd");
                    width = 80;
                }
                label.Location  = new Point(startW, 620);
                startW         += width;
                label.Text      = text;
                label.TextAlign = ContentAlignment.MiddleCenter;
                label.Font      = font;
                label.Paint    += new PaintEventHandler(panel1_Paint2);
                label.Width     = width;
                label.Height    = 38;
                tableP.Controls.Add(label);
            }
            tableP.Controls.Add(title_label);
            tableP.Controls.Add(cexianPanel);
            this.Controls.Add(tableP);
            // 绘图
            Bitmap newBitmap = new Bitmap(tableP.Width, tableP.Height);

            tableP.DrawToBitmap(newBitmap, tableP.ClientRectangle);
            Graphics g = Graphics.FromImage(newBitmap);

            g.DrawImage(newBitmap, newBitmap.Width, newBitmap.Height);
            g.Dispose();
            newBitmap.Save(Path.Combine(System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase, "111.png"), System.Drawing.Imaging.ImageFormat.Png);
            newBitmap.Dispose();
        }
示例#16
0
 private void Call(IDfa <Optional <Rule <TLabel> >, TLabel> dfa, IState state, TLabel actionLabel)
 {
     this.statesStack.Pop();
     this.statesStack.Push(dfa.Transitions(state)[actionLabel]);
     this.dfaStack.Push(this.rules[actionLabel]);
     this.statesStack.Push(this.rules[actionLabel].StartingState());
     this.nodesStack.Push(new List <ParseTree <TLabel> >());
 }
示例#17
0
        public void CreateComponents()
        {
            Application = new TApplication(null);
            Application.Initialize();
            Application.Run();

            var el    = Browser.GetElementById("helloWorld");
            var lForm = new TForm(null);

            lForm.Width = 800;
            // el it's a div element in html file, we are using as container for our form
            lForm.Show(el);

            var lFontsPanel = new TPanel(lForm);

            lFontsPanel.Height = 150;
            lFontsPanel.Width  = 800;
            lFontsPanel.Parent = lForm;

            var lFontsCombo = new TComboBox(lForm);

            lFontsCombo.Left  = 30;
            lFontsCombo.Top   = 50;
            lFontsCombo.Width = 130;
            // Add combo inside TPanel
            lFontsCombo.Parent = lFontsPanel;

            lFontsCombo.Items.Add("Arial");
            lFontsCombo.Items.Add("Verdana");
            lFontsCombo.Items.Add("Helvetica");
            lFontsCombo.Items.Add("Times");

            var lFontSize = new TComboBox(lForm);

            lFontSize.Left   = 200;
            lFontSize.Top    = 50;
            lFontSize.Width  = 80;
            lFontSize.Parent = lFontsPanel;
            for (var i = 8; i <= 72; i += 4)
            {
                lFontSize.Items.Add(i.ToString());
            }

            var lLabel = new TLabel(lForm);

            lLabel.Left    = 320;
            lLabel.Top     = 50;
            lLabel.Caption = "Choose font name and size!";
            lLabel.Parent  = lFontsPanel;

            // Assign combo events
            lFontsCombo.OnSelect = (a) => { lLabel.Font.Name = lFontsCombo.Text; };
            lFontSize.OnSelect   = (a) => { lLabel.Font.Size = StrToInt(lFontSize.Text); };

            var lSecondPanel = new TPanel(lForm);

            lSecondPanel.Top    = 220;
            lSecondPanel.Height = 150;
            lSecondPanel.Width  = 800;
            lSecondPanel.Parent = lForm;

            var lCheckBox = new TCheckBox(lForm);

            lCheckBox.Top     = 20;
            lCheckBox.Left    = 30;
            lCheckBox.Caption = "CheckBox control";
            lCheckBox.Parent  = lSecondPanel;

            var lRadioButton = new TRadioButton(lForm);

            lRadioButton.Top     = 80;
            lRadioButton.Left    = 30;
            lRadioButton.Caption = "RadioButton control";
            lRadioButton.Parent  = lSecondPanel;

            var lChangeButton = new TButton(lForm);

            lChangeButton.Left    = 220;
            lChangeButton.Top     = 20;
            lChangeButton.Caption = "Change progress bar mode";
            lChangeButton.Parent  = lSecondPanel;
            lChangeButton.OnClick = @ChangeButtonClick;

            var lIncButton = new TButton(lForm);

            lIncButton.Left    = 220;
            lIncButton.Top     = 80;
            lIncButton.Caption = "Increase progress bar value";
            lIncButton.Parent  = lSecondPanel;
            lIncButton.OnClick = (a) => { fProgress.Position = fProgress.Position + 5; if (fProgress.Position >= fProgress.Max)
                                          {
                                              fProgress.Position = 0;
                                          }
            };

            fProgress        = new TProgressBar(lForm);
            fProgress.Top    = 55;
            fProgress.Left   = 420;
            fProgress.Max    = 100;
            fProgress.Parent = lSecondPanel;
        }
 /// <summary>
 /// Since categories may have been merged since this was created, update Color1 and Color2
 /// to reflect the current categorization of Point1 and Point2.
 /// </summary>
 /// <param name="clusters">Current clustering of points.</param>
 public ClosestPair Relabel(Classification <UnsignedPoint, TLabel> clusters)
 {
     Color1 = clusters.GetClassLabel(Point1);
     Color2 = clusters.GetClassLabel(Point2);
     return(this);
 }
示例#19
0
        public void HelloWorld()
        {
            Application = new TApplication(null);
            Application.Initialize();
            Application.Run();

            // Create form
            var lForm = new TForm(null);

            lForm.Width = 800;
            // we can display the form in an existing div element. If Show parameter is nil, a new div is created
            lForm.Show(null);

            var lTopLabel = new TLabel(lForm);

            lTopLabel.Left    = 1;
            lTopLabel.Parent  = lForm;
            lTopLabel.Caption = "Write the item caption on the edit and press Add New button to add to ListBox:";

            var lButton = new TButton(lForm);

            lButton.Left    = 50;
            lButton.Top     = 50;
            lButton.Caption = "Add New";
            lButton.Parent  = lForm;

            var lEdit = new TEdit(lForm);

            lEdit.Left   = 150;
            lEdit.Top    = 50;
            lEdit.Parent = lForm;

            var lListBox = new TListBox(lForm);

            lListBox.Left        = 350;
            lListBox.Top         = 50;
            lListBox.Parent      = lForm;
            lListBox.Width       = 250;
            lListBox.MultiSelect = true;

            lButton.OnClick = (s) => { lListBox.Items.Add(lEdit.Text); };

            var lChangeLabel = new TLabel(lForm);

            lChangeLabel.Top     = 165;
            lChangeLabel.Parent  = lForm;
            lChangeLabel.Caption = "Press button to change label font:";

            var lChangeButton = new TButton(lForm);

            lChangeButton.Left    = 50;
            lChangeButton.Top     = 200;
            lChangeButton.Caption = "Change font";
            lChangeButton.Parent  = lForm;

            var lLabel = new TLabel(lForm);

            lLabel.Left    = 150;
            lLabel.Top     = 200;
            lLabel.Caption = "Sample text!";
            lLabel.Parent  = lForm;

            lChangeButton.OnClick = (s) => { lLabel.Font.Name = "Verdana"; lLabel.Font.Size = 24; };

            var lMemo = new TMemo(lForm);

            lMemo.Left   = 50;
            lMemo.Top    = 300;
            lMemo.Width  = 250;
            lMemo.Height = 150;
            lMemo.Parent = lForm;

            var lMemoButton = new TButton(lForm);

            lMemoButton.Left    = 350;
            lMemoButton.Top     = 325;
            lMemoButton.Caption = "Add text";
            lMemoButton.Parent  = lForm;
            var lList = TStringList.Create();

            lList.Add("one line");
            lList.Add("another one");
            lMemoButton.OnClick = (s) => { lMemo.Lines.AddStrings(lList); };

            var lDisplayButton = new TButton(lForm);

            lDisplayButton.Top     = lMemoButton.Top;
            lDisplayButton.Left    = 450;
            lDisplayButton.Caption = "Show memo text";
            lDisplayButton.Parent  = lForm;
            lDisplayButton.OnClick = (s) => { ShowMessage(lMemo.Lines.Text); };
        }