Пример #1
0
        private void Home_Shown(object sender, EventArgs e)
        {
            try
            {
                GigSpace.CommunityControl.Init();
                GigSpace.SetSTAT("Prêt");
                ShowPanel(GigSpace.HomeControl);

                GPlayer.Welcome();
            }
            catch
            {
            }
        }
Пример #2
0
        private void Home_FormClosing(object sender, FormClosingEventArgs e)
        {
            e.Cancel = !close;
            if (!close)
            {
                this.Hide();
            }
            else if (SettingsManager.GetBool("CONNECT"))
            {
                if (File.Exists(Application.StartupPath + @"\Data\AT.dat"))
                {
                    File.Delete(Application.StartupPath + @"\Data\AT.dat");
                }
                GigSpace.Client.Logout();
            }

            if (close)
            {
                GPlayer.Goodbye();
            }
        }
Пример #3
0
        internal static void Run()
        {
            try
            {
                string[] f  = File.ReadAllLines(Application.StartupPath + @"\Data\" + Client.Username + ".dat");
                string   lm = f[0];
                string   ln = f[1];
                int      mc = 0;
                int      nc = 0;
                int      i  = 0;
                while (Exec)
                {
                    try
                    {
                        mc        = 0;
                        nc        = 0;
                        Connected = Client.GetCommunityInfo().NumberPlayers;
                        SetCON(Connected);
                        List <GigMessage> msg = GigSpace.Client.GetMessages();
                        string            ma  = "";
                        for (i = msg.Count - 1; i >= 0; i--)
                        {
                            GigMessage m = msg[i];
                            if (lm == m.Message)
                            {
                                break;
                            }
                            mc++;
                            ma = m.Message;
                        }
                        if (ma.Length > 0)
                        {
                            lm = msg[msg.Count - 1].Message;
                            mc = msg.Count - i - 1;
                        }


                        List <string> noti = GigSpace.Client.GetNotifications();
                        ma = "";
                        for (i = noti.Count - 1; i >= 0; i--)
                        {
                            string m = noti[i];
                            if (ln == m)
                            {
                                break;
                            }
                            nc++;
                            ma = m;
                        }
                        if (ma.Length > 0)
                        {
                            ln = noti[noti.Count - 1];
                            nc = noti.Count - i - 1;
                        }

                        if (mc > 0 || nc > 0)
                        {
                            File.WriteAllLines(Application.StartupPath + @"\Data\" + Client.Username + ".dat", new string[2] {
                                lm, ln
                            });
                            if (nc > 0 && NotificationArrived != null)
                            {
                                NotificationArrived(nc);
                                GPlayer.NEWNOTIF();
                            }
                            if (mc > 0 && MessageArrived != null)
                            {
                                MessageArrived(mc);
                                GPlayer.NEWMSG();
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        GigSpace.LogError(ex);
                    }

                    Thread.Sleep(SettingsManager.GetInt("DELAY") * 1000);
                }
            }
            catch (Exception ex)
            {
                GigSpace.LogError(ex);
            }
        }
Пример #4
0
        public static void Initialize()
        {
            try
            {
                SettingsManager.Init();
                if (!File.Exists(Application.StartupPath + @"\FIRSTRUN.dat"))
                {
                    File.Create(Application.StartupPath + @"\FIRSTRUN.dat");
                    GPlayer.Install();
                }

                Client = new GigClient(HOST);
                SplashScreen.frm.Refresh();
                if (!File.Exists(Application.StartupPath + @"\Data\AT.dat") || SettingsManager.GetBool("CONNECT"))
                {
                    LoginFrm frm = new LoginFrm();
                    frm.ShowDialog();
                    if (frm.close)
                    {
                        File.WriteAllText(Application.StartupPath + @"\Data\AT.dat", Client.AccessToken);
                        File.WriteAllText(Application.StartupPath + @"\Data\UN.dat", Client.Username);
                        Client.MyAccount = Client.GetUserInfo(Client.Username);
                        //AsyncExec ae = new AsyncExec(GetUI);
                        //ae.BeginInvoke(null, null);
                    }
                    else
                    {
                        Application.Exit();
                    }
                }
                else
                {
                    SplashScreen.frm.Show();
                    Client.AccessToken = File.ReadAllText(Application.StartupPath + @"\Data\AT.dat");
                    Client.Username    = File.ReadAllText(Application.StartupPath + @"\Data\UN.dat");

                    // check AT
                    if (!Client.IsConnected())
                    {
                        LoginFrm frm = new LoginFrm();
                        frm.ShowDialog();
                        if (frm.close)
                        {
                            File.WriteAllText(Application.StartupPath + @"\Data\AT.dat", Client.AccessToken);
                            File.WriteAllText(Application.StartupPath + @"\Data\UN.dat", Client.Username);
                        }
                        else
                        {
                            Application.Exit();
                        }
                    }
                    else
                    {
                        Client.MyAccount = Client.GetUserInfo(Client.Username);
                        //AsyncExec ae = new AsyncExec(GetUI);
                        //ae.BeginInvoke(null, null);
                    }
                }

                if (!File.Exists(Application.StartupPath + @"\Data\" + Client.Username + ".dat"))
                {
                    File.WriteAllLines(Application.StartupPath + @"\Data\" + Client.Username + ".dat", new string[2] {
                        "m1", "n1"
                    });
                }



                // Initialize Controls
                ProfileControl     = new ProfileCtrl();
                CommunityControl   = new CICtrl();
                CommandControl     = new CmdCTRL();
                FriendControl      = new FriendCtrl();
                GIGPControl        = new GIGPCtrl();
                HomeControl        = new HomeCtrl();
                MessagesControl    = new MessagesCtrl();
                ShopControl        = new ShopCtrl();
                TransactionControl = new Transacfrm();
                AboutControl       = new AboutCtrl();
                AllUsersControl    = new AllUsersCtrl();

                SplashScreen.frm.Close();
            }
            catch (Exception ex)
            {
                GigSpace.LogError(ex);
            }
        }