Exemple #1
0
        // Sort of registration of factory, because the channel setup is merely a factory containing the data provider instances.
        public void CreateChannel <T1, T2>(IChannelSetup <T1, T2> setup)
            where T1 : TBase1
            where T2 : TBase2
        {
            // Constructing or expanding the channel setup model in such a way while still having type information
            // is a better strategy. Doing it afterwards requires a lot more effort using reflection.
            // - Find endpoints and build configuration using them.
            var t1Endpoint       = Source1.GetEndpoint <T1>();
            var t1Extractor      = Source1.CreateResolver <T1>(); // Because constraint on this, as a whole this can't be moved into Source itself.
            var t1TypeConfig     = new TypeConfiguration <T1, TId>(t1Extractor, Source2.DefaultExtractorValue);
            var t1EndpointConfig = new EndpointConfiguration <T1, TId>(t1TypeConfig, t1Endpoint);

            var t2Endpoint       = Source2.GetEndpoint <T2>();
            var t2Extractor      = Source2.CreateResolver <T2>();
            var t2TypeConfig     = new TypeConfiguration <T2, TId>(t2Extractor, Source2.DefaultExtractorValue);
            var t2EndpointConfig = new EndpointConfiguration <T2, TId>(t2TypeConfig, t2Endpoint);

            var channelConfig = new ChannelConfiguration <T1, T2, TId, ItemMatch <T1, T2> >(t1EndpointConfig, t2EndpointConfig, setup.TypeTranslator);

            var plumber = PlumberFactory.Create(channelConfig, _rules);

            // Could move towards a construction where factories are registered instead of the actual objects for preventing to many channels linguering
            // around in memory. However, right now the channels needs to be singletons and run in sequence due to sqlite limitations of having only one
            // thread writing!
            var channel = setup.Create(channelConfig, plumber);

            _channels.Add(channel);
        }
Exemple #2
0
        private void ListChannelButtonClick(object sender, EventArgs e)
        {
            chSetup = (IChannelSetup)DevicesDictionary[id];
            string[]     listCh = chSetup.ListChannel().Split(new char[] { '№' });
            BulletedList list   = new BulletedList();

            list.ID = "list";
            for (int i = 0; i < listCh.Length; i++)
            {
                list.Items.Add(new ListItem(listCh[i]));
            }
            ph.Controls.Add(list);
        }
Exemple #3
0
        // Инициализатор графики фигуры
        protected void Initializer()
        {
            CssClass = "device-div";
            im       = new Image();

            // Добавление gif анимации в зависимости от девайса
            if (DevicesDictionary[id] is ISetChannel && DevicesDictionary[id] is IChannelSetup)
            {
                chSetup = (IChannelSetup)DevicesDictionary[id];
                if (DevicesDictionary[id].Status == false)
                {
                    im.ImageUrl = "images/offTV.png";
                }
                else if (DevicesDictionary[id].Status && chSetup.СhanState == false)
                {
                    im.ImageUrl = "images/1.gif";
                }
                else if (DevicesDictionary[id].Status && chSetup.СhanState)
                {
                    im.ImageUrl = "images/2.gif";
                }
                Controls.Add(im);
            }
            if (DevicesDictionary[id] is IRateOfOpening)
            {
                im         = new Image();
                statusOpen = ((IRateOfOpening)DevicesDictionary[id]).StatusOpen;
                if (statusOpen && DevicesDictionary[id] is ISetFreezeMode)
                {
                    im.ImageUrl = "images/OpenRef.gif";
                }
                else if (statusOpen == false && DevicesDictionary[id] is ISetFreezeMode)
                {
                    im.ImageUrl = "images/closeRef.gif";
                }
                else if (statusOpen && DevicesDictionary[id] is ITimeOfDayMode)
                {
                    im.ImageUrl = "images/OpenW.gif";
                }
                else if (statusOpen == false && DevicesDictionary[id] is ITimeOfDayMode)
                {
                    im.ImageUrl = "images/CloseW.gif";
                }
                Controls.Add(im);
            }
            if (DevicesDictionary[id] is ITimeOfDayMode)
            {
                im = new Image();
                if (DevicesDictionary[id].Status == false)
                {
                    im.ImageUrl = "images/down.gif";
                }
                else if (DevicesDictionary[id].Status)
                {
                    im.ImageUrl = "images/up.gif";
                }
                Controls.Add(im);
            }
            if (DevicesDictionary[id] is IEnterLevel)
            {
                if (DevicesDictionary[id].Status == false)
                {
                    im.ImageUrl = "images/wateringOff300.png";
                }
                else if (DevicesDictionary[id].Status)
                {
                    im.ImageUrl = "images/244x300_2watering.gif";
                }
                Controls.Add(im);
            }

            //Добавление остальных элементов графики
            status          = new Label();
            status.ID       = status + id.ToString();
            status.Text     = "<br>" + "Устройство: " + DevicesDictionary[id].Name + "<br>" + DevicesDictionary[id] + "<br>";
            status.CssClass = "device-label";
            Controls.Add(status);

            Controls.Add(Span("<br />"));

            if (DevicesDictionary[id] is ITimeOfDayMode)
            {
                onButton = Button("Поднять", "on ");
            }
            else
            {
                onButton = Button("Включить", "on ");
            }
            onButton.Click += ButtonClick;
            Controls.Add(onButton);

            if (DevicesDictionary[id] is ITimeOfDayMode)
            {
                offButton = Button("Опустить", "off ");
            }
            else
            {
                offButton = Button("Выключить", "off ");
            }
            offButton.Click += ButtonClick;
            Controls.Add(offButton);

            Controls.Add(Span("<br />"));

            if (DevicesDictionary[id] is ISetChannel)
            {
                Button nextChannel = Button("Канал ++", "nCh ");
                nextChannel.Click += ButtonClick;
                Controls.Add(nextChannel);
                Button earlyChannel = Button("Канал --", "eCh ");
                earlyChannel.Click += ButtonClick;
                Controls.Add(earlyChannel);
                Button previousChannel = Button("Канал перед этим", "prevCh ");
                previousChannel.Click += ButtonClick;
                Controls.Add(previousChannel);
                Controls.Add(Span("<br />"));
                Controls.Add(Span("Перейти на канал: "));
                сhanTextBox    = TextBox("");
                сhanTextBox.ID = "сhan" + id;
                Controls.Add(сhanTextBox);
                Button goToChannel = Button("Перейти", "goToCh ");
                goToChannel.Click += GoToChannelButtonClick;
                Controls.Add(goToChannel);
                phErrorChan = PlaceHolder("phErrorChan");
                Controls.Add(phErrorChan);
                Controls.Add(Span("<br />"));
            }

            if (DevicesDictionary[id] is ISetVolume)
            {
                Button maxVolume = Button("Звук ++", "maxV ");
                maxVolume.Click += ButtonClick;
                Controls.Add(maxVolume);
                Button minVolume = Button("Звук --", "minV ");
                minVolume.Click += ButtonClick;
                Controls.Add(minVolume);
                Button setMute = Button("Mute", "mute ");
                setMute.Click += ButtonClick;
                Controls.Add(setMute);
                Controls.Add(Span("<br />"));
                Controls.Add(Span("Установить звук: "));
                vTextBox    = TextBox("");
                vTextBox.ID = "v" + id;
                Controls.Add(vTextBox);
                Button setVolume = Button("Установить", "setV ");
                setVolume.Click += SetVolumeButtonClick;
                Controls.Add(setVolume);
                phErrorVol = PlaceHolder("phErrorVol");
                Controls.Add(phErrorVol);
                Controls.Add(Span("<br />"));
            }

            if (DevicesDictionary[id] is IRateOfOpening)
            {
                Button open = Button("Открыть", "open ");
                open.Click += ButtonClick;
                Controls.Add(open);
                Button close = Button("Закрыть", "close ");
                close.Click += ButtonClick;
                Controls.Add(close);
                Controls.Add(Span("<br />"));
            }

            if (DevicesDictionary[id] is ISetFreezeMode)
            {
                Controls.Add(Span("Выберите режим: "));
                freezeMode    = new DropDownList();
                freezeMode.ID = "frMode" + id;
                freezeMode.Items.Add(TemperatureLevel.Default.ToString());////////////////////////
                freezeMode.Items.Add(TemperatureLevel.LowFreeze.ToString());
                freezeMode.Items.Add(TemperatureLevel.ColderFreezing.ToString());
                freezeMode.Items.Add(TemperatureLevel.DeepFreeze.ToString());
                freezeMode.Items.Add(TemperatureLevel.Defrost.ToString());
                if (HttpContext.Current.Session["Freeze"] != null)
                {
                    freezeMode.SelectedIndex = (int)HttpContext.Current.Session["Freeze"];
                }
                Controls.Add(freezeMode);
                Button setFreezeMode = Button("Установить", "setFreeze ");
                setFreezeMode.Click += SetFreezeModeButtonClick;
                Controls.Add(setFreezeMode);
                Controls.Add(Span("<br />"));
            }

            if (DevicesDictionary[id] is ISetTemperature)
            {
                Controls.Add(Span("Введите желаемую температуру в диапазоне 2...15: "));
                tempTextBox    = TextBox("");
                tempTextBox.ID = "temp" + id;
                Controls.Add(tempTextBox);
                Button setTemperature = Button("Установить", "setT ");
                setTemperature.Click += SetTemperatureButtonClick;
                Controls.Add(setTemperature);
                phErrorTemp = PlaceHolder("phErrorTemp");
                Controls.Add(phErrorTemp);
                Controls.Add(Span("<br />"));
            }

            if (DevicesDictionary[id] is ICustomMode)
            {
                Controls.Add(Span("Введите желаемый уровень температуры в диапазоне 30...90: "));
                Controls.Add(Span("<br />"));
                сustomTextBox    = TextBox("");
                сustomTextBox.ID = "custom" + id;
                Controls.Add(сustomTextBox);
                Button setCustomMode = Button("Установить", "setCustom ");
                setCustomMode.Click += SetCustomModeButtonClick;
                Controls.Add(setCustomMode);
                phErrorCustom = PlaceHolder("phErrorCustom");
                Controls.Add(phErrorCustom);
                Controls.Add(Span("<br />"));
            }

            if (DevicesDictionary[id] is ITimeOfDayMode)
            {
                Controls.Add(Span("Выберите режим: "));
                timeOfDayMode    = new DropDownList();
                timeOfDayMode.ID = "timeMode" + id;
                timeOfDayMode.Items.Add(ShuttersMode.MorningMode.ToString());
                timeOfDayMode.Items.Add(ShuttersMode.EveningMode.ToString());
                if (HttpContext.Current.Session["TimeOfDay"] != null)
                {
                    timeOfDayMode.SelectedIndex = (int)HttpContext.Current.Session["TimeOfDay"];
                }
                Controls.Add(timeOfDayMode);
                Button setTimeOfDayMode = Button("Установить", "setTime ");
                setTimeOfDayMode.Click += SetTimeOfDayModeButtonClick;
                Controls.Add(setTimeOfDayMode);
                Controls.Add(Span("<br />"));
            }

            if (DevicesDictionary[id] is IModeHeating)
            {
                Controls.Add(Span("Выберите режим: "));
                modeHeating    = new DropDownList();
                modeHeating.ID = "h" + id;
                modeHeating.Items.Add(BoilerMode.MaxMode.ToString());
                modeHeating.Items.Add(BoilerMode.MinMode.ToString());
                if (HttpContext.Current.Session["Heating"] != null)
                {
                    modeHeating.SelectedIndex = (int)HttpContext.Current.Session["Heating"];
                }
                Controls.Add(modeHeating);
                Button setModeHeating = Button("Установить", "setH ");
                setModeHeating.Click += SetModeHeatingButtonClick;
                Controls.Add(setModeHeating);
                Controls.Add(Span("<br />"));
            }

            if (DevicesDictionary[id] is IEnterLevel)
            {
                Controls.Add(Span("Введите уровень влажности почвы: "));
                if (HttpContext.Current.Session["level"] != null)
                {
                    levelTextBox = TextBox(HttpContext.Current.Session["level"].ToString());
                }
                else
                {
                    levelTextBox = TextBox("");
                }
                levelTextBox.ID = "l" + id;
                Controls.Add(levelTextBox);
                Button enterLevel = Button("Ввести", "setLevel ");
                enterLevel.Click += EnterLevelButtonClick;
                Controls.Add(enterLevel);
                phErrorLevel = PlaceHolder("phErrorLevel");
                Controls.Add(phErrorLevel);
                Controls.Add(Span("<br />"));
            }

            if (DevicesDictionary[id] is IChannelSetup)
            {
                Button сhannelScan = Button("Настроить", "scan ");
                сhannelScan.Click += ButtonClick;
                Controls.Add(сhannelScan);
                Button listChannel = Button("Список", "setT ");
                listChannel.Click += ListChannelButtonClick;
                Controls.Add(listChannel);
                Controls.Add(Span("<br />"));
                ph = PlaceHolder("PlaceHolder");
                Controls.Add(ph);
            }

            Controls.Add(Span("<br />"));

            Button deleteButton = Button("Удалить", "d ");

            deleteButton.Click   += DeleteButtonClick;
            deleteButton.CssClass = "Del";
            Controls.Add(deleteButton);
        }
Exemple #4
0
        ///////////////////////////Обработчики событий
        private void ButtonClick(object sender, EventArgs e)
        {
            Button button = (Button)sender;

            string[] mass = button.ID.Split(new char[] { ' ' });
            if (DevicesDictionary[id] is ISetChannel)
            {
                ch = (ISetChannel)DevicesDictionary[id];
            }
            if (DevicesDictionary[id] is ISetVolume)
            {
                v = (ISetVolume)DevicesDictionary[id];
            }
            if (DevicesDictionary[id] is IRateOfOpening)
            {
                r = (IRateOfOpening)DevicesDictionary[id];
            }

            switch (mass[0])
            {
            case "on":
                DevicesDictionary[id].On();
                break;

            case "off":
                DevicesDictionary[id].Off();
                break;

            case "nCh":
                ch.NextChannel();
                break;

            case "eCh":
                ch.EarlyChannel();
                break;

            case "prevCh":
                ch.PreviousChannel();
                break;

            case "maxV":
                v.MaxVolume();
                break;

            case "minV":
                v.MinVolume();
                break;

            case "mute":
                v.SetMute();
                break;

            case "open":
                r.Open();
                break;

            case "close":
                r.Close();
                break;

            case "scan":
                chSetup = (IChannelSetup)DevicesDictionary[id];
                chSetup.ChannelScan();
                break;
            }
            Controls.Clear();
            Initializer();
        }
Exemple #5
0
        public void Show()
        {
            CO = new CreateObject();

            DevicesDictionary.Add("TV1", CO.CreateTv());
            DevicesDictionary.Add("Ref1", CO.CreateRef());
            DevicesDictionary.Add("Shut1", CO.CreateShut());
            DevicesDictionary.Add("Boiler1", CO.CreateBoiler());
            DevicesDictionary.Add("WS1", CO.CreateWs());

            while (true)
            {
                Console.Clear();
                foreach (var dev in DevicesDictionary)
                {
                    Console.WriteLine("Название: " + dev.Key + ", " + dev.Value.ToString());
                }
                Console.WriteLine();
                Console.Write("Введите команду: ");

                string[] commands = Console.ReadLine().Split(' ');
                if (commands[0].ToLower() == "exit" & commands.Length == 3)
                {
                    return;
                }
                if (commands.Length != 3)
                {
                    Help();
                    continue;
                }
                if (commands[0].ToLower() == "add" && !DevicesDictionary.ContainsKey(commands[2]))
                {
                    if (commands[1] == "TV")
                    {
                        DevicesDictionary.Add(commands[2], CO.CreateTv());
                        continue;
                    }
                    if (commands[1] == "ref")
                    {
                        DevicesDictionary.Add(commands[2], CO.CreateRef());
                        continue;
                    }
                    if (commands[1] == "shut")
                    {
                        DevicesDictionary.Add(commands[2], CO.CreateShut());
                        continue;
                    }
                    if (commands[1] == "boiler")
                    {
                        DevicesDictionary.Add(commands[2], CO.CreateBoiler());
                        continue;
                    }
                    if (commands[1] == "WS")
                    {
                        DevicesDictionary.Add(commands[2], CO.CreateWs());
                        continue;
                    }
                }

                if (commands[0].ToLower() == "add" && DevicesDictionary.ContainsKey(commands[2]))
                {
                    Console.WriteLine("Устройство с таким именем уже существует");
                    Console.WriteLine("Нажмите любую клавишу для продолжения");
                    Console.ReadLine();
                    continue;
                }

                if (commands[0].ToLower() == "del" && !DevicesDictionary.ContainsKey(commands[2]))
                {
                    Console.WriteLine("Выполнение команды невозможно, т.к. устройство с таким именем не существует");
                    Console.WriteLine("Нажмите любую клавишу для продолжения");
                    Console.ReadLine();
                    continue;
                }

                if (!DevicesDictionary.ContainsKey(commands[2]))
                {
                    Help();
                    continue;
                }

                if (commands[0].ToLower() == "del" && DevicesDictionary.ContainsKey(commands[2]))
                {
                    DevicesDictionary.Remove(commands[2]);
                    continue;
                }

                switch (commands[0].ToLower())
                {
                case "on":
                    DevicesDictionary[commands[2]].On();
                    break;

                case "off":
                    DevicesDictionary[commands[2]].Off();
                    break;
                }

                if (DevicesDictionary[commands[2]] is IChannelSetup)
                {
                    IChannelSetup t = (IChannelSetup)DevicesDictionary[commands[2]];
                    switch (commands[0].ToLower())
                    {
                    case "scan":
                        Console.Clear();
                        Console.WriteLine(t.ChannelScan());
                        Console.ReadKey();
                        break;

                    case "list_chan":
                        Console.WriteLine(t.ListChannel());
                        Console.ReadKey();
                        break;
                    }
                }

                if (DevicesDictionary[commands[2]] is ISetChannel)
                {
                    ISetChannel ch = (ISetChannel)DevicesDictionary[commands[2]];
                    switch (commands[0].ToLower())
                    {
                    case "next":
                        ch.NextChannel();
                        break;

                    case "early":
                        ch.EarlyChannel();
                        break;

                    case "go_to":
                        Console.WriteLine("Введите номер канала: ");
                        Input = Console.ReadLine();
                        if (Int32.TryParse(Input, out temp))
                        {
                            if (temp < 0 || temp > ch.MAXchannel)
                            {
                                Console.WriteLine("Ошибка. Такого канала не существует!");
                                Console.ReadKey();
                            }
                            else
                            {
                                ch.GoToChannel(temp);
                            }
                        }
                        else
                        {
                            Console.WriteLine("Ошибка! Некорректный ввод номера канала.");
                            Console.ReadKey();
                        }
                        break;

                    case "prev_chan":
                        ch.PreviousChannel();
                        break;
                    }
                }

                if (DevicesDictionary[commands[2]] is ISetVolume)
                {
                    ISetVolume v = (ISetVolume)DevicesDictionary[commands[2]];
                    switch (commands[0].ToLower())
                    {
                    case "mute":
                        v.SetMute();
                        break;

                    case "max_vol":
                        v.MaxVolume();
                        break;

                    case "min_vol":
                        v.MinVolume();
                        break;

                    case "set_vol":
                        Console.WriteLine("Введите уровень громкости в пределах 0...100: ");
                        Input = Console.ReadLine();
                        if (Int32.TryParse(Input, out temp))
                        {
                            if (temp < 0 || temp > 100)
                            {
                                Console.WriteLine("Ошибка! Недопустимое значение громкости.");
                                Console.ReadKey();
                            }
                            else
                            {
                                v.SetVolume(temp);
                            }
                        }
                        else
                        {
                            Console.WriteLine("Ошибка! Некорректный ввод громкости.");
                            Console.ReadKey();
                        }
                        break;
                    }
                }

                if (DevicesDictionary[commands[2]] is IRateOfOpening)
                {
                    IRateOfOpening r = (IRateOfOpening)DevicesDictionary[commands[2]];
                    switch (commands[0].ToLower())
                    {
                    case "open":
                        r.Open();
                        break;

                    case "close":
                        r.Close();
                        break;
                    }
                }

                if (DevicesDictionary[commands[2]] is ISetFreezeMode)
                {
                    ISetFreezeMode r = (ISetFreezeMode)DevicesDictionary[commands[2]];
                    switch (commands[0].ToLower())
                    {
                    case "low":
                        r.SetLowFreeze();
                        break;

                    case "colder":
                        r.SetColderFreezing();
                        break;

                    case "deep":
                        r.SetDeepFreeze();
                        break;

                    case "defrost":
                        r.SetDefrost();
                        break;
                    }
                }

                if (DevicesDictionary[commands[2]] is ISetTemperature)
                {
                    ISetTemperature r = (ISetTemperature)DevicesDictionary[commands[2]];
                    switch (commands[0].ToLower())
                    {
                    case "level_t":
                        Console.WriteLine("Введите желаемую температуру в диапазоне 2...15: ");
                        Input = Console.ReadLine();
                        if (Double.TryParse(Input, out t))
                        {
                            if (t < 2 || t > 15)
                            {
                                Console.WriteLine("Ошибка! Недопустимое значение температуры.");
                                Console.ReadKey();
                            }
                            else
                            {
                                r.SetLevelTemperature(t);
                            }
                        }
                        else
                        {
                            Console.WriteLine("Ошибка! Некорректный ввод температуры.");
                            Console.ReadKey();
                        }
                        break;
                    }
                }

                if (DevicesDictionary[commands[2]] is ICustomMode)
                {
                    ICustomMode w = (ICustomMode)DevicesDictionary[commands[2]];
                    switch (commands[0].ToLower())
                    {
                    case "custom":
                        Console.WriteLine("Введите желаемый уровень температуры в диапазоне 30...90: ");
                        Input = Console.ReadLine();
                        if (Double.TryParse(Input, out t))
                        {
                            if (t < 30 || t > 90)
                            {
                                Console.WriteLine("Ошибка! Недопустимое значение температуры.");
                                Console.ReadKey();
                            }
                            else
                            {
                                w.SetCustomMode(t);
                            }
                        }
                        else
                        {
                            Console.WriteLine("Ошибка! Некорректный ввод температуры.");
                            Console.ReadKey();
                        }
                        break;
                    }
                }

                if (DevicesDictionary[commands[2]] is ITimeOfDayMode)
                {
                    ITimeOfDayMode w = (ITimeOfDayMode)DevicesDictionary[commands[2]];
                    switch (commands[0].ToLower())
                    {
                    case "morning":
                        w.SetMorningMode();
                        break;

                    case "evening":
                        w.SetEveningMode();
                        break;
                    }
                }

                if (DevicesDictionary[commands[2]] is IModeHeating)
                {
                    IModeHeating b = (IModeHeating)DevicesDictionary[commands[2]];
                    switch (commands[0].ToLower())
                    {
                    case "min_mode":
                        b.SetMinMode();
                        break;

                    case "max_mode":
                        b.SetMaxMode();
                        break;
                    }
                }

                if (DevicesDictionary[commands[2]] is IEnterLevel)
                {
                    IEnterLevel e = (IEnterLevel)DevicesDictionary[commands[2]];
                    switch (commands[0].ToLower())
                    {
                    case "ent_l":
                        Console.WriteLine("Введите уровень влажности почвы: ");
                        Input = Console.ReadLine();
                        if (Int32.TryParse(Input, out temp))
                        {
                            if (temp < 0 || temp > 100)
                            {
                                Console.WriteLine("Ошибка! Недопустимое значение уровня влажности почвы.");
                                Console.ReadKey();
                            }
                            else
                            {
                                e.EnterLevel(temp);
                            }
                        }
                        else
                        {
                            Console.WriteLine("Ошибка! Некорректный ввод уровня влажности почвы.");
                            Console.ReadKey();
                        }
                        break;
                    }
                }
            }
        }
        public ActionResult Operation(int id, string command)
        {
            IDictionary <int, Device> devicesDictionary = (SortedDictionary <int, Device>)Session["Devices"];

            if (devicesDictionary[id] is ISetChannel)
            {
                ch = (ISetChannel)devicesDictionary[id];
            }
            if (devicesDictionary[id] is ISetVolume)
            {
                v = (ISetVolume)devicesDictionary[id];
            }
            if (devicesDictionary[id] is IRateOfOpening)
            {
                r = (IRateOfOpening)devicesDictionary[id];
            }
            if (devicesDictionary[id] is IChannelSetup)
            {
                s = (IChannelSetup)devicesDictionary[id];
            }

            switch (command)
            {
            case "on":
                devicesDictionary[id].On();
                break;

            case "off":
                devicesDictionary[id].Off();
                break;

            case "nCh":
                ch.NextChannel();
                break;

            case "eCh":
                ch.EarlyChannel();
                break;

            case "prevCh":
                ch.PreviousChannel();
                break;

            case "maxV":
                v.MaxVolume();
                break;

            case "minV":
                v.MinVolume();
                break;

            case "mute":
                v.SetMute();
                break;

            case "open":
                r.Open();
                break;

            case "close":
                r.Close();
                break;

            case "scan":
                s.ChannelScan();
                break;

            case "listChan":
                string   str  = s.ListChannel().Replace("Список каналов:", " ");
                string[] mass = str.Split('№');
                TempData["Mass"] = mass;
                return(RedirectToAction("List", "ListTV"));
            }

            Session["Devices"] = devicesDictionary;
            return(RedirectToAction("Index"));
        }