Ejemplo n.º 1
0
        public LaundryRoom InitializeLaundryRoom()
        {
            LaundryRoom laundryRoom = new LaundryRoom();
            Washer      washer1     = new Washer(1, "1", "open");
            Washer      washer2     = new Washer(2, "2", "open");
            Washer      washer3     = new Washer(3, "3", "busy");
            Washer      washer4     = new Washer(4, "4", "idle");
            Washer      washer5     = new Washer(5, "5", "open");

            List <Washer> washerList = new List <Washer>();

            washerList.Add(washer1);
            washerList.Add(washer2);
            washerList.Add(washer3);
            washerList.Add(washer4);
            washerList.Add(washer5);

            Dryer dryer1 = new Dryer(1, "1", "open");
            Dryer dryer2 = new Dryer(2, "2", "busy");
            Dryer dryer3 = new Dryer(3, "3", "idle");
            Dryer dryer4 = new Dryer(4, "4", "open");
            Dryer dryer5 = new Dryer(5, "5", "idle");

            List <Dryer> dryerList = new List <Dryer>();

            dryerList.Add(dryer1);
            dryerList.Add(dryer2);
            dryerList.Add(dryer3);
            dryerList.Add(dryer4);
            dryerList.Add(dryer5);

            laundryRoom.washerList = washerList;
            laundryRoom.dryerList  = dryerList;
            return(laundryRoom);
        }
Ejemplo n.º 2
0
        public void InsertOrUpdateWasher(Washer washer)
        {
            var filter = Builders <BsonDocument> .Filter.Eq("_id", washer.Id);

            this.collection.ReplaceOne(filter, washer.ToBsonDocument(), new UpdateOptions {
                IsUpsert = true
            });
        }
Ejemplo n.º 3
0
        private async void DeviceSelector_Loaded(object sender, RoutedEventArgs e)
        {
            var wash = new Washer(devices.First());
            await wash.StartMonitor(30000);

            stack.Children.Add(new Devices.Washer()
            {
                DataContext = wash
            });
        }
Ejemplo n.º 4
0
 public override void OnNewAction(IAction action)
 {
     if (currentStateId == stateMoveToTable)
     {
         End();
     }
     else if (currentStateId == stateMoveToWasher)
     {
         washer = null;
         SwitchState(stateSelectWasher);
     }
 }
Ejemplo n.º 5
0
        public static async void Testing()
        {
            var         washer1 = new Washer();
            MongoHelper mongo   = new MongoHelper();

            await washer1.NextAsync("WasherStart");

            mongo.InsertOrUpdateWasher(washer1);

            await washer1.NextAsync("WasherWait");

            mongo.InsertOrUpdateWasher(washer1);
        }
        public MainWindow()
        {
            InitializeComponent();

            var items = DB.WasherDBs.ToList();

            //inputting washer infomation in washer table
            Washer washer1 = new Washer();


            foreach (var item in items)
            {
                Washer temp = new Washer();
                temp.WasherID     = item.WasherID.ToString();
                temp.Availability = item.Availability_;
                Washers.Items.Add(temp);
            }
        }
Ejemplo n.º 7
0
        static void Main(string[] args)
        {
            Appliance app1 = new Fridge("Washer", "Samsung", 750, "SamsungStore", 150, 180, 75, "White");

            Appliance app2 = new Kettle("Kettle", "Xiaomi", 100, true, 6, "Plastic", "Plastic", "White");

            Appliance app3 = new Tv("TV", "Samsung", 400, 55, "IPS", "4K", 60, true);

            Appliance app4 = new Washer("Washer", "Asus", 40, 7, 1500, 14, 45, 74);

            Basket basket = new Basket();

            basket.Add(app1);
            basket.Add(app2);
            basket.Add(app3);
            basket.Add(app4);
            Console.WriteLine(basket);
            Console.WriteLine(Assistance.CalculateTotalPower(basket));
        }
Ejemplo n.º 8
0
 public void SetWasher(Washer washer)
 {
     this.washer = washer;
 }