Пример #1
0
 /// <summary>
 /// Подгон размеров контролов
 /// </summary>
 public void ChangeSize()
 {
     if (Uc != null)
     {
         if (Uc.Width != tab.ClientRectangle.Width ||
             Uc.Height != tab.ClientRectangle.Height
             )
         {
             Uc.SetBounds(0, 0, tab.ClientRectangle.Width, tab.ClientRectangle.Height);
         }
     }
 }
Пример #2
0
        public void Show(object ReceiveBytes)
        {
            try
            {
                byte[] receiveBytes = (byte[])ReceiveBytes;

                byte[] packet_length = new byte[4];
                byte[] ip_length     = new byte[4];
                byte[] rec_port      = new byte[4];

                Array.Copy(receiveBytes, 0, packet_length, 0, 4);
                Array.Copy(receiveBytes, 4, ip_length, 0, 4);

                int PacketLength = System.BitConverter.ToInt32(packet_length, 0);
                int Ip_length    = System.BitConverter.ToInt32(ip_length, 0);
                int pic_length   = PacketLength - 12 - Ip_length;

                byte[] rec_pic = new byte[pic_length];
                byte[] rec_ip  = new byte[Ip_length];
                Array.Copy(receiveBytes, 8, rec_ip, 0, Ip_length);
                Array.Copy(receiveBytes, 8 + Ip_length, rec_port, 0, 4);
                Array.Copy(receiveBytes, 12 + Ip_length, rec_pic, 0, pic_length);

                string IP   = System.Text.Encoding.ASCII.GetString(rec_ip);
                int    PORT = System.BitConverter.ToInt32(rec_port, 0);

                //MessageBox.Show(PacketLength.ToString());

                MemoryStream ms    = new MemoryStream(rec_pic);
                Image        image = Image.FromStream(ms);
                //将图片显示出来
                UserControl1 Uc;
                if (list_UC.Count > 0)
                {
                    for (int i = 0; i < list_UC.Count; i++)
                    {
                        Uc = list_UC[i];
                        if (Uc.Name == IP + PORT.ToString())
                        {
                            Uc.set_PictureBox(image);
                            break;
                        }
                    }
                }
            }
            catch (Exception e)
            {
                //MessageBox.Show("显示图片"+e.ToString());
            }
        }
Пример #3
0
        public void print()
        {
            bool append = true;

            if (Id == 0)
            {
                append = false;
            }
            using (System.IO.StreamWriter file = new System.IO.StreamWriter(@".\Matrixes\Pe.txt", append))
            {
                string matrixMultiplier = Uc.ToString() + "*" + G.ToString() + "/" + B.ToString() + "*" + Length.ToString();
                string leadingSpaces    = new string(' ', matrixMultiplier.Length);
                //
                file.WriteLine("Pe " + Id.ToString());
                file.WriteLine("Segment: " + SegmentInfo);
                //матриці
                for (int i = 0; i < 2; i++)
                {
                    string line = "";
                    if (i != 0)
                    {
                        line += leadingSpaces;
                    }
                    else
                    {
                        line += matrixMultiplier;
                    }
                    line += "|";
                    line += String.Format(format, CoefMatrix[i][0]);
                    line += "|";
                    if (i != 0)
                    {
                        line += "   ";
                    }
                    else
                    {
                        line += " = ";
                    }
                    line += "|";
                    line += String.Format(format, Pe[i][0]);
                    line += "|";
                    file.WriteLine(line);
                }
            }
        }
Пример #4
0
 private void Edit_Click(object sender, EventArgs e)
 {
     if (DGV.CurrentCell != null && uint.TryParse(DGV.Rows?[DGV.CurrentCell.RowIndex]?.Cells?[0].Value?.ToString(), out uint Uc) && uint.TryParse(DGV.Rows?[DGV.CurrentCell.RowIndex]?.Cells?[3].Value?.ToString(), out uint co))
     {
         Forms.frmEditQty = new UIForms.FrmEditQty(co)
         {
             Code = Uc
         };
         Forms.frmEditQty.labelName.Text  = $"Name : {RemoteDBs.Live.Items.Get[Uc].name}\t Code : {Uc.ToString()}";
         Forms.frmEditQty.btnOK.Click    += EditQtyOK_Click;
         Forms.frmEditQty.TxtQty.KeyDown += EditQtyOK_KeyDown;
         Forms.frmEditQty.ShowDialog();
     }
 }
 private void Menubuton_KitapTeslimi_Click(object sender, RoutedEventArgs e)
 {
     Uc.Uc_Ekle(icerik, new Uc_KitapTeslimi());
 }
Пример #6
0
        public void Test_GetCompanyName()
        {
            var actual = Uc.GetCompanyName(new Ticker());

            Assert.IsNotNull(actual);
        }
Пример #7
0
        public void Test_GetTickerNews()
        {
            var actual = Uc.GetTickerNews(new Ticker());

            Assert.IsNotNull(actual);
        }