Ejemplo n.º 1
0
        public static void Meni()
        {
            LocalControlerClass lc = new LocalControlerClass();

            Console.WriteLine(lc.ReadXMLTime(putanja).ToString());
            Console.WriteLine("*******MENI********");
            Console.WriteLine("1.Da li zelite da kreirate novi kontroler");
            Console.WriteLine("2.Da li zelite da upalite  kontroler");
            Console.WriteLine("Za kraj unosa, unesite 0");

            caseSwitch = int.Parse(Console.ReadLine());
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            LocalControlerClass lc = new LocalControlerClass();

            OpenServer();
            Meni();

            do
            {
                switch (caseSwitch)
                {
                case 1:


                    Console.WriteLine("Koji kontroler zelite da kreirate:");
                    idk  = int.Parse(Console.ReadLine());
                    path = @"..\..\..\Kontroleri\controler" + idk + ".xml";
                    lc.CreateXMLK(path);
                    string[] p2   = path.Split('\\');
                    string   ime2 = p2[4].Substring(0, p2[4].Length - 4);

                    Meni();
                    break;



                case 2:


                    Console.WriteLine("Koji kontroler zelite da upalite:");
                    IzlistajKontrolere();
                    idk  = int.Parse(Console.ReadLine());
                    path = @"..\..\..\Kontroleri\controler" + idk + ".xml";

                    string[] p   = path.Split('\\');
                    string   ime = p[4].Substring(0, p[4].Length - 4);
                    aktivniKontroleri.Remove(ime);
                    lc.LocalControlerCode = idk;
                    lc.TimeStamp          = DateTime.Now;
                    bool success;

                    Thread t = new Thread(new ThreadStart(() =>
                    {
                        while (true)
                        {
                            ConnectwithAMS();
                            proksi2.ReadXML(path, lc.LocalControlerCode, lc.TimeStamp);

                            Thread.Sleep(lc.ReadXMLTime(putanja));
                        }
                    }));
                    t.IsBackground = true;
                    t.Start();



                    Meni();
                    break;
                }
            } while (caseSwitch != 0);
            File.Delete(path);
            Console.ReadLine();
        }