Beispiel #1
0
        public Form1()
        {
            InitializeComponent();
            this.Text = "Categories";
            this.Left = 10;
            this.Top  = 10;
            this.Invalidate();
            button2.Hide();

            form = new Form2(this);
            form.Activate();
            form.Show();
            form.Hide();
            form.Left = this.Left;
            form.Top  = this.Top;
            form.Invalidate();

            editor = new FormCategoryEditor(this);
            editor.Activate();
            editor.Show();
            editor.Hide();
            editor.Left = this.Left;
            editor.Top  = this.Top;
            editor.Invalidate();

            info = Informer.getInstance();

            refreshInfo();
        }
Beispiel #2
0
 public static Informer getInstance()
 {
     if (instance == null)
     {
         instance = new Informer();
     }
     return(instance);
 }
Beispiel #3
0
        public static void Main(string[] args)
        {
            Console.WriteLine("Welcome to the client application, you will be connected shortly...");
            Informer i    = new Informer();
            Int32    port = 13000;

            try
            {
                TcpClient     client = new TcpClient("127.0.0.1", port);
                NetworkStream stream = client.GetStream();
                string        poruka = "";
                while (true)
                {
                    poruka = i.AskClient();
                    if (poruka == "exit")
                    {
                        break;
                    }
                    Byte[] data = System.Text.Encoding.ASCII.GetBytes(poruka);
                    stream.Write(data, 0, data.Length);

                    Console.WriteLine("\n----------------------------------------------------------\n");
                    Console.WriteLine("----------------PORUKA USPESNO POSLATA!-------------------");
                    Console.WriteLine("\n----------------------------------------------------------\n");
                    data = new Byte[256];

                    // String to store the response ASCII representation.
                    String responseData = String.Empty;

                    // Read the first batch of the TcpServer response bytes.
                    Int32 bytes = stream.Read(data, 0, data.Length);
                    responseData = System.Text.Encoding.ASCII.GetString(data, 0, bytes);
                    //ODGOVOR NA PRVU PORUKU
                    if (responseData == "WRITTEN")
                    {
                        i.PrvaPorukaUspesna();
                    }
                    else if (responseData == "NOTWRITTEN")
                    {
                        i.PrvaPorukaNeuspesna();
                    }
                    else
                    {
                        //i.PrintList(responseData);
                        Console.WriteLine(responseData);
                    }
                }
                stream.Close();
                client.Close();
                Console.WriteLine("\n Press Enter to continue...");
                Console.Read();
            }
            catch (SocketException e)
            {
                Console.WriteLine("Socket Exception: " + e.Message);
                throw;
            }
        }
Beispiel #4
0
        public Form2(Form1 form)
        {
            InitializeComponent();
            this.Text = "Products";
            this.form = form;

            editor = new FormProductEditor(this);
            editor.Activate();
            editor.Show();
            editor.Hide();
            editor.Left = this.Left;
            editor.Top  = this.Top;
            editor.Invalidate();

            button2.Hide();

            info = Informer.getInstance();

            refreshInfo();
        }
Beispiel #5
0
 public FormProductEditor(Form2 form)
 {
     this.form = form;
     info      = Informer.getInstance();
     InitializeComponent();
 }
 public FormCategoryEditor(Form1 form)
 {
     this.form = form;
     info      = Informer.getInstance();
     InitializeComponent();
 }