Exemplo n.º 1
0
        /// <summary>
        /// 取得该机型的所有架次
        /// </summary>
        /// <param name="aircraftModel"></param>
        /// <returns></returns>
        public static Flight[] GetAllFlights(AircraftModel aircraftModel)
        {
            AircraftService.AircraftServiceClient client = GetClient();
            var task = client.GetAllFlightsAsync(RTConverter.ToAircraftService(aircraftModel));
            task.Wait();
            var results = task.Result;
            client.CloseAsync();

            if (results == null || results.Count() <= 0)
                return new Flight[] { };

            var result2 = from one in results
                          select RTConverter.FromAircraftService(one);
            return result2.ToArray();
        }
Exemplo n.º 2
0
        public static int GetEarliestYear(AircraftModel aircraftModel)
        {
            AircraftService.AircraftServiceClient client = GetClient();
            var task = client.GetEarliestYearAsync(RTConverter.ToAircraftService(aircraftModel));
            task.Wait();
            var results = task.Result;
            client.CloseAsync();

            if (results == null)
                return DateTime.Now.Year;


            int year = DateTime.Now.Year;

            if (int.TryParse(results.ToString(), out year))
            {
                return year;
            }

            return year;
        }
Exemplo n.º 3
0
        public static FlightDataEntitiesRT.Decisions.DecisionRecord[] GetFlightConditionDecisionRecords(AircraftModel model,
             DateTime startYearMonth, DateTime endYearMonth, string[] aircraftNumbers)
        {
            AircraftService.AircraftServiceClient client = GetClient();
            ObservableCollection<string> aircrafts = null;
            if (aircraftNumbers != null && aircraftNumbers.Length > 0)
            {
                aircrafts = new ObservableCollection<string>(aircraftNumbers);
            }

            var task = client.GetFlightConditionDecisionRecordsAsync(
                RTConverter.ToAircraftService(model), startYearMonth, endYearMonth, aircrafts);
            task.Wait();
            var results = task.Result;
            client.CloseAsync();

            if (results == null && results.Count <= 0)
                return new FlightDataEntitiesRT.Decisions.DecisionRecord[] { };

            var result = from obj in results
                         select RTConverter.FromAircraftService(obj);

            return result.ToArray();

            //return new FlightDataEntitiesRT.Decisions.DecisionRecord[] { };
        }
Exemplo n.º 4
0
        public static FlightRawDataRelationPoint[] GetFlightRawDataRelationPoints(AircraftModel aircraftModel,
            string FlightID, string XAxisParameterID, string YAxisParameterID)
        {
            AircraftService.AircraftServiceClient client = GetClient();
            var task = client.GetFlightRawDataRelationPointsAsync(
                RTConverter.ToAircraftService(aircraftModel), FlightID, XAxisParameterID, YAxisParameterID);
            task.Wait();
            var results = task.Result;
            client.CloseAsync();

            if (results == null || results.Count() <= 0)
                return new FlightRawDataRelationPoint[] { };

            var result2 = from one in results
                          select RTConverter.FromAircraftService(one);

            return result2.ToArray();
        }
Exemplo n.º 5
0
        public static GlobeData[] GetFlightGlobeDatas(AircraftModel model, string FlightID, int endSecond)
        {
            AircraftService.AircraftServiceClient client = GetClient();
            var task = client.GetGlobeDatasAsync(FlightID, RTConverter.ToAircraftService(model), 0, endSecond);
            task.Wait();
            var results = task.Result;
            client.CloseAsync();

            if (results == null || results.Count() <= 0)
                return new GlobeData[] { };

            var result2 = from one in results
                          orderby one.Index ascending
                          select RTConverter.FromAircraftService(one);

            return result2.ToArray();
        }
Exemplo n.º 6
0
        public static IEnumerable<FlightDataEntitiesRT.AircraftInstance> GetAllAircrafts(AircraftModel aircraftModel)
        {
            AircraftService.AircraftServiceClient client = GetClient();
            Task<ObservableCollection<AircraftService.AircraftInstance>> task
                = client.GetAllAircraftsAsync(RTConverter.ToAircraftService(aircraftModel));

            task.Wait();
            client.CloseAsync();

            var result = from one in task.Result
                         select RTConverter.FromAircraftService(one);

            return result;

            //return new FlightDataEntitiesRT.AircraftInstance[] 
            //{ new FlightDataEntitiesRT.AircraftInstance(){
            //    AircraftModel = ApplicationContext.Instance.CurrentAircraftModel ,
            // AircraftNumber = "09",
            // LastUsed = DateTime.Now},
            //  new FlightDataEntitiesRT.AircraftInstance(){
            //    AircraftModel = ApplicationContext.Instance.CurrentAircraftModel ,
            // AircraftNumber = "17",
            // LastUsed = DateTime.Now},
            //  new FlightDataEntitiesRT.AircraftInstance(){
            //    AircraftModel = ApplicationContext.Instance.CurrentAircraftModel ,
            // AircraftNumber = "10",
            // LastUsed = DateTime.Now},
            //  new FlightDataEntitiesRT.AircraftInstance(){
            //    AircraftModel = ApplicationContext.Instance.CurrentAircraftModel ,
            // AircraftNumber = "12",
            // LastUsed = DateTime.Now},
            //  new FlightDataEntitiesRT.AircraftInstance(){
            //    AircraftModel = ApplicationContext.Instance.CurrentAircraftModel ,
            // AircraftNumber = "65",
            // LastUsed = DateTime.Now},
            //  new FlightDataEntitiesRT.AircraftInstance(){
            //    AircraftModel = ApplicationContext.Instance.CurrentAircraftModel ,
            // AircraftNumber = "78",
            // LastUsed = DateTime.Now},
            //  new FlightDataEntitiesRT.AircraftInstance(){
            //    AircraftModel = ApplicationContext.Instance.CurrentAircraftModel ,
            // AircraftNumber = "79",
            // LastUsed = DateTime.Now},
            //}
            // ;
        }
Exemplo n.º 7
0
        public static Task<FlightRawDataRelationPoint[]> GetFlightRawDataRelationPointsAsync(
            AircraftModel aircraftModel, string FlightID, string XAxisParameterID, string YAxisParameterID)
        {
            AircraftService.AircraftServiceClient client = GetClient();
            var get = client.GetFlightRawDataRelationPointsAsync(
                RTConverter.ToAircraftService(aircraftModel), FlightID, XAxisParameterID, YAxisParameterID);
            return get.ContinueWith<FlightDataEntitiesRT.FlightRawDataRelationPoint[]>(
                 new Func<Task, FlightDataEntitiesRT.FlightRawDataRelationPoint[]>(delegate(Task t)
                 {
                     if (t != null && t is Task<AircraftService.FlightRawDataRelationPoint[]>)
                     {
                         var t2 = (t as Task<ObservableCollection<AircraftService.FlightRawDataRelationPoint>>).Result;
                         var result = from one in t2
                                      select RTConverter.FromAircraftService(one);
                         return result.ToArray();
                     }
                     return new FlightRawDataRelationPoint[] { };
                 }));

            //AircraftService.AircraftServiceClient client = GetClient();
            //var task = client.GetFlightRawDataRelationPointsAsync(RTConverter.ToAircraftService(aircraftModel), FlightID);
            //task.Wait();
            //var results = task.Result;
            //client.CloseAsync();

            //if (results == null || results.Count() <= 0)
            //    return new FlightRawDataRelationPoint[] { };

            //var result2 = from one in results
            //              select RTConverter.FromAircraftService(one);

            //return result2.ToArray();
        }
Exemplo n.º 8
0
        /// <summary>
        /// 取得当前机型的所有判据对象,可以用于“快速判读”里面数据定位
        /// </summary>
        /// <param name="aircraftModel"></param>
        /// <returns></returns>
        public static FlightDataEntitiesRT.Decisions.Decision[] GetDecisions(AircraftModel aircraftModel)
        {
            AircraftService.AircraftServiceClient client = GetClient();
            var task = client.GetAllDecisionsAsync(RTConverter.ToAircraftService(aircraftModel));
            task.Wait();
            client.CloseAsync();
            var decisions = from one in task.Result
                            select RTConverter.FromAircraftService(one);

            var decisionArray = decisions.ToArray();
            List<FlightDataEntitiesRT.Decisions.Decision> tDecs = new List<FlightDataEntitiesRT.Decisions.Decision>();

            foreach (var decision in decisionArray)
            {
                Queue<FlightDataEntitiesRT.Decisions.SubCondition> conds
                    = new Queue<FlightDataEntitiesRT.Decisions.SubCondition>();
                foreach (var sub in decision.Conditions)
                {
                    conds.Enqueue(sub);
                }
                while (conds.Count > 0)
                {
                    var s = conds.Dequeue();
                    s.RootDecision = decision;

                    if (s.SubConditions != null)
                    {
                        foreach (var sub in s.SubConditions)
                        {
                            conds.Enqueue(sub);
                        }
                    }
                }

                tDecs.Add(decision);
            }

            return tDecs.ToArray();
            //return result2.ToArray();
        }
Exemplo n.º 9
0
 public static Task<FlightDataEntitiesRT.FlightParameters> GetFlightParametersAsync(AircraftModel aircraftModel)
 {
     AircraftService.AircraftServiceClient client = GetClient();
     var get = client.GetAllFlightParametersAsync(RTConverter.ToAircraftService(aircraftModel));
     return get.ContinueWith<FlightDataEntitiesRT.FlightParameters>(
          new Func<Task, FlightParameters>(delegate(Task t)
      {
          if (t != null && t is Task<AircraftService.FlightParameters>)
          {
              return RTConverter.FromAircraftService(
                  (t as Task<AircraftService.FlightParameters>).Result);
          }
          return null;
      }));
 }
Exemplo n.º 10
0
 /// <summary>
 /// 取得当前机型的所有参数,可以用于曲线新增、曲线移除或者绑定曲线信息
 /// </summary>
 /// <param name="aircraftModel"></param>
 /// <returns></returns>
 public static FlightDataEntitiesRT.FlightParameters GetFlightParameters(AircraftModel aircraftModel)
 {
     AircraftService.AircraftServiceClient client = GetClient();
     var get = client.GetAllFlightParametersAsync(RTConverter.ToAircraftService(aircraftModel));
     get.Wait();
     client.CloseAsync();
     AircraftService.FlightParameters parameters = get.Result;
     return RTConverter.FromAircraftService(parameters);
 }
Exemplo n.º 11
0
 /// <summary>
 /// 根据机型,取得所有数据面板对象
 /// </summary>
 /// <param name="aircraftModel">当前机型,可以通过AircraftService取得</param>
 /// <returns></returns>
 public static FlightDataEntitiesRT.Charts.ChartPanel[] GetChartPanels(
     AircraftModel aircraftModel)
 {
     AircraftService.AircraftServiceClient client = GetClient();
     var task = client.GetAllChartPanelsAsync(RTConverter.ToAircraftService(aircraftModel));
     task.Wait();
     client.CloseAsync();
     var result = from one in task.Result
                  select RTConverter.FromAircraftService(one);
     return result.ToArray();
 }
Exemplo n.º 12
0
        public static IEnumerable<FlightDataEntitiesRT.AircraftInstance> GetAllAircrafts(AircraftModel aircraftModel)
        {
            //AircraftService.AircraftServiceClient client = GetClient();
            //client.GetAllAircraftsAsync();

            return new FlightDataEntitiesRT.AircraftInstance[] 
            { new FlightDataEntitiesRT.AircraftInstance(){
                AircraftModel = ApplicationContext.Instance.CurrentAircraftModel ,
             AircraftNumber = "0004",
             LastUsed = DateTime.Now}
            }
             ;
        }