Пример #1
0
        //Inform является дочерним классом от двух интерфейсов - вызываем функции этих интерфейсов при помощи многоадресного делегата;
        static void More(IFlat flat, IStreet street)
        {
            Multicast all_in_one = flat.Write_Flat;

            all_in_one += street.Write_Street;
            all_in_one();
        }
Пример #2
0
        public RoomEditForm(IFlat flat)
        {
            InitializeComponent();

            theFlat = flat;
            listBoxRoomOrientation.DataSource = System.Enum.GetValues(typeof(Room.RoomOrientation));
            InitializeTrackBarArea();
            labelWindows.Text = trackBarWindows.Value.ToString();
        }
Пример #3
0
 public Cottage(IFlat Floor, bool empty = false)
 {
     this.Floor = Floor;
     this.type_ = HousingType.Cottage;
     if (!empty)
     {
         base.Input();
         this.Input();
     }
 }
Пример #4
0
 public Cottage(IFlat Floor, List <IFlat> Floors) : this(Floor)
 {
     this.Floors = Floors;
     foreach (var item in Floors)
     {
         this.numberofbeds += item.NumberOfBeds;
         this.numberoffloors++;
         this.numberofrooms += item.NumberOfRooms;
     }
 }
Пример #5
0
 public Cottage(string Name, double Price, double Remoteness, IFlat Floor, List <IFlat> Floors) : base(Name, Price, Remoteness)
 {
     this.Floor  = Floor;
     this.type_  = HousingType.Cottage;
     this.Floors = Floors;
     foreach (var item in Floors)
     {
         this.numberofbeds += item.NumberOfBeds;
         this.numberoffloors++;
         this.numberofrooms += item.NumberOfRooms;
     }
 }
Пример #6
0
        protected override void ExecuteFigureInstanceCommand(string[] splitCommand)
        {
            switch (splitCommand[0])
            {
            case "area":
            {
                IAreaMeasurable areaMeasurableFigure = this.currentFigure as IAreaMeasurable;
                if (areaMeasurableFigure != null)
                {
                    Console.WriteLine("{0:0.00}", areaMeasurableFigure.GetArea());
                }
                else
                {
                    Console.WriteLine("undefined");
                }
                break;
            }

            case "volume":
            {
                IVolumeMeasurable volumeMeasurableFigure = this.currentFigure as IVolumeMeasurable;
                if (volumeMeasurableFigure != null)
                {
                    Console.WriteLine("{0:0.00}", volumeMeasurableFigure.GetVolume());
                }
                else
                {
                    Console.WriteLine("undefined");
                }
                break;
            }

            case "normal":
            {
                IFlat flatFigure = this.currentFigure as IFlat;
                if (flatFigure != null)
                {
                    Console.WriteLine(flatFigure.GetNormal().ToString());
                }
                else
                {
                    Console.WriteLine("undefined");
                }
                break;
            }

            default:
            {
                base.ExecuteFigureInstanceCommand(splitCommand);
                break;
            }
            }
        }
Пример #7
0
        protected override void ExecuteFigureInstanceCommand(string[] splitCommand)
        {
            switch (splitCommand[0])
            {
            case "area":
            {
                IAreaMeasurable currentAsAreaMeasurable = this.currentFigure as IAreaMeasurable;
                if (currentAsAreaMeasurable != null)
                {
                    Console.WriteLine("{0:F2}", currentAsAreaMeasurable.GetArea());
                }
                else
                {
                    Console.WriteLine("undefined");
                }
                break;
            }

            case "volume":
            {
                IVolumeMeasurable currentAsVolumeMeasurable = this.currentFigure as IVolumeMeasurable;
                if (currentAsVolumeMeasurable != null)
                {
                    Console.WriteLine("{0:F2}", currentAsVolumeMeasurable.GetVolume());
                }
                else
                {
                    Console.WriteLine("undefined");
                }
                break;
            }

            case "normal":
            {
                IFlat currentAsFlat = this.currentFigure as IFlat;
                if (currentAsFlat != null)
                {
                    Vector3D normal = currentAsFlat.GetNormal();
                    Console.WriteLine("{0:F2}", normal);
                }
                else
                {
                    Console.WriteLine("undefined");
                }
                break;
            }

            default:
                base.ExecuteFigureInstanceCommand(splitCommand);
                break;
            }
        }
Пример #8
0
        void WriteMap(Utf8JsonWriter writer, IFlat key, MichelineArray items)
        {
            writer.WriteStartObject();

            foreach (var item in items)
            {
                if (!(item is MichelinePrim elt) || elt.Prim != PrimType.Elt || elt.Args?.Count != 2)
                {
                    throw new FormatException($"Invalid big_map item {(item as MichelinePrim)?.Prim.ToString() ?? item.Type.ToString()}");
                }

                writer.WritePropertyName(key.Flatten(elt.Args[0]));
                Value.WriteValue(writer, elt.Args[1]);
            }

            writer.WriteEndObject();
        }
Пример #9
0
        // Узнать стоимость квартиры
        private void GetPriceToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string message = "";

            if (dataGridView1.SelectedRows.Count == 1)
            {
                IFlat selectedFlat = dataGridView1.SelectedRows[0].DataBoundItem as IFlat;
                if (selectedFlat != null)
                {
                    message = $"Стоимость квартиры {selectedFlat.GetPrice()} белорусских рублей";
                }
                else
                {
                    message = "Ошибка: квартира не найдена";
                }
            }
            else
            {
                message = "Выделите 1 строку в таблице";
            }

            MessageBox.Show(message);
        }
Пример #10
0
 public RoomEditFormBuilder(IFlat flat)
 {
     currentForm = new RoomEditForm(flat);
     curentFlat  = flat;
 }
Пример #11
0
        protected virtual void ExecuteFigureInstanceCommand(string[] splitCommand)
        {
            switch (splitCommand[0])
            {
            case "translate":
            {
                Vector3D transVector = Vector3D.Parse(splitCommand[1]);
                this.currentFigure.Translate(transVector);
                break;
            }

            case "rotate":
            {
                Vector3D center  = Vector3D.Parse(splitCommand[1]);
                double   degrees = double.Parse(splitCommand[2]);
                this.currentFigure.RotateInXY(center, degrees);
                break;
            }

            case "scale":
            {
                Vector3D center = Vector3D.Parse(splitCommand[1]);
                double   factor = double.Parse(splitCommand[2]);
                this.currentFigure.Scale(center, factor);
                break;
            }

            case "center":
            {
                Vector3D figCenter = this.currentFigure.GetCenter();
                Console.WriteLine(figCenter.ToString());
                break;
            }

            case "measure":
            {
                Console.WriteLine("{0:0.00}", this.currentFigure.GetPrimaryMeasure());
                break;
            }

            // area
            case "area":
            {
                if (this.currentFigure as IAreaMeasurable != null)
                {
                    IAreaMeasurable fig = this.currentFigure as IAreaMeasurable;
                    Console.WriteLine("{0:0.00}", fig.GetArea());
                }
                else
                {
                    Console.WriteLine("undefined");
                }
                break;
            }

            // volume
            case "volume":
            {
                if (this.currentFigure as IVolumeMeasurable != null)
                {
                    IVolumeMeasurable fig = this.currentFigure as IVolumeMeasurable;
                    Console.WriteLine("{0:0.00}", fig.GetVolume());
                }
                else
                {
                    Console.WriteLine("undefined");
                }
                break;
            }

            // normal
            case "normal":
            {
                if (this.currentFigure as IFlat != null)
                {
                    IFlat fig = this.currentFigure as IFlat;
                    Console.WriteLine(fig.GetNormal());
                }
                else
                {
                    Console.WriteLine("undefined");
                }
                break;
            }
            }
        }