Esempio n. 1
0
        //*********************************************************
        public void Thread1()
        {
            // try
            {
                // while (request)
                {
                    serialPort.ReadExisting();
                    byte[] data = new byte[8];
                    data[0] = 75;
                    data[1] = 75;
                    data[2] = 75;
                    serialPort.Write(data, 0, 3);

                    byte[] d = new byte[10];

                    label1.Text = "";
                    if (serialPort.ReadChar() == 65)
                    {
                        if (serialPort.ReadChar() == 65)
                        {
                            for (int i = 0; i <= 3; i++)
                            {
                                d[i] = Convert.ToByte(serialPort.ReadChar());
                            }

                            P_L.Invoke(new Action(() => P_L.Text = d[0].ToString()));
                            P_H.Invoke(new Action(() => P_H.Text = d[1].ToString()));

                            T_L.Invoke(new Action(() => T_L.Text = d[2].ToString()));
                            T_H.Invoke(new Action(() => T_H.Text = d[3].ToString()));

                            double Pan_Position = (((d[1] * 100) + d[0]));
                            double Til_Position = (((d[3] * 100) + d[2]));

                            Pan.Invoke(new Action(() => Pan.Text = Pan_Position.ToString()));
                            Til.Invoke(new Action(() => Til.Text = Til_Position.ToString()));

                            // listBox1.Invoke(new Action(() => listBox1.Items.Add(Pan_Position.ToString())));

                            // listBox1.Invoke(new Action(() => listBox1.Items.Add("------------------")));

                            //   listBox1.Invoke(new Action(() => T_L.Text = d[2].ToString()));
                            //   listBox1.Invoke(new Action(() => T_H.Text = d[3].ToString()));
                            //
                        }
                    }
                    System.Threading.Thread.Sleep(100);
                }
            }
            // catch
            {
            }
        }
Esempio n. 2
0
        public void Draw(SpriteBatch Target, Camera cam)//TODO: Dobavit param dla begin
        {
            foreach (var Tile in Tiles)
            {
                foreach (var Til in Tile)
                {
                    if (Til != null)
                    {
                        Til.DrawDecoration(Target);
                        Til.Draw(Target);
                    }
                }
            }

            foreach (var CP in ControlPoints)
            {
                CP.Draw(Target);
            }

            Attack_Radius.Draw(Target);

            Target.End();

            Target.Begin(SpriteSortMode.BackToFront);
            foreach (var arrow in PathFindingArrows)
            {
                arrow.Draw(Target);
            }
            Target.End();

            Target.Begin(SpriteSortMode.BackToFront, null, null, null, null, null, cam.GetTransform());
            foreach (var Tile in Tiles)
            {
                foreach (var Til in Tile)
                {
                    if (Til != null)
                    {
                        Til.DrawUnit(Target);
                    }
                }
            }

            FlyingTextProcessor.Draw(Target);
            Target.End();

            Target.Begin(SpriteSortMode.BackToFront);
            Info.Draw(Target);
            foreach (var Tile in Tiles)
            {
                foreach (var Til in Tile)
                {
                    if (Til != null && Til.UnitOnTile != null)
                    {
                        Til.UnitOnTile.DrawUI(Target, cam);
                    }
                }
            }
            Target.End();

            Target.Begin(SpriteSortMode.BackToFront, null, null, null, null, null, cam.GetTransform());
        }
Esempio n. 3
0
            public void SendEmail_Renamed()
            {
                //Try

                MailMessage MailMsg = new MailMessage();

                MailMsg.From = this.Fra;
                MailMsg.To.Add(this.Til);
                if (SendToBCC)
                {
                    MailMsg.Bcc.Add(this.BCC);
                }

                MailMsg.BodyEncoding = this.BodyEncoding;
                MailMsg.Subject      = this.Subject;
                MailMsg.Body         = this.Body;
                MailMsg.Priority     = this.Priority;
                MailMsg.IsBodyHtml   = this.IsBodyHtml; //True
                MailMsg.DeliveryNotificationOptions = this.DeliveryNotificationOptions;
                if (this.Til.Address.ToString().IndexOf("test@") > 0)
                {
                    MailMsg.DeliveryNotificationOptions = System.Net.Mail.DeliveryNotificationOptions.None;
                }

                // attach each file attachment
                foreach (string strfile in this.FileList)
                {
                    if (!(strfile.Trim() == ""))
                    {
                        if (System.IO.File.Exists(strfile))
                        {
                            Attachment MsgAttach = new Attachment(strfile.Trim());
                            MailMsg.Attachments.Add(MsgAttach);
                        }
                    }
                }



                //Smtpclient to send the mail message
                SmtpClient SmtpMail = new SmtpClient();

                //SmtpMail.Host = SmtpURL
                SmtpMail.Send(MailMsg);

                Log.AddLog(status: "SendEmail", logtext: string.Format("Send - To: {0}, Subject: {1}", Til.ToString(), Subject), Metode: "SendEmail");

                //Message Successful
                //Catch ex As Exception
                //Message Error
                //End Try
            }