private void updateUI(String message)
        {
            Func <int> del = delegate()
            {
                String infMes = ">>>>" + message + "\n";
                fm2.setText(infMes);

                return(0);
            };

            fm2.Invoke(del);
        }
Пример #2
0
        public void updateUI(string message, Boolean isConsole)
        {
            Func <int> del = delegate()
            {
                fm2.setText(message + System.Environment.NewLine);
                if (!isConsole)
                {
                    sc.incomingMessageSwitcher(message);
                    if (message.Contains("#"))
                    {
                        if (message.Split('#')[0].Equals("si"))
                        {
                            changeStr(conn, message.Split('#')[1]);
                        }
                        if (message.Split('#')[0].Equals("ex"))
                        {
                            removeClientAndName(message.Split('#')[1]);
                        }
                        if (message.Split('#')[0].Equals("kli"))
                        {
                            if (message.Split('#')[1].Equals("aç"))
                            {
                                fm2.klimaAcmaTalebi(nameList[connessioniServer.IndexOf(sonMesajGonderen)], sonMesajGonderen);
                            }
                            else
                            {
                                fm2.klimaKapamaTalebi(nameList[connessioniServer.IndexOf(sonMesajGonderen)], sonMesajGonderen);
                            }
                        }
                    }
                    else
                    {
                        fm2.setText("Gelen sıcaklık: " + message + "\n");
                    }
                }
                return(0);
            };

            fm2.Invoke(del);
        }
Пример #3
0
        public void InitializeDB()
        {
            MySqlConnectionStringBuilder builder = new MySqlConnectionStringBuilder();

            builder.Server   = SERVER;
            builder.UserID   = UID;
            builder.Password = PASSWORD;
            builder.Database = DATABASE;
            String connSTring = builder.ToString();

            builder = null;
            fm2.setText(connSTring + "\n");
            dbConn = new MySqlConnection(connSTring);
        }
Пример #4
0
        public void baglan(String name)
        {
            try
            {

                fm2.serialPort1.PortName = name;
                fm2.serialPort1.BaudRate = 9600;
                fm2.serialPort1.Open();
                fm2.setText("klimaya bağlanıldı.\n");
                gonder("1");
                Thread appoggio = new Thread(seriPortDinle);
                appoggio.IsBackground = true;
                appoggio.Start();
            }
            catch (Exception e)
            {
                Console.WriteLine("Hata:" + e.Message);
            }

        }