Esempio n. 1
0
        public ActionResult display(string ip, int port, int interval)
        {
            //display/ip/port/ interval - optional
            System.Net.IPAddress iPAddress;
            if (System.Net.IPAddress.TryParse(ip, out iPAddress))
            {
                runAnimation = false;
                ClientModel client = ClientModel.Instance;
                client.Reset();
                client.Ip   = ip;
                client.Port = port;
                client.Start();
                this.client = client;
                //save info on view bag
                this.client.PropertyChanged += this.Client_PropertyChanged;

                ViewBag.Lon = Double.NaN;
                ViewBag.Lat = Double.NaN;
            }
            else
            {
                string filePath = ip;
                interval                     = port;
                runAnimation                 = true;
                this.flightLogModel          = FlightLogModel.Instance;
                this.flightLogModel.FileName = filePath;
                interval                     = port; //no port
            }
            ViewBag.Interval = (int)((1 / (Double)interval) * 1000);
            return(View());
        }
Esempio n. 2
0
        public ActionResult Index()
        {
            var model = new FlightLogModel();

            model.Aircraft  = hangarData.FindAircraft(Security.UserId);
            model.FlightLog = logData.FindFlightLog(Security.UserId);
            return(View(model));
        }
Esempio n. 3
0
        public ActionResult Index(FlightLogModel model)
        {
            Guid userId = Security.UserId;

            model.CreatedByUserId = userId;
            model.UserId          = userId;
            model.FlightBeginUtc  = model.FlightBeginUtc.ToUtcTime();
            model.FlightEndUtc    = model.FlightEndUtc.ToUtcTime();
            logData.AddFlightLog(model);
            return(Index());
        }
Esempio n. 4
0
        public ActionResult save(string ip, int port, int interval, int samplingTime, string fileName)
        {
            this.flightLogModel          = FlightLogModel.Instance;
            this.flightLogModel.FileName = fileName;
            runAnimation = false;
            //update sampling object
            samplingData = new SamplingData(interval * samplingTime);
            ActionResult actionResult = this.display(ip, port, interval);

            //assign documanting method
            this.client.PropertyChanged += flightLogModel.PropertyChanged;
            //assign counter
            flightLogModel.SamplingCounter += this.CountSamplingRaised;
            return(actionResult);
        }
Esempio n. 5
0
 public string SetValues()
 {
     if (runAnimation)
     {
         //flight animation
         FlightLogModel fl = FlightLogModel.Instance;
         return(fl.GetCurrentFlightDetails());
     }
     else
     {
         //get values from the server
         ClientModel cl  = ClientModel.Instance;
         string      str = cl.GetValues();
         return(str);
     };
 }