Ejemplo n.º 1
0
 private void btnSet_Click(object sender, EventArgs e)
 {
     AccountHelper accounthelper = new AccountHelper();
     accounthelper.Account = textBoxPlayer.Text;
     accounthelper.Password = textBoxPass.Text;
     accounthelper.WriteToFile();
 }
Ejemplo n.º 2
0
 public PasswordInputForm()
 {
     InitializeComponent();
     AccountHelper accounthelper = new AccountHelper();
     if (accounthelper.ReadFromFile())
     {
         textBoxPlayer.Text = accounthelper.Account;
         textBoxPass.Text = accounthelper.Password;
     }
 }
Ejemplo n.º 3
0
        private void ReceiveInformation()
        {
            while (!formClose)
            {
                try {

                    string UserName="";
                    string Password="";
                    int waittime = 0;
                    AccountHelper accounthelper = new AccountHelper();
                    if (accounthelper.ReadFromFile())
                    {
                        UserName = accounthelper.Account;
                        Password = accounthelper.Password;
                        waittime = accounthelper.UpdateInterval;

                        WCFClient client = new WCFClient(UserName, Password);
                        int count = client.CheckScheduleCount();
                        List<Schedule> schedules = new List<Schedule>();
                        if (count >= 0)
                        {
                            for (int i = 0; i < count; i++)
                            {
                                Schedule sche = client.CheckSchedule(i);
                                if (sche != null)
                                    schedules.Add(sche);
                            }
                            if (downloadAllFiles(schedules, client))
                            {
                                DisplayController newController = new DisplayController(schedules);
                                String tmppath = Path.Combine(DownloadDir, "Schedule.xml");
                                String schepath = Path.Combine(ScheduleDir, "Schedule.xml");
                                String oldschepath = Path.Combine(ScheduleDir, DateTime.Now.ToString("MMddyy_Hmmss")+"Schedule.old");
                                try
                                {
                                    if (File.Exists(oldschepath))
                                    {
                                        File.Delete(oldschepath);
                                    }
                                    if (File.Exists(tmppath))
                                    {
                                        File.Delete(tmppath);
                                    }
                                    newController.WriteToXML(tmppath);
                                    if (!FileCompare(tmppath, schepath))
                                    {
                                        if (File.Exists(schepath))
                                            File.Move(schepath, oldschepath);
                                        File.Move(tmppath, schepath);
                                        newScheUpdated = true;
                                    }

                                    // better make a lock here

                                }
                                catch (Exception exp)
                                {

                                }
                            }
                        }
                        DateTime time = DateTime.Now;
                        while (DateTime.Now.Subtract(time).TotalMinutes < waittime)
                        {
                            Thread.Sleep(100);
                            if (formClose)
                                return;
                        }
                    }
                    else
                    {
                        Thread.Sleep(10000);
                    }
                }
                catch (Exception exp)
                {
                }
            }
        }