Esempio n. 1
0
 private void PrintList(LEWrapper le, Response e)
 {
     planetList = e.result.status.empire.planets;
     // foreach (KeyValuePair<string, string> pair in planetList)
     //     Console.WriteLine("{0}, {1}", pair.Key, pair.Value);
     // Console.ReadKey();
     // SortPlanetList();
 }
Esempio n. 2
0
 public void SeperatePlanetsFromSS(LEWrapper le)
 {
     le.ServerResponseEvent += new LEWrapper.ServerResponseHandler(SeperatePlanetsEventHandler);
     foreach (KeyValuePair <string, string> pair in planetList)
     {
         le.BodyGetBuildings(pair.Key.ToString());
     }
 }
Esempio n. 3
0
        public void SeperatePlanetsEventHandler(LEWrapper le, Response e)
        {
            if (e.id == 401)
            {
                if (e.result.body.surface_image == "surface-station")
                {
                    SSList.Add(e.result.status.body.id.ToString(), e.result.status.body.name);
                    //ssBuildingInfo.Add(e.result
                    //foreach (KeyValuePair<string, Response.Result.Building> v in e.result.buildings)

                    //v.Value.efficiency;
                }
                else
                {
                    HabitablesList.Add(e.result.status.body.id.ToString(), e.result.status.body.name);
                }
            }
        }
Esempio n. 4
0
        //private LEWrapper le;
        static void Main(string[] args)
        {
/*            string userInput;
 *          do
 *          {
 *              Console.Write("Enter EmpireName:");
 *              userInput = Console.ReadLine();
 *              if (string.IsNullOrEmpty(userInput))
 *              { Console.WriteLine("Thanks"); }
 *              else
 *              {
 *                  Console.WriteLine("Input [" + userInput + "]");
 *                  // other code to process user input
 *              }
 *          } while (!string.IsNullOrEmpty(userInput));
 *
 *          Console.ReadKey();
 */
            string UserName = "******";
            string Password = "******";
            string Server   = "us1";

            LEWrapper       le = new LEWrapper("Jazz", "M", "us1");
            PrintPlanetList p  = new PrintPlanetList();

            p.Subscribe(le);
            le.EmpireLogin();
            //Dictionary<string, string> planetList = p.SortPlanetList();
            Dictionary <string, string> planetList = p.planetList;

            foreach (KeyValuePair <string, string> pair in planetList)
            {
                le.BodyGetBuildings(pair.Key.ToString());
            }
            //planetList =
            //le.CloseLog();
            Console.ReadKey();
            //le.CloseLog();
        }
Esempio n. 5
0
        private void loginButton_Click(object sender, EventArgs e)
        {
            labelStatusText.Text = "logging in";
            LoginMenuHide();
            HideBetaWarningLabel();
            le = new LEWrapper(userNameBox.Text, passwordBox.Text, url);
            le.EmpireLogin();
            le.ServerResponseEvent += (rresponseSender, responseE) =>
            {
                Response r;
                r = responseE as Response;
                if (r.id == 101)
                {
                    homePlanetID         = r.result.status.empire.home_planet_id;
                    planets              = r.result.status.empire.planets;
                    planets              = planets.OrderBy(x => x.Value).ToDictionary(x => x.Key, x => x.Value); //alphabetizes planets according to value
                    labelStatusText.Text = "Please wait a few moments. Drawing Planet Map";

                    //Task d = new Task();
                    //await DrawPlanetMap();

                    //var thread = new Thread(()=>DrawPlanetMap());

                    //thread.Start();
                    //thread.Join();
                    DrawPlanetMap();
                    ShowButtonsOnForm();
                    RearrangeControlsShow();
                    //DrawPlanetMap();
                    ShowPlanetSelectMenu();
                    cbPlanetsList.ValueMember   = "Key";
                    cbPlanetsList.DisplayMember = "Value";
                    cbPlanetsList.DataSource    = new BindingSource(planets, null);
                    cbPlanetsList.SelectedValue = homePlanetID;
                }
            };
        }
Esempio n. 6
0
 public void Subscribe(LEWrapper le)
 {
     le.ServerResponseEvent += new LEWrapper.ServerResponseHandler(PrintList);
 }