예제 #1
0
        public void Collection()
        {
            Tv tv = new Tv();
            tv.name = "France 2";
            Presenter presNok = new Presenter();
            presNok.name = null;
            Presenter presOk = new Presenter();
            presOk.name = "Thierry Ardisson";
            tv.presenters.Add(presOk);
            tv.presenters.Add(presNok);
            IClassValidator validator = GetClassValidator(typeof(Tv));

            var values = validator.GetInvalidValues(tv).ToArray();
            values.Should().Not.Be.Empty();
            values.Single().PropertyPath.Should().Be.EqualTo("presenters[1].name");
            tv.presenters.Clear();

            tv.dontNeedDeepValidation = new List<string>();
            tv.dontNeedDeepValidation.Add("something");
            values = validator.GetInvalidValues(tv).ToArray();
            values.Should().Be.Empty();
            tv.dontNeedDeepValidation.Add("something else");
            values = validator.GetInvalidValues(tv).ToArray();
            values.Should().Not.Be.Empty();
            values.Single().PropertyPath.Should().Be.EqualTo("dontNeedDeepValidation");
        }
예제 #2
0
        public void Dictionary()
        {
            IClassValidator validator = GetClassValidator(typeof(Tv));

            Tv tv = new Tv();
            tv.name = "France 2";
            Show showOk = new Show();
            showOk.name = "Tout le monde en parle";
            Show showNok = new Show();
            showNok.name = null;
            tv.shows.Add("Midnight", showOk);
            tv.shows.Add("Primetime", showNok);
            tv.shows.Add("Nothing", null);
            var values = validator.GetInvalidValues(tv).ToArray();
            values.Should().Not.Be.Empty();
            values.Single().PropertyPath.Should().Be.EqualTo("shows[Primetime].name");

            //Inverted dictionary
            tv = new Tv();
            tv.name = "France 2";
            tv.validatableInKey = new Dictionary<Simple, string>();
            tv.validatableInKey.Add(new Simple("Exalibur"), "Coll1");
            tv.validatableInKey.Add(new Simple(), "Coll2");
            values = validator.GetInvalidValues(tv).ToArray();
            values.Should().Not.Be.Empty();
            values.Single().PropertyPath.Should().Be.EqualTo("validatableInKey[null].name");
        }
        public void Collection()
        {
            Tv tv = new Tv();
            tv.name = "France 2";
            Presenter presNok = new Presenter();
            presNok.name = null;
            Presenter presOk = new Presenter();
            presOk.name = "Thierry Ardisson";
            tv.presenters.Add(presOk);
            tv.presenters.Add(presNok);
            IClassValidator validator = GetClassValidator(typeof(Tv));

            InvalidValue[] values = validator.GetInvalidValues(tv);
            Assert.AreEqual(1, values.Length);
            Assert.AreEqual("presenters[1].name", values[0].PropertyPath);
            tv.presenters.Clear();

            tv.dontNeedDeepValidation = new List<string>();
            tv.dontNeedDeepValidation.Add("something");
            values = validator.GetInvalidValues(tv);
            Assert.AreEqual(0, values.Length);
            tv.dontNeedDeepValidation.Add("something else");
            values = validator.GetInvalidValues(tv);
            Assert.AreEqual(1, values.Length);
            Assert.AreEqual("dontNeedDeepValidation", values[0].PropertyPath);
        }
        public void Dictionary()
        {
            IClassValidator validator = GetClassValidator(typeof(Tv));

            Tv tv = new Tv();
            tv.name = "France 2";
            Show showOk = new Show();
            showOk.name = "Tout le monde en parle";
            Show showNok = new Show();
            showNok.name = null;
            tv.shows.Add("Midnight", showOk);
            tv.shows.Add("Primetime", showNok);
            tv.shows.Add("Nothing", null);
            InvalidValue[] values = validator.GetInvalidValues(tv);
            Assert.AreEqual(1, values.Length);
            Assert.AreEqual("shows[Primetime].name", values[0].PropertyPath);

            //Inverted dictionary
            tv = new Tv();
            tv.name = "France 2";
            tv.validatableInKey = new Dictionary<Simple, string>();
            tv.validatableInKey.Add(new Simple("Exalibur"), "Coll1");
            tv.validatableInKey.Add(new Simple(), "Coll2");
            values = validator.GetInvalidValues(tv);
            Assert.AreEqual(1, values.Length);
            Assert.AreEqual("validatableInKey[null].name", values[0].PropertyPath);
        }
 static void Main(string[] args)
 {
     Tv t = new Tv();
     t.log();
     Tv tv = new Tv("Samsung");
     tv.log();
     Tv mynewtv = new Tv("DC","Sony");
     mynewtv.log();
 }
예제 #6
0
 public void Array()
 {
     Tv tv = new Tv();
     tv.name = "France 2";
     Movie movieOk = new Movie();
     movieOk.Name = "Kill Bill";
     Movie movieNok = new Movie();
     movieNok.Name = null;
     tv.movies = new Movie[] {movieOk, null, movieNok};
     IClassValidator validator = GetClassValidator(typeof(Tv));
     var values = validator.GetInvalidValues(tv).ToArray();
     values.Should().Not.Be.Empty();
     values.Single().PropertyPath.Should().Be.EqualTo("movies[2].Name");
 }
 public void Array()
 {
     Tv tv = new Tv();
     tv.name = "France 2";
     Movie movieOk = new Movie();
     movieOk.Name = "Kill Bill";
     Movie movieNok = new Movie();
     movieNok.Name = null;
     tv.movies = new Movie[] {movieOk, null, movieNok};
     IClassValidator validator = GetClassValidator(typeof(Tv));
     InvalidValue[] values = validator.GetInvalidValues(tv);
     Assert.AreEqual(1, values.Length);
     Assert.AreEqual("movies[2].Name", values[0].PropertyPath);
 }
        static void Main(string[] args)
        {
            var timer = new Timer();
            var panasonic = new Tv("Panasonic");
            var lg = new Tv("LG");
            var human = new Human("John");

            timer.TimerCounted += panasonic.Subscribed;
            timer.TimerCounted += lg.Subscribed;
            timer.TimerCounted += human.Subscribed;
            timer.Run(1000);

            timer.TimerCounted -= panasonic.Subscribed;
            timer.Run(5000);

            Console.ReadKey();
        }
        protected void btnComment_Click(object sender, EventArgs e)
        {
            if (Session["Id"] == null)
            {
                txtComment.Text = "Yorum Yapmak İçin Üye Olun..";
                return;
            }

            Comment commentModel = new Comment();
            Tv      tvModel      = new Tv();
            User    userModel    = new User();

            userModel.Id       = Convert.ToInt32(Session["Id"]);
            userModel.UserName = Session["UserName"].ToString();
            int tvSeriesId = Convert.ToInt32(Request.QueryString["Id"]);

            tvModel.Id                = tvSeriesId;
            commentModel.Content      = txtComment.Text;
            commentModel.CreationTime = DateTime.Now;
            commentModel.IsActive     = false;
            commentModel.TvId         = tvModel.Id;
            commentModel.UserId       = userModel.Id;
            _commentManager.Add(commentModel);
        }
예제 #10
0
        public Tv GetTv(Flags flagName)
        {
            if (this.Frozen && this._cached_Flag_Values.ContainsKey(flagName))
            {
                return(this._cached_Flag_Values[flagName]);
            }
            lock (this._ctxLock)
            {
                this.UndefGrounding = true; // needed!

                bool popNeeded = false;
                if ((this.BranchInfoStore != null) && (this.BranchInfoStore.Count > 0))
                {
                    this.Solver.Push();
                    this.Solver_U.Push();
                    this.AssertBranchInfoToSolver();
                    popNeeded = true;
                }

                using (BoolExpr flagExpr = this.Create(flagName))
                {
                    Tv result = ToolsZ3.GetTv(flagExpr, flagExpr, this.Solver, this.Solver_U, this._ctx);

                    if (popNeeded)
                    {
                        this.Solver.Pop();
                        this.Solver_U.Pop();
                    }
                    if (this.Frozen)
                    {
                        this._cached_Flag_Values[flagName] = result;
                    }
                    return(result);
                }
            }
        }
예제 #11
0
        public async Task <IActionResult> Index()
        {
            //return View("Index");
            string todaysDate = DateTime.UtcNow.ToString("yyyy-MM-ddTHH:mm:ssZ");

            Tv tv = new Tv();

            IEnumerable <Episode> nextEpisode = await _episodeDatabase.QueryEpisodesAsync($"SELECT Top 1 * FROM c WHERE c.streamDate >= '{todaysDate}' ORDER BY c.streamDate");

            foreach (Episode episode in nextEpisode)
            {
                tv.NextEpisode = episode;
            }

            IEnumerable <Episode> upcomingEpisodes = await _episodeDatabase.QueryEpisodesAsync($"SELECT * FROM c WHERE c.streamDate >= '{todaysDate}' ORDER BY c.streamDate OFFSET 1 LIMIT 10");

            tv.UpcomingEpisodes = upcomingEpisodes;

            IEnumerable <Episode> pastEpisodes = await _episodeDatabase.QueryEpisodesAsync($"SELECT Top 10 * FROM c WHERE c.streamDate <= '{todaysDate}' ORDER BY c.streamDate DESC");

            tv.PastEpisodes = pastEpisodes;

            return(View(tv));
        }
        /// <summary>
        ///     Returns true if RunnerChange instances are equal
        /// </summary>
        /// <param name="other">Instance of RunnerChange to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(RunnerChange other)
        {
            // credit: http://stackoverflow.com/a/10454552/677735
            if (other == null)
            {
                return(false);
            }

            return((Tv == other.Tv || Tv != null && Tv.Equals(other.Tv)) &&
                   (Batb == other.Batb || Batb != null && Batb.SequenceEqual(other.Batb)) &&
                   (Spb == other.Spb || Spb != null && Spb.SequenceEqual(other.Spb)) &&
                   (Bdatl == other.Bdatl || Bdatl != null && Bdatl.SequenceEqual(other.Bdatl)) &&
                   (Trd == other.Trd || Trd != null && Trd.SequenceEqual(other.Trd)) &&
                   (Spf == other.Spf || Spf != null && Spf.Equals(other.Spf)) &&
                   (Ltp == other.Ltp || Ltp != null && Ltp.Equals(other.Ltp)) &&
                   (Atb == other.Atb || Atb != null && Atb.SequenceEqual(other.Atb)) &&
                   (Spl == other.Spl || Spl != null && Spl.SequenceEqual(other.Spl)) &&
                   (Spn == other.Spn || Spn != null && Spn.Equals(other.Spn)) &&
                   (Atl == other.Atl || Atl != null && Atl.SequenceEqual(other.Atl)) &&
                   (Batl == other.Batl || Batl != null && Batl.SequenceEqual(other.Batl)) &&
                   (Id == other.Id || Id != null && Id.Equals(other.Id)) &&
                   (Hc == other.Hc || Hc != null && Hc.Equals(other.Hc)) &&
                   (Bdatb == other.Bdatb || Bdatb != null && Bdatb.SequenceEqual(other.Bdatb)));
        }
예제 #13
0
 public TvOffCommand(Tv tv)
 {
     _tv = tv;
 }
예제 #14
0
 public OffState(Tv tv) : base(tv) => TvUnitTests.OutputHelper.WriteLine("Tv is off.");
예제 #15
0
 public OffCommand(Tv tv)
 {
     _tvOnCommand = new OnCommand(tv);
 }
예제 #16
0
        public static char BitToCharOct(Tv b0, Tv b1, Tv b2)
        {
            if ((b2 == Tv.UNDETERMINED) || (b1 == Tv.UNDETERMINED) || (b0 == Tv.UNDETERMINED))
            {
                return('-');
            }

            if ((b2 == Tv.UNDEFINED) || (b1 == Tv.UNDEFINED) || (b0 == Tv.UNDEFINED))
            {
                return('U');
            }

            if ((b2 == Tv.UNKNOWN) || (b1 == Tv.UNKNOWN) || (b0 == Tv.UNKNOWN))
            {
                return('?');
            }

            if ((b2 == Tv.INCONSISTENT) || (b1 == Tv.INCONSISTENT) || (b0 == Tv.INCONSISTENT))
            {
                return('X');
            }

            if ((b2 == Tv.ZERO) && (b1 == Tv.ZERO) && (b0 == Tv.ZERO))
            {
                return('0');
            }

            if ((b2 == Tv.ZERO) && (b1 == Tv.ZERO) && (b0 == Tv.ONE))
            {
                return('1');
            }

            if ((b2 == Tv.ZERO) && (b1 == Tv.ONE) && (b0 == Tv.ZERO))
            {
                return('2');
            }

            if ((b2 == Tv.ZERO) && (b1 == Tv.ONE) && (b0 == Tv.ONE))
            {
                return('3');
            }

            if ((b2 == Tv.ONE) && (b1 == Tv.ZERO) && (b0 == Tv.ZERO))
            {
                return('4');
            }

            if ((b2 == Tv.ONE) && (b1 == Tv.ZERO) && (b0 == Tv.ONE))
            {
                return('5');
            }

            if ((b2 == Tv.ONE) && (b1 == Tv.ONE) && (b0 == Tv.ZERO))
            {
                return('6');
            }

            if ((b2 == Tv.ONE) && (b1 == Tv.ONE) && (b0 == Tv.ONE))
            {
                return('7');
            }

            // unreachable
            return('Y');
        }
예제 #17
0
 public TvCommand(Tv tv)
 {
     _tv = tv;
 }
예제 #18
0
 public PartialViewResult PartialTv(Tv tv)
 {
     return(PartialView(tv));
 }
예제 #19
0
 public void Add(Tv tv)
 {
     _tvDal.Add(tv);
 }
예제 #20
0
        static void Main(string[] args)
        {
            #region FactoryMethod

            ITransport passengerTransport = new PassengerLogistics().CreateTransport();
            ITransport seaTransport       = new SeaLogistics().CreateTransport();
            ITransport roadTransport      = new RoadLogistics().CreateTransport();
            passengerTransport.Delivery += PrintEvent;
            seaTransport.Delivery       += PrintEvent;
            roadTransport.Delivery      += PrintEvent;
            passengerTransport.Transporting();
            seaTransport.Transporting();
            roadTransport.Transporting();

            #endregion

            #region AbstractFactory

            if (args[0] == "Windows")
            {
                IGuiElement element = new CreatorWinElements();

                GuiMaster master = new GuiMaster(element);
                master.CreateElements();
                master.Paint();
            }

            if (args[0] == "Mac")
            {
                IGuiElement element = new CreatorMacElements();

                GuiMaster master = new GuiMaster(element);
                master.CreateElements();
                master.Paint();
            }
            else
            {
                throw new FormatException(nameof(args));
            }

            #endregion

            #region Builder

            CarBuilder builder  = new CarBuilder();
            Director   director = new Director(builder);
            Car        car      = builder.GetResult();
            Console.WriteLine(director.ToString());
            CarManualBuilder manualBuilder = new CarManualBuilder();
            director = new Director(manualBuilder);
            Manual manual = manualBuilder.GetResult();
            car.Reset();
            Console.WriteLine(director.ToString());
            manual.Reset();

            #endregion

            #region Prototype

            //массив фигур
            Shape[] shapes = new Shape[3];
            //создаем фигуры
            Triangle  triangle  = new Triangle(12.4, 12.4);
            Rectangle rectangle = new Rectangle(5, 10, "Grey", true);
            Circle    circle    = new Circle(256.6, true, "Red");
            //кладём в массив
            shapes.SetValue(triangle, 0);
            shapes.SetValue(circle, 1);
            shapes.SetValue(rectangle, 2);

            //создаем копии
            List <Shape> shapesCopy = new List <Shape>(shapes.Length);
            foreach (Shape shape in shapes)
            {
                shapesCopy.Add(shape.Clone());
            }
            #endregion

            #region Singleton

            DataBase db = DataBase.GetInstance();
            db.Query("SELECT ...");

            #endregion

            #region Adapter
            RoundHole hole = new RoundHole(125.5);
            RoundPeg  peg  = new RoundPeg(175);
            hole.Fits(peg);

            var smallSqpeg = new SquarePage(2);
            var largeSqpeg = new SquarePage(5);
            //hole.Fits(small_sqpeg) // ошибка компиляции, несовместимые типы
            var smallSqpegAdapter = new SquarePegAdapter(smallSqpeg);
            var largeSqpegAdapter = new SquarePegAdapter(largeSqpeg);
            hole.Fits(smallSqpegAdapter);
            hole.Fits(largeSqpegAdapter);

            #endregion

            #region Bridge

            var tv     = new Tv();
            var remote = new AdvancedRemote(tv);
            remote.TooglePower();

            var radio    = new Radio();
            var remoting = new Remote(radio);
            remoting.ChannelDown();
            #endregion

            #region Composite

            var all = new CompoundGraphic();
            all.Add(new Dot(1, 1));
            all.Add(new structure_patterns.Composite.Circle(5, 3, 10.5));

            var group = new CompoundGraphic();
            group.Add(new structure_patterns.Composite.Circle(1, 1, 135.4));
            group.Add(new Dot(15, 15));
            all.Add(group);

            all.Draw();

            #endregion

            #region Decorator

            var source = new FileDataSource("somefile.dat");
            source.WriteData("salaryrecords");
            var decorator = new CompressionDecorator(source);
            source.WriteData("salaryrecords");
            decorator.Compression();

            #endregion

            #region Facade

            var converter  = new VideoConverter();
            var mp4        = converter.Convert("youtubevideo.org", "mp4");
            var fileStream = mp4.OpenRead();
            fileStream.Lock(1, 1);
            #endregion

            #region Cache
            Forest forest = new Forest();
            forest.PlantTree(1, 1, "green", "apple", "textture nature");
            forest.PlantTree(2, 1, "green", "pineapple", "nature");
            forest.Draw(new object());
            #endregion

            #region Proxy

            var service = new ThirdPartyYoutubeClass();
            var proxy   = new CachedYoutubeClass(service);
            var manager = new YoutubeManager(proxy);
            manager.ReactOnUserInput(123);

            #endregion

            #region ChainOfResponsibility

            var dialog = new Dialog("Help Me from Dialog");
            var panel  = new Panel("Help me from Panel");
            var ok     = new Button("Button Ok help text");
            var cancel = new Button("Button canceled help text");
            panel.Add(ok);
            panel.Add(cancel);
            dialog.Add(panel);
            dialog.ShowHelp();
            #endregion
        }
 public Tv PutDecrValue(string setting, Tv tv)
 {
     (tv as ISettings).DecrValue(setting);
     return(tv);
 }
        public string PostGetValue(string setting, Tv tv)
        {
            string str = (tv as ISettings).GetValue(setting);

            return(str);
        }
예제 #23
0
 public SwitchCommand(Tv tv, int channel)
 {
     _tv         = tv;
     _newChannel = channel;
 }
예제 #24
0
파일: State.cs 프로젝트: mypopydev/asm-dude
        public Tv EqualValues(Expr value1, Expr value2)
        {
            //Console.WriteLine("INFO: MemZ3:isEqual: testing whether a=" + a + " is equal to b=" + b);
            const bool method1 = true; // the other method seems not to work

            lock (this._ctxLock)
            {
                Tv eq   = Tv.UNKNOWN;
                Tv uneq = Tv.UNKNOWN;

                this.Solver.Push();
                this.AssertBranchInfoToSolver(false);
                {
                    Status   status;
                    BoolExpr tmp1 = this._ctx.MkEq(value1, value2);
                    if (method1)
                    {
                        this.Solver.Push();

                        this.Solver.Assert(tmp1);
                        status = this.Solver.Check();
                    }
                    else
                    {
                        status = this.Solver.Check(tmp1);
                    }
                    switch (status)
                    {
                    case Status.SATISFIABLE:
                        eq = Tv.ONE;
                        break;

                    case Status.UNSATISFIABLE:
                        eq = Tv.ZERO;
                        break;

                    case Status.UNKNOWN:
                        Console.WriteLine("WARNING: State:equalValue: A: ReasonUnknown = " + this.Solver.ReasonUnknown);
                        break;
                    }
                    if (method1)
                    {
                        this.Solver.Pop();
                    }
                }
                {
                    Status status;
                    //BoolExpr tmp1 = _ctx.MkDistinct(value1, value2);
                    BoolExpr tmp1 = this._ctx.MkNot(this._ctx.MkEq(value1, value2));
                    if (method1)
                    {
                        this.Solver.Assert(tmp1);
                        status = this.Solver.Check();
                    }
                    else
                    {
                        status = this.Solver.Check(tmp1);
                    }
                    switch (status)
                    {
                    case Status.SATISFIABLE:
                        uneq = Tv.ONE;
                        break;

                    case Status.UNSATISFIABLE:
                        uneq = Tv.ZERO;
                        break;

                    case Status.UNKNOWN:
                        Console.WriteLine("WARNING: State:equalValue: B: ReasonUnknown = " + this.Solver.ReasonUnknown);
                        break;
                    }
                }
                this.Solver.Pop(); // get rid of context that had been added

                if ((eq == Tv.ONE) && (uneq == Tv.ONE))
                {
                    return(Tv.UNKNOWN);
                }
                if ((eq == Tv.ONE) && (uneq == Tv.ZERO))
                {
                    return(Tv.ONE);
                }
                if ((eq == Tv.ZERO) && (uneq == Tv.ONE))
                {
                    return(Tv.ZERO);
                }
                if ((eq == Tv.ONE) && (uneq == Tv.ONE))
                {
                    return(Tv.INCONSISTENT);
                }
                return(Tv.UNKNOWN);
            }
        }
        /// <summary>
        ///     Gets the hash code
        /// </summary>
        /// <returns>Hash code</returns>
        public override int GetHashCode()
        {
            // credit: http://stackoverflow.com/a/263416/677735
            unchecked // Overflow is fine, just wrap
            {
                var hash = 41;
                // Suitable nullity checks etc, of course :)

                if (Tv != null)
                {
                    hash = hash * 59 + Tv.GetHashCode();
                }

                if (Batb != null)
                {
                    hash = hash * 59 + Batb.GetHashCode();
                }

                if (Spb != null)
                {
                    hash = hash * 59 + Spb.GetHashCode();
                }

                if (Bdatl != null)
                {
                    hash = hash * 59 + Bdatl.GetHashCode();
                }

                if (Trd != null)
                {
                    hash = hash * 59 + Trd.GetHashCode();
                }

                if (Spf != null)
                {
                    hash = hash * 59 + Spf.GetHashCode();
                }

                if (Ltp != null)
                {
                    hash = hash * 59 + Ltp.GetHashCode();
                }

                if (Atb != null)
                {
                    hash = hash * 59 + Atb.GetHashCode();
                }

                if (Spl != null)
                {
                    hash = hash * 59 + Spl.GetHashCode();
                }

                if (Spn != null)
                {
                    hash = hash * 59 + Spn.GetHashCode();
                }

                if (Atl != null)
                {
                    hash = hash * 59 + Atl.GetHashCode();
                }

                if (Batl != null)
                {
                    hash = hash * 59 + Batl.GetHashCode();
                }

                if (Id != null)
                {
                    hash = hash * 59 + Id.GetHashCode();
                }

                if (Hc != null)
                {
                    hash = hash * 59 + Hc.GetHashCode();
                }

                if (Bdatb != null)
                {
                    hash = hash * 59 + Bdatb.GetHashCode();
                }

                return(hash);
            }
        }
예제 #26
0
 public CacheEntry(Tv value, TimeSpan expire_ttl, long now_sec)
 {
     _expireAt = now_sec + expire_ttl.Ticks / TimeSpan.TicksPerSecond;
     Value     = value;
 }
        public void Prueba_ImprimirTicket()
        {
            Tv tv = new Tv(Electrodomestico.EMarcas.Philips, Electrodomestico.EModelos.ModeloTV1, 30000);

            Assert.IsTrue(Ticketeadora <Tv> .imprimirHistorialVentas(tv, "Ticket_Ventas.log"));
        }
예제 #28
0
파일: App.xaml.cs 프로젝트: Dlizzz/Catspaw
        // Triggered when application starts. Do initialization.
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            // Check if an instance is already runnin by checking a named mutex owned by the first instance
            catspawInstance = new Mutex(true, "CatspawInstance", out bool IsNewInstance);
            if (!IsNewInstance)
            {
#pragma warning disable CA1303 // Ne pas passer de littéraux en paramètres localisés
                _ = MessageBox.Show("Catspaw is already running...", "Catspaw", MessageBoxButton.OK, MessageBoxImage.Information);
#pragma warning restore CA1303 // Ne pas passer de littéraux en paramètres localisés
                Shutdown();
                return;
            }

            // Initialize application logger with log file in local AppData path for non roaming user
            LogInit();

            // Create main window and add timer for closing
            MainWindow            = new MainWindow();
            mainWindowTimer.Tick += (object sender, EventArgs e) =>
            {
                MainWindow.Hide();
                mainWindowTimer.Stop();
            };

            // Create Notify icon with handler for double click and context menu
            NotifyIconInit();

            // Add the power events handler to the system power events queue
            SystemEvents.PowerModeChanged += new PowerModeChangedEventHandler(PowerEventHandler);

            // Initialize Pioneer AVR with Volume Popup
            try
            {
                PioneerAvr = new Avr(Settings.Default.AvrHostname);
                PioneerAvr.InitVolume();
            }
            catch (AvrException err)
            {
                Log.Error(Catspaw.Properties.Resources.ErrorCommunicationAvr, err);
                Log.Information("Oups! Sorry we can't connect to the Audio Video Reciever :-(");
            }
            if (PioneerAvr != null)
            {
                Log.Debug("Adding Pioneer Avr component");
                Log.Information("Cool! We've just added the Pioneer Audio Video Reciever as an HTPC component.");
            }

            //Initialize Samsung TV
            try
            {
                SamsungTv = new Tv();
            }
            catch (CecException err)
            {
                Log.Debug(Catspaw.Properties.Resources.ErrorNoCecController, err);
                Log.Information("Oups! Sorry we can't connect the CeC bus controller :-(");
            }
            if (SamsungTv != null)
            {
                Log.Debug("Adding Pioneer Tv component");
                Log.Information("Even cooler! We've just added the Samsung TV as an HTPC component.");
            }

            // Initialize Api server
            apiServer = new ApiServer();

            // Show main window
            MainWindowShow();
        }
예제 #29
0
 public TvRootItems(Tv p_owner)
 {
     _owner = p_owner;
 }
예제 #30
0
 public void Update(Tv tvModel)
 {
     _tvDal.Update(tvModel);
 }
예제 #31
0
        // Delete
        protected void LinkButtonDelete_Click(object sender, EventArgs e)
        {
            if (selectedDevice != null)
            {
                string device = (selectedDevice as Device).TypeDevice();
                int    id     = (selectedDevice as Device).Id;

                switch (device)
                {
                case "Tv":
                    Tv tv = db.Tvs.Find(id);
                    if (tv != null)
                    {
                        db.Tvs.Remove(tv);
                        db.SaveChanges();
                        PanelDevicesDeleteControl(tv.Id, tv.TypeDevice());
                    }
                    break;

                case "Fridge":
                    Fridge fridge = db.Fridges.Find(id);
                    if (fridge != null)
                    {
                        db.Fridges.Remove(fridge);
                        db.SaveChanges();
                        PanelDevicesDeleteControl(fridge.Id, fridge.TypeDevice());
                    }
                    break;

                case "Lamp":
                    Lamp lamp = db.Lamps.Find(id);
                    if (lamp != null)
                    {
                        db.Lamps.Remove(lamp);
                        db.SaveChanges();
                        PanelDevicesDeleteControl(lamp.Id, lamp.TypeDevice());
                    }
                    break;

                case "Cooker":
                    Cooker cooker = db.Cookers.Find(id);
                    if (cooker != null)
                    {
                        db.Cookers.Remove(cooker);
                        db.SaveChanges();
                        PanelDevicesDeleteControl(cooker.Id, cooker.TypeDevice());
                    }
                    break;

                case "Microwave":
                    Microwave microwave = db.Microwaves.Find(id);
                    if (microwave != null)
                    {
                        db.Microwaves.Remove(microwave);
                        db.SaveChanges();
                        PanelDevicesDeleteControl(microwave.Id, microwave.TypeDevice());
                    }
                    break;

                default:
                    break;
                }
                Session["SelectedDevice"] = null;
                Session["DeviceConsole"]  = null;
                selectedDevice            = null;
                deviceConsole             = null;
                RefreshPage();
            }
        }
예제 #32
0
 public HomeTheatreFacade(Tv tv, Dvd dvd)
 {
     _tv  = tv;
     _dvd = dvd;
 }
예제 #33
0
 void wc_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
 {
     Owner.Controls.Clear();
     TvList.Clear();
     var listStr = AES_Dec_Str(e.Result, @"其实你不用猜我没");
     if (string.IsNullOrEmpty(listStr))
     {
         return;
     }
     var lists = listStr.Split('|');
     foreach (var list in lists)
     {
         var strs = list.Split('@');
         var item = new Tv {Name = strs[0], Url = strs[1]};
         TvList.Add(item);
     }
     if (TvList == null || TvList.Count <= 0)
     {
         MessageBox.Show(@"获取电视列表失败!");
         return;
     }
     var iNav = new Panel
     {
         Dock = DockStyle.Top,
         Size = new Size(1,Navheight),
         BackColor = Color.Transparent,
     };
     var iFly = new EnFlyPanel
     {
         Size = new Size(Owner.Parent.Width-20, Navheight),
         Location = new Point(10, 0),
         BackColor = Color.Transparent,
     };
     foreach (var v in TvList)
     {
         var btn = new EnButton
         {
             Size = new Size(80, Navheight - 6),
             ForeColor = Color.White,
             Text = v.Name,
             Tag = v.Url,
             AutoSize = false,
             Font = new Font("宋体", 12F),
         };
         iFly.Controls.Add(btn);
         btn.Click += btn_Click;
     }
     var iTv = new EnBrowser
     {
         Dock = DockStyle.Fill,
         IsWebBrowserContextMenuEnabled = false,
         ScriptErrorsSuppressed = true,
         ScrollBarsEnabled = false,
     };
     Owner.Controls.Add(iTv);
     iNav.Controls.Add(iFly);
     Owner.Controls.Add(iNav);
     iTv.Navigate(TvList[0].Url);
 }
예제 #34
0
        public static char BitToCharHex(Tv b0, Tv b1, Tv b2, Tv b3)
        {
            if ((b3 == Tv.UNDETERMINED) || (b2 == Tv.UNDETERMINED) || (b1 == Tv.UNDETERMINED) || (b0 == Tv.UNDETERMINED))
            {
                return('-');
            }

            if ((b3 == Tv.UNDEFINED) || (b2 == Tv.UNDEFINED) || (b1 == Tv.UNDEFINED) || (b0 == Tv.UNDEFINED))
            {
                return('U');
            }

            if ((b3 == Tv.UNKNOWN) || (b2 == Tv.UNKNOWN) || (b1 == Tv.UNKNOWN) || (b0 == Tv.UNKNOWN))
            {
                return('?');
            }

            if ((b3 == Tv.INCONSISTENT) || (b2 == Tv.INCONSISTENT) || (b1 == Tv.INCONSISTENT) || (b0 == Tv.INCONSISTENT))
            {
                return('X');
            }

            if ((b3 == Tv.ZERO) && (b2 == Tv.ZERO) && (b1 == Tv.ZERO) && (b0 == Tv.ZERO))
            {
                return('0');
            }

            if ((b3 == Tv.ZERO) && (b2 == Tv.ZERO) && (b1 == Tv.ZERO) && (b0 == Tv.ONE))
            {
                return('1');
            }

            if ((b3 == Tv.ZERO) && (b2 == Tv.ZERO) && (b1 == Tv.ONE) && (b0 == Tv.ZERO))
            {
                return('2');
            }

            if ((b3 == Tv.ZERO) && (b2 == Tv.ZERO) && (b1 == Tv.ONE) && (b0 == Tv.ONE))
            {
                return('3');
            }

            if ((b3 == Tv.ZERO) && (b2 == Tv.ONE) && (b1 == Tv.ZERO) && (b0 == Tv.ZERO))
            {
                return('4');
            }

            if ((b3 == Tv.ZERO) && (b2 == Tv.ONE) && (b1 == Tv.ZERO) && (b0 == Tv.ONE))
            {
                return('5');
            }

            if ((b3 == Tv.ZERO) && (b2 == Tv.ONE) && (b1 == Tv.ONE) && (b0 == Tv.ZERO))
            {
                return('6');
            }

            if ((b3 == Tv.ZERO) && (b2 == Tv.ONE) && (b1 == Tv.ONE) && (b0 == Tv.ONE))
            {
                return('7');
            }

            if ((b3 == Tv.ONE) && (b2 == Tv.ZERO) && (b1 == Tv.ZERO) && (b0 == Tv.ZERO))
            {
                return('8');
            }

            if ((b3 == Tv.ONE) && (b2 == Tv.ZERO) && (b1 == Tv.ZERO) && (b0 == Tv.ONE))
            {
                return('9');
            }

            if ((b3 == Tv.ONE) && (b2 == Tv.ZERO) && (b1 == Tv.ONE) && (b0 == Tv.ZERO))
            {
                return('A');
            }

            if ((b3 == Tv.ONE) && (b2 == Tv.ZERO) && (b1 == Tv.ONE) && (b0 == Tv.ONE))
            {
                return('B');
            }

            if ((b3 == Tv.ONE) && (b2 == Tv.ONE) && (b1 == Tv.ZERO) && (b0 == Tv.ZERO))
            {
                return('C');
            }

            if ((b3 == Tv.ONE) && (b2 == Tv.ONE) && (b1 == Tv.ZERO) && (b0 == Tv.ONE))
            {
                return('D');
            }

            if ((b3 == Tv.ONE) && (b2 == Tv.ONE) && (b1 == Tv.ONE) && (b0 == Tv.ZERO))
            {
                return('E');
            }

            if ((b3 == Tv.ONE) && (b2 == Tv.ONE) && (b1 == Tv.ONE) && (b0 == Tv.ONE))
            {
                return('F');
            }

            // unreachable
            return('Y');
        }
 public override void Excute()
 {
     Tv.ChangeChannel();
 }
예제 #36
0
        void wc_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
        {
            Owner.Controls.Clear();
            TvList.Clear();
            var listStr = AES_Dec_Str(e.Result, @"其实你不用猜我没");

            if (string.IsNullOrEmpty(listStr))
            {
                return;
            }
            var lists = listStr.Split('|');

            foreach (var list in lists)
            {
                var strs = list.Split('@');
                var item = new Tv {
                    Name = strs[0], Url = strs[1]
                };
                TvList.Add(item);
            }
            if (TvList == null || TvList.Count <= 0)
            {
                MessageBox.Show(@"获取电视列表失败!");
                return;
            }
            var iNav = new Panel
            {
                Dock      = DockStyle.Top,
                Size      = new Size(1, Navheight),
                BackColor = Color.Transparent,
            };
            var iFly = new EnFlyPanel
            {
                Size      = new Size(Owner.Parent.Width - 20, Navheight),
                Location  = new Point(10, 0),
                BackColor = Color.Transparent,
            };

            foreach (var v in TvList)
            {
                var btn = new EnButton
                {
                    Size      = new Size(80, Navheight - 6),
                    ForeColor = Color.White,
                    Text      = v.Name,
                    Tag       = v.Url,
                    AutoSize  = false,
                    Font      = new Font("宋体", 12F),
                };
                iFly.Controls.Add(btn);
                btn.Click += btn_Click;
            }
            var iTv = new EnBrowser
            {
                Dock = DockStyle.Fill,
                IsWebBrowserContextMenuEnabled = false,
                ScriptErrorsSuppressed         = true,
                ScrollBarsEnabled = false,
            };

            Owner.Controls.Add(iTv);
            iNav.Controls.Add(iFly);
            Owner.Controls.Add(iNav);
            iTv.Navigate(TvList[0].Url);
        }
예제 #37
0
 public override void Excute()
 {
     Tv.CloseTv();
 }
 public void ModeloException_Prueba_Tv()
 {
     Tv tv = new Tv(Electrodomestico.EMarcas.Philips, Electrodomestico.EModelos.ModeloCafetera1, 30000);
 }
예제 #39
0
 public ActionFactory(Tv tv)
 {
     this.tv = tv;
 }