Example #1
0
        /// <summary>
        /// constructor
        /// </summary>
        /// <param name="vehicleSelection">vehicle selection view model</param>
        public DataVM(VehicleSelection vehicleSelection)
        {
            Data = new Data();
            Data.ReadData();

            ItemsVM    = new ItemsVM(Data);
            VehiclesVM = new VehiclesVM(Data);
            RoutesVM   = new RoutesVM(this, vehicleSelection);
        }
Example #2
0
 /// <summary>
 /// constructor
 /// </summary>
 public MainWindow()
 {
     InitializeComponent();
     VehicleSelectionVM = menu.VehicleSelectionVM;
     Data = new DataVM(VehicleSelectionVM);
     VehicleSelectionVM.VehicleVMs = Data.VehiclesVM.VehicleVMs;
     VehicleSelectionVM.RoutesVM   = Data.RoutesVM;
     Content.DataContext           = Data.RoutesVM;
 }
Example #3
0
        /// <summary>
        /// constructor
        /// </summary>
        /// <param name="data">data view model</param>
        /// <param name="vehicleSelection">vehicle selection</param>
        public RoutesVM(DataVM data, VehicleSelection vehicleSelection)
        {
            this.data        = data;
            VehicleSelection = vehicleSelection;

            foreach (var route in data.Data.Routes)
            {
                var routeVM = new RouteVM(route, data, vehicleSelection);
                RouteVMs.Add(routeVM);
            }

            RouteVMs.CollectionChanged += RouteVMs_CollectionChanged;
        }
Example #4
0
 public Menu()
 {
     InitializeComponent();
     VehicleSelectionVM = new VehicleSelection();
 }
        public static void doUpload(string file)
        {
            if (file == null)
            {
                return;
            }

            if (!validcred)
            {
                doUserAndPassword();
            }

            string droneshareusername = Settings.Instance["droneshareusername"];

            string dronesharepassword = Settings.Instance["dronesharepassword"];

            if (!string.IsNullOrEmpty(dronesharepassword))
            {
                try
                {
                    // fail on bad entry
                    var crypto = new Crypto();
                    dronesharepassword = crypto.DecryptString(dronesharepassword);
                }
                catch
                {
                }
            }


            String tempguid = null;

            if (!doLogin(droneshareusername, dronesharepassword))
            {
                CustomMessageBox.Show("Bad Credentials", Strings.ERROR);
                return;
            }

            validcred = true;

            if (uuidcached == "")
            {
                UI.VehicleSelection veh = new VehicleSelection(accountuuids);
                veh.ShowDialog();

                tempguid   = veh.uuid;
                uuidcached = veh.uuid;
            }
            else
            {
                tempguid = uuidcached;
            }

            string viewurl = Utilities.DroneApi.droneshare.doUpload(file, droneshareusername, dronesharepassword,
                                                                    tempguid);

            if (viewurl != "")
            {
                try
                {
                    System.Diagnostics.Process.Start(viewurl);
                }
                catch (Exception ex)
                {
                    log.Error(ex);
                    CustomMessageBox.Show("Failed to open url " + viewurl);
                }
            }
        }