/// <summary>
        /// Writes data to files
        /// </summary>
        public void WriteToFiles()
        {
            CredentialsDatabase cd = new CredentialsDatabase();

            cd.Write(c.GetDictionary);

            ProductDatabase pd = new ProductDatabase();

            pd.Write(p.GetProduct, p.GetAddedProduct);
        }
Exemple #2
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);


            CredentialsDatabase cd = new CredentialsDatabase();
            ProductDatabase     pd = new ProductDatabase();

            Products    p = new Products(pd.LoadProduct(), pd.LoadNewProducts());
            Credentials c = new Credentials(cd.Load());

            serverController = new ServerController(p, c, wss);

            ServerForm     sf = new ServerForm(serverController);
            AddProductForm af = new AddProductForm(p, serverController.OnAddProduct);

            sf.showAddForm    += af.OnShowForm;
            af.showServerForm += sf.OnShowForm;
            sf.closeProduct   += serverController.OnCloseProduct;
            wss.ReuseAddress   = true;


            // Add the Chat websocket service
            wss.AddWebSocketService <MessageReceived>("/MessageReceived");

            // Start the server
            wss.Start();


            Application.Run(sf);


            // Stop the server
            wss.Stop();
        }