Ejemplo n.º 1
0
        public static async Task Start()
        {
            await Task.Run(async() =>
            {
                try
                {
                    var dowd = new MissionPlanner.WebAPIs.Dowding();
                    if (Settings.Instance.ContainsKey("Dowding_username") &&
                        Settings.Instance.ContainsKey("Dowding_password") &&
                        Settings.Instance.ContainsKey("Dowding_server"))
                    {
                        await dowd.Auth(Settings.Instance["Dowding_username"],
                                        new Crypto().DecryptString(Settings.Instance["Dowding_password"]),
                                        Settings.Instance["Dowding_server"]);
                    }
                    else if (Settings.Instance.ContainsKey("Dowding_token") &&
                             Settings.Instance.ContainsKey("Dowding_server"))
                    {
                        dowd.SetToken(Settings.Instance["Dowding_token"], Settings.Instance["Dowding_server"]);
                    }
                    else
                    {
                        CustomMessageBox.Show("Dowding invalid settings");
                    }

                    ws = await dowd.Start(Settings.Instance["Dowding_server"]);
                }
                catch
                {
                    CustomMessageBox.Show("Failed to start Dowding");
                }
            });
        }
        public static void Start()
        {
            Task.Run(() =>
            {
                try
                {
                    var dowd = new MissionPlanner.WebAPIs.Dowding();
                    if (Settings.Instance.ContainsKey("Dowding_username") &&
                        Settings.Instance.ContainsKey("Dowding_password") &&
                        Settings.Instance.ContainsKey("Dowding_server"))
                    {
                        dowd.Auth(Settings.Instance["Dowding_username"], Settings.Instance["Dowding_password"], Settings.Instance["Dowding_server"])
                        .Wait();
                    }
                    else if (Settings.Instance.ContainsKey("Dowding_token") &&
                             Settings.Instance.ContainsKey("Dowding_server"))
                    {
                        dowd.SetToken(Settings.Instance["Dowding_token"], Settings.Instance["Dowding_server"]);
                    }
                    else
                    {
                        CustomMessageBox.Show("Dowding invalid settings");
                    }

                    dowd.Start(Settings.Instance["Dowding_server"]).Wait();
                }
                catch
                {
                    CustomMessageBox.Show("Failed to start Dowding");
                }
            });
        }
Ejemplo n.º 3
0
        private static async void DoIt()
        {
            var dowd = new Dowding();

            dowd.Auth(File.ReadAllLines(@"C:\Users\mich1\dowding.txt")[0],
                      File.ReadAllLines(@"C:\Users\mich1\dowding.txt")[1]).Wait();

            //dowd.SetToken("");

/*
 *          var ws = await dowd.StartWS<VehicleTick>();
 *
 *          var zones = await dowd.GetZone();
 *
 *          var contacts = await dowd.GetContact(minTs: DateTime.UtcNow.AddSeconds(-120).toUnixTime().ToString(), thin: true, limit: 100);
 *
 *          var list = contacts.Select(a =>
 *                  (a.VehicleId, a.VehicleLastLat, a.VehicleLastLon, a.VehicleLastHae, a.VehicleLastTs))
 *              .ToList();
 *
 *          //var agents = await dowd.GetAgents();
 *
 *          //var vehc = await dowd.GetVehicle(contacts.First().Id);
 */
            dowd.Start();

            // Debugger.Break();
        }