Пример #1
0
        public void Update()
        {
            if (IsConntected)
            {
                string msg = messageService.PopRawMessage();

                if (msg != string.Empty)
                {
                    ADSBMessageBase parsedMessage = messageBuilder.BuildMessage(msg);
                    if (parsedMessage == null)
                    {
                        return;
                    }

                    if (!Planes.ContainsKey(parsedMessage.ICAO))
                    {
                        Planes.Add(parsedMessage.ICAO, new Plane(parsedMessage.ICAO));
                    }

                    //Console.WriteLine(parsedMessage.ToString());


                    Planes[parsedMessage.ICAO].addMessageToPlane(parsedMessage);
                }
            }
        }
Пример #2
0
        void LoadFromXML(DataTemplate planeTemplate)
        {
            XDocument document = DataLoader.LoadXmlFromResources("/Data/FlightMap.xml");

            if (document != null)
            {
                foreach (XElement element in document.Element("Planes").Elements())
                {
                    List <GeoPoint> points = new List <GeoPoint>();
                    foreach (XElement infoElement in element.Element("Path").Elements())
                    {
                        GeoPoint geoPoint = new GeoPoint(Convert.ToDouble(infoElement.Element("Latitude").Value, CultureInfo.InvariantCulture), Convert.ToDouble(infoElement.Element("Longitude").Value, CultureInfo.InvariantCulture));
                        points.Add(geoPoint);
                    }
                    PlaneInfo info = new PlaneInfo(element.Element("PlaneName").Value, element.Element("PlaneID").Value, element.Element("EndPointName").Value, element.Element("StartPointName").Value, Convert.ToInt32(element.Element("Speed").Value), Convert.ToInt32(element.Element("Altitude").Value), points);
                    info.CurrentFlightTime = Convert.ToDouble(element.Element("CurrentFlightTime").Value, CultureInfo.InvariantCulture);
                    planesInfo.Add(info);
                }
            }
            foreach (PlaneInfo info in planesInfo)
            {
                MapCustomElement mapCustomElement = new MapCustomElement()
                {
                    Content = info, ContentTemplate = planeTemplate
                };
                BindingOperations.SetBinding(mapCustomElement, MapCustomElement.LocationProperty, new Binding("Position")
                {
                    Source = info
                });
                Planes.Add(mapCustomElement);
                AddPaths(info);
            }
        }
        /// <summary>
        /// Creates a plane at a specified origin.
        /// </summary>
        /// <param name="origin">The origin at which to create the plane.</param>
        /// <param name="principalPlane">Sets the principal plane. Defines which plane is the principal plane of the workspace.</param>
        /// <returns>The created plane.</returns>
        /// <remarks></remarks>
        public PSSurfacePlane CreatePlane(Geometry.Point origin, Planes principalPlane)
        {
            PSSurfacePlane newPlane = new PSSurfacePlane(_powerSHAPE, origin, principalPlane);

            _powerSHAPE.ActiveModel.Surfaces.Add(newPlane);
            return(newPlane);
        }
        private static IFlight GetPlane(SeatStates[] s_state, SeatTypes[] s_type, Planes plane, Cities des, Cities ori, int seatAmount, DateTime DepTime, DateTime ArivTime, decimal cost, int flighBarcode)
        {
            IFlight createdFlight = null;

            switch (plane)
            {
            case Planes.Earth2K:
                createdFlight = new Earth2K();
                break;
                //case PlaneType.MarsBr:
                //    createdDwelling = new MarsBr();
                //    break;
                //case PlaneType.NeptuneAqua:
                //    createdDwelling = new NeptuneAqua();
                //    break;
                //case PlaneType.UrainusLamba:
                //    createdDwelling = new UrainusLamba();
                //    break;
                //case PlaneType.SaturnRhea:
                //    createdDwelling = new SaturnRhea();
                //    break;
            }
            createdFlight.Cost          = cost;
            createdFlight.ArrivalTime   = ArivTime;
            createdFlight.DepartureTime = DepTime;
            return(createdFlight);
        }
Пример #5
0
        public async Task <IActionResult> Edit(int id, [Bind("PlaneID,Model,PlaneNum,Fit4Flight,MaxPassengers,MaxWeight")] Planes planes)
        {
            if (id != planes.PlaneID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(planes);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PlanesExists(planes.PlaneID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(planes));
        }
Пример #6
0
        public void TestPlanesAddGetUpdateDelete()
        {
            //Add-Get-Тест
            int numberOfSeats = 20;

            Planes expectedPlanes = new Planes();

            expectedPlanes.NumberOfSeats = numberOfSeats;

            AccessToPlanes Planes = new AccessToPlanes();

            Planes.AddElement(expectedPlanes);
            var actualPlanes = Planes.GetAll().Last();

            Assert.AreEqual(expectedPlanes, actualPlanes);

            //Update - Тест
            expectedPlanes = actualPlanes;
            expectedPlanes.NumberOfSeats = 30;
            Planes.UpdateElement(expectedPlanes);
            actualPlanes = Planes.GetElement(expectedPlanes.CodePlane);
            Assert.AreEqual(expectedPlanes, actualPlanes);

            //Delete-Тест
            int expectedCount = Planes.GetAll().Count() - 1;

            Planes.DeleteElement(actualPlanes);
            int actualCount = Planes.GetAll().Count();

            Assert.AreEqual(expectedCount, actualCount);
        }
Пример #7
0
        public List <Planes> listarPlanes()
        {
            List <Planes> listaPlanes = new List <Planes>();

            SqlCommand cmd = new SqlCommand("usp_planes_listar", conexion);

            cmd.CommandType = CommandType.StoredProcedure;

            conexion.Open();

            SqlDataReader data = cmd.ExecuteReader();

            while (data.Read() == true)
            {
                Planes fila = new Planes(Convert.ToInt32(data["IdPlan"]),
                                         Convert.ToInt32(data["CantidadMeses"]),
                                         Convert.ToDecimal(data["Precio"]),
                                         Convert.ToInt32(data["PagosMaximos"])
                                         );
                listaPlanes.Add(fila);
            }

            conexion.Close();
            return(listaPlanes);
        }
Пример #8
0
        protected void CargarPlan()
        {
            Planes plan     = new Planes();
            bool   registar = true;

            foreach (GridViewRow row in gridview.Rows)
            {
                if (row.Cells[2].Text == this.cbldEspecialidad.SelectedItem.Text)
                {
                    registar      = false;
                    msgError.Text = "ya existe esa Especialidad";
                }
            }
            if (registar)
            {
                if (cbldEspecialidad.SelectedItem.Text == "Seleccione una Especialidad")
                {
                    msgError.Text = "Debe seleccionar una Especialidad";
                }
                else
                {
                    plan.Plan            = this.txtDesc_plan.Text;
                    plan.Id_Especialidad = (Convert.ToInt32(cbldEspecialidad.SelectedValue));

                    plan.Estado = BusinessEntity.Estados.Nuevo;
                    Logic.Insertar(plan);
                    this.Limpiar();
                }
            }
        }
        public async Task <IHttpActionResult> ModificarPlan(Planes planParaModificar)
        {
            if (planParaModificar == null || planParaModificar.Consecutivo <= 0 || planParaModificar.Precio < 0 || planParaModificar.CodigoPeriodicidad <= 0 ||
                (planParaModificar.VideosPerfil < 0 || planParaModificar.VideosPerfil > 1) ||
                (planParaModificar.ServiciosChat < 0 | planParaModificar.ServiciosChat > 1) ||
                (planParaModificar.ConsultaCandidatos < 0 || planParaModificar.ConsultaCandidatos > 1) ||
                (planParaModificar.DetalleCandidatos < 0 || planParaModificar.DetalleCandidatos > 1) ||
                (planParaModificar.ConsultaGrupos < 0 || planParaModificar.ConsultaGrupos > 1) ||
                (planParaModificar.DetalleGrupos < 0 || planParaModificar.DetalleGrupos > 1) ||
                (planParaModificar.ConsultaEventos < 0 || planParaModificar.ConsultaEventos > 1) ||
                (planParaModificar.CreacionAnuncios < 0 || planParaModificar.CreacionAnuncios > 1) ||
                (planParaModificar.EstadisticasAnuncios < 0 || planParaModificar.EstadisticasAnuncios > 1) ||
                (planParaModificar.TiempoPermitidoVideo < AppConstants.MinimoSegundos || planParaModificar.TiempoPermitidoVideo > AppConstants.MaximoSegundos) ||
                planParaModificar.NumeroCategoriasPermisibles <= 0 || planParaModificar.TipoPerfil == TipoPerfil.SinTipoPerfil)
            {
                return(BadRequest("planParaModificar vacio y/o invalido!."));
            }
            else if (planParaModificar.TipoPerfil == TipoPerfil.Anunciante && (planParaModificar.NumeroDiasVigenciaAnuncio <= 0 && planParaModificar.NumeroAparicionesAnuncio <= 0))
            {
                return(BadRequest("planParaModificar vacio y/o invalido!."));
            }

            try
            {
                WrapperSimpleTypesDTO wrapperModificarPlan = await _planesBusiness.ModificarPlan(planParaModificar);

                return(Ok(wrapperModificarPlan));
            }
            catch (Exception ex)
            {
                return(InternalServerError(ex));
            }
        }
        public static List <Planes> GetPlanes()
        {
            List <Planes> planes = new List <Planes>();

            try
            {
                validarConexion();
                SqlConn.ConnectionString = ConfigurationManager.ConnectionStrings["SqlCon"].ToString();
                SqlCommand sqlcmd = new SqlCommand("spGetPlanes", SqlConn);
                sqlcmd.CommandType = CommandType.StoredProcedure;
                SqlConn.Open();
                SqlDataAdapter sqlData = new SqlDataAdapter();
                sqlData.SelectCommand = sqlcmd;
                DataSet ds = new DataSet();
                sqlData.Fill(ds);
                planes = new List <Planes>();
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    var plan = new Planes();
                    plan.Id   = Convert.ToInt32(ds.Tables[0].Rows[i]["Id"].ToString());
                    plan.Plan = Convert.ToString(ds.Tables[0].Rows[i]["Plann"].ToString());
                    planes.Add(plan);
                }
                return(planes);
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Пример #11
0
 private void GetCollectionsDataFromDB()
 {
     FlightsViewModel.GetAllCompanies().ForEach(c => Companies.Add(c.name));
     FlightsViewModel.GetAllCities().ForEach(c => Cities.Add(c));
     FlightsViewModel.GetExistingPlanes().ForEach(p => Planes.Add(p));
     FlightsViewModel.GetTrips().ForEach(f => Trips.Add(f));
 }
Пример #12
0
 private void GetAllPlanes()
 {
     foreach (var plane in BL.BL.GetAllPlanes())
     {
         Planes.Add(new PlaneViewModel(plane));
     }
 }
Пример #13
0
        /// <summary>
        /// Draws plane at half the scale.
        /// </summary>
        /// <param name="package"></param>
        /// <param name="plane"></param>
        /// <param name="name"></param>
        private void DrawPlane(ref IRenderPackage package, Plane plane, Planes name)
        {
            package.Description = string.Format("{0}_{1}_{2}", RenderDescriptions.ManipulatorPlane, Name, name);
            using (var vec1 = plane.XAxis.Scale(scale / 3))
                using (var vec2 = plane.YAxis.Scale(scale / 3))
                    using (var vec3 = plane.YAxis.Scale(scale / 3))
                    {
                        using (var p1 = Origin.Add(vec1))
                            using (var p2 = p1.Add(vec2))
                                using (var p3 = Origin.Add(vec3))
                                {
                                    var axis  = plane.Normal;
                                    var color = GetAxisColor(GetAlignedAxis(axis));

                                    package.AddLineStripVertexCount(3);
                                    package.AddLineStripVertexColor(color.R, color.G, color.B, color.A);
                                    package.AddLineStripVertex(p1.X, p1.Y, p1.Z);

                                    package.AddLineStripVertexColor(color.R, color.G, color.B, color.A);
                                    package.AddLineStripVertex(p2.X, p2.Y, p2.Z);

                                    package.AddLineStripVertexColor(color.R, color.G, color.B, color.A);
                                    package.AddLineStripVertex(p3.X, p3.Y, p3.Z);
                                }
                    }
        }
Пример #14
0
        protected void Eliminar()
        {
            Planes plan = new Planes();

            plan.Codigo = Convert.ToInt32(this.txtidplan.Text);
            plan.Estado = BusinessEntity.Estados.Eliminar;
            Logic.Delete(plan);
        }
Пример #15
0
 public void LogPlanes(Planes p)
 {
     if (!IsLogged(p))
     {
         File.AppendAllText(Path, $"{p.New.ID};{p.Old.ID};{p.New.TimeStamp.ToString()}" + Environment.NewLine);
         LoggedPlanes.Add(p);
     }
 }
Пример #16
0
 public void AddPlain(Plane plane)
 {
     if (Planes.Contains(plane))
     {
         throw new ApplicationException("Plane already exist");
     }
     Planes.Add(plane);
 }
Пример #17
0
 private void OnNewPlane(Plane plane)
 {
     guiDispatcher.Invoke(() =>
     {
         Planes.Add(plane);
         RaisePropertyChanged(nameof(Planes));
     });
 }
Пример #18
0
 public void RemovePlain(Plane plane)
 {
     if (!plane.IsFree)
     {
         throw new PlaneInUseException("Samolot jest w użyciu. Zmien trasę która wykorzystuje ten samolot, albo usuń trasę");
     }
     Planes.Remove(plane);
 }
Пример #19
0
        public void AddNewPlane(String producerName, String type, String internationalID, double minimalTrackLength)
        {
            Plane plane = new Plane(producerName, type, internationalID, minimalTrackLength, SystemTime, 0);

            Planes.Add(plane);
            ArrivedPlanes.Add(plane);
            PlaneArrivals.Add("plane " + plane.GetInternationalID() + " arrived " + plane.GetArrivalTime());
        }
Пример #20
0
        // GET: Planes/Create
        public ActionResult Create()
        {
            Planes plan = new Planes();

            plan.FechaInicio = new DateTime(DateTime.Now.Year + 1, 1, 2);
            plan.anio        = DateTime.Now.Year + 1;
            return(View(plan));
        }
Пример #21
0
        public void fill(int planID)
        {
            GYMEntities context = new GYMEntities();

            plan = context.Planes.FirstOrDefault(x => x.PlanID == planID);

            this.planID = plan.PlanID;
        }
        public ActionResult DeleteConfirmed(long id)
        {
            Planes planes = db.Planes.Find(id);

            db.Planes.Remove(planes);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Пример #23
0
        public ActionResult registrarPlan(VmRegistrarPlan vmRegistrarPlan, HttpPostedFileBase file)
        {
            try
            {
                Planes obj = null;
                if (vmRegistrarPlan.planID.HasValue)
                {
                    obj = context.Planes.FirstOrDefault(x => x.PlanID == vmRegistrarPlan.planID);

                    if (file != null && file.ContentLength > 0)
                    {
                        var fileName = Path.GetFileName(file.FileName);
                        var path     = Path.Combine(Server.MapPath("~/Content/img"), fileName);
                        file.SaveAs(path);
                        obj.imagen = fileName;
                    }
                    //else
                    //{

                    //    obj.imagen = "portfolio5.jpg";
                    //}
                }
                else
                {
                    obj = new Planes();
                    context.Planes.Add(obj);

                    if (file != null && file.ContentLength > 0)
                    {
                        var fileName = Path.GetFileName(file.FileName);
                        var path     = Path.Combine(Server.MapPath("~/Content/img"), fileName);
                        file.SaveAs(path);
                        obj.imagen = fileName;
                    }
                    else
                    {
                        obj.imagen = "portfolio5.jpg";
                    }
                }

                obj.Nombre      = vmRegistrarPlan.nombre;
                obj.Descripcion = vmRegistrarPlan.descripcion;
                obj.Costo       = vmRegistrarPlan.costo;

                obj.EstablecimientoID = ((Asociado)Session["objUsuario"]).EstablecimientoID;
                obj.categoriaID       = vmRegistrarPlan.categoria;

                context.SaveChanges();

                return(RedirectToAction("dashboard"));
            }
            catch (Exception)
            {
                vmRegistrarPlan.Fill(context, null);
                TryUpdateModel(vmRegistrarPlan);
                return(View(vmRegistrarPlan));
            }
        }
 /// <summary>
 /// This constructor creates a plane at a specified origin and sets is length and width properties
 /// </summary>
 internal PSSurfacePlane(PSAutomation powershape, Point origin, Planes principalPlane, MM length, MM width) : this(
         powershape,
         origin,
         principalPlane)
 {
     // Alter attributes
     Length = length;
     Width  = width;
 }
Пример #25
0
        private async void FillPlanesCollection()
        {
            var temp = await service.GetEntities();

            foreach (var item in temp)
            {
                Planes.Add(item);
            }
        }
Пример #26
0
 private void OnPlaneDeparted(Plane plane)
 {
     guiDispatcher.Invoke(() =>
     {
         Plane _plane = Planes.FirstOrDefault(p => p.FlightNumber == plane.FlightNumber);
         Planes.Remove(_plane);
         RaisePropertyChanged(nameof(Planes));
     });
 }
Пример #27
0
        private async void Create()
        {
            var created = await airportConnector.PlaneEndpoint.Create(newPlane);

            Planes.Add(created);
            newPlane = new Plane();
            RaisePropertyChanged(() => Planes);
            RaisePropertyChanged(() => NewPlane);
        }
Пример #28
0
        public async Task <Planes> DesasignarPlanDefault(Planes planParaDesasignar)
        {
            Planes planExistente = await _context.Planes.Where(x => x.Consecutivo == planParaDesasignar.Consecutivo).FirstOrDefaultAsync();

            planExistente.Modificacion = DateTime.Now;
            planExistente.PlanDefault  = (int)SiNoEnum.No;

            return(planExistente);
        }
Пример #29
0
        private void ChangePlaneindex(int index, int diff)
        {
            DesignerCanvas dc = ActivPlane;

            Planes.RemoveAt(index);
            Planes.Insert(index + diff, dc);
            ActivPlane = dc;

            RefreshPlaneStates();
        }
 public ActionResult Edit([Bind(Include = "Id,Nombre,Descripción,Costo")] Planes planes)
 {
     if (ModelState.IsValid)
     {
         db.Entry(planes).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(planes));
 }
Пример #31
0
        public Planes GetAll()
        {
            SqlConnection oCnn = this.CreateConnection();
            using (oCnn)
            {
                oCnn.Open();

                SqlCommand oCmd = new SqlCommand();
                using (oCmd)
                {
                    oCmd.Connection = oCnn;

                    oCmd.CommandType = CommandType.StoredProcedure;
                    oCmd.CommandText = "planesGetAll";

                    Planes oPlanes = new Planes();

                    try
                    {
                        SqlDataReader oReader = oCmd.ExecuteReader();
                        using (oCnn)
                        {
                            while (oReader.Read())
                            {
                                Plan oPlan = new Plan();

                                oPlan.ID = Convert.ToInt32(oReader["id_plan"]);
                                oPlan.Descripcion = Convert.ToString(oReader["desc_plan"]);
                                oPlan.IDEspecialidad = Convert.ToInt32(oReader["id_especialidad"]);

                                oPlanes.Add(oPlan);
                                oPlan = null;
                            }
                            return oPlanes;
                        }
                    }
                    catch (Exception Ex)
                    {
                        Exception ExcepcionManejada = new Exception("Error al recuperar lista de planes", Ex);
                        throw ExcepcionManejada;
                    }
                    finally
                    {
                        oPlanes = null;
                    }
                }
            }
        }
Пример #32
0
        /// <summary>
        /// Draws plane at half the scale.
        /// </summary>
        /// <param name="package"></param>
        /// <param name="plane"></param>
        /// <param name="name"></param>
        private void DrawPlane(ref IRenderPackage package, Plane plane, Planes name)
        {
            package.Description = string.Format("{0}_{1}_{2}", RenderDescriptions.ManipulatorPlane, Name, name.ToString()); 
            var p1 = Origin.Add(plane.XAxis.Scale(scale/2));
            var p2 = p1.Add(plane.YAxis.Scale(scale/2));
            var p3 = Origin.Add(plane.YAxis.Scale(scale/2));
            
            package.AddLineStripVertexCount(3);
            package.AddLineStripVertexColor(0, 0, 255, 255);
            package.AddLineStripVertex(p1.X, p1.Y, p1.Z);

            package.AddLineStripVertexColor(0, 0, 255, 255);
            package.AddLineStripVertex(p2.X, p2.Y, p2.Z);

            package.AddLineStripVertexColor(0, 0, 255, 255);
            package.AddLineStripVertex(p3.X, p3.Y, p3.Z);
        }
Пример #33
0
        /// <summary>
        /// Draws plane at half the scale.
        /// </summary>
        /// <param name="package"></param>
        /// <param name="plane"></param>
        /// <param name="name"></param>
        private void DrawPlane(ref IRenderPackage package, Plane plane, Planes name)
        {
            package.Description = string.Format("{0}_{1}_{2}", RenderDescriptions.ManipulatorPlane, Name, name);
            using (var vec1 = plane.XAxis.Scale(scale/3))
            using (var vec2 = plane.YAxis.Scale(scale/3))
            using (var vec3 = plane.YAxis.Scale(scale/3))
            {
                using (var p1 = Origin.Add(vec1))
                using (var p2 = p1.Add(vec2))
                using (var p3 = Origin.Add(vec3))
                {
                    var axis = plane.Normal;
                    var color = GetAxisColor(GetAlignedAxis(axis));

                    package.AddLineStripVertexCount(3);
                    package.AddLineStripVertexColor(color.R, color.G, color.B, color.A);
                    package.AddLineStripVertex(p1.X, p1.Y, p1.Z);

                    package.AddLineStripVertexColor(color.R, color.G, color.B, color.A);
                    package.AddLineStripVertex(p2.X, p2.Y, p2.Z);

                    package.AddLineStripVertexColor(color.R, color.G, color.B, color.A);
                    package.AddLineStripVertex(p3.X, p3.Y, p3.Z);
                    
                }
            }
        }
Пример #34
0
        public Planes GetAllPorEspecialidad(int id)
        {
            SqlConnection oCnn = this.CreateConnection();
            using (oCnn)
            {
                oCnn.Open();

                SqlCommand oCmd = new SqlCommand();
                using (oCmd)
                {
                    oCmd.Connection = oCnn;

                    oCmd.CommandType = CommandType.StoredProcedure;
                    oCmd.CommandText = "planesGetAllPorEspecialidad";

                    oCmd.Parameters.AddWithValue("@id_especialidad", id);

                    //Aunque debemos buscar solo un elemento, siempre devolvemos
                    //una colección. Es más fácil de manipular y controlar
                    Planes oPlanes = new Planes();

                    //No retornamos DataSets, siempre utilizamos objetos para hacernos
                    //independientes de la estructura de las tablas en el resto
                    //de las capas. Para ellos leemos con el DataReader y creamos
                    //los objetos asociados que se esperan
                    try
                    {
                        //Ejecutamos el comando y retornamos los valores
                        SqlDataReader oReader = oCmd.ExecuteReader();
                        using (oReader)
                        {
                            while (oReader.Read())
                            {
                                //si existe algun valor, creamos el objeto y lo almacenamos en la colección
                                Plan oPlan = new Plan();

                                oPlan.ID = Convert.ToInt32(oReader["id_plan"]);
                                oPlan.Descripcion = Convert.ToString(oReader["desc_plan"]);
                                oPlan.IDEspecialidad = Convert.ToInt32(oReader["id_especialidad"]);

                                //Agregamos el objeto a la coleccion de resultados
                                oPlanes.Add(oPlan);

                                oPlan = null;
                            }
                            //retornamos los valores encontrados
                            return oPlanes;
                        }
                    }
                    catch (Exception Ex)
                    {
                        Exception ExcepcionManejada = new Exception("Error al recuperar datos del plan", Ex);
                        throw ExcepcionManejada;
                    }
                    finally
                    {
                        //liberamos la memoria utilizada por los objetos
                        oPlanes = null;
                    }
                }
            }
        }
Пример #35
0
        /*public static Planes[] ShufflePlanes(Planes[] arr)
        {
            List<KeyValuePair<int, Planes>> list = new List<KeyValuePair<int, Planes>>();
            // Add all strings from array
            // Add new random int each time
            foreach (Planes i in arr)
            {
                list.Add(new KeyValuePair<int, Planes>(_random.Next(), i));
            }

            // Sort the list by the random number
            var sorted = from item in list
                        orderby item.Key
                        select item;

            // Allocate new string array
            Planes[] result = new Planes[arr.Length];

            // Copy values to array
            int index = 0;

            foreach (KeyValuePair<int, Planes> pair in sorted)
            {
                result[index] = pair.Value;
                index++;
            }
            // Return copied array
            return result;
        }*/
        public Plane this[Planes plane]
        {
            get
            {
                Plane p = null;

                switch(plane)
                {
                    case  Planes.Prime:
                        p = prime;
                        break;
                    default:
                        foreach(Plane p1 in planes)
                        {
                            if (p1 != null)
                            {
                                if (p1.m_plane == plane)
                                {
                                    p = p1;
                                    break;
                                }
                            }
                        }
                        break;
                }

                return p;
            }
        }
 public ListImage(int height, int width)
 {
     Height = height;
     Width = width;
     _Data = new Planes[Height * Width];
     for (int i = 0; i < _Lenght; i++) _Data[i] = new Planes();
 }
Пример #37
0
 public Plane(Planes plane)
 {
     m_plane = plane;
 }