Пример #1
0
        public ImageWindow(string src)
            : base(src)
        {
            Decorated = false;
            KeepAbove = true;
            Resize (640, 240);
            Move (100, 100);
            //Opacity = 1.0;

            pixbuf = new Pixbuf (src);

            Gtk.Image image = new Gtk.Image ();
            image.Pixbuf = pixbuf;

            EventBox box = new EventBox ();
            box.Add (image);
            box.ButtonPressEvent += new ButtonPressEventHandler (WindowController.OnButtonDragPress);
            box.ExposeEvent += HandleMyWinExposeEvent;

            Add (box);

            WindowController.HandleMyWinScreenChanged(this, null);
            WindowController.SetWindowShapeFromPixbuf (this, image.Pixbuf);

            DestroyEvent += new DestroyEventHandler (delegate(object o, DestroyEventArgs args) {
                if(cr!=null){
                    ((IDisposable)cr).Dispose();
                }
            });

            ShowAll();
        }
Пример #2
0
        public async Task When_The_Event_Does_Not_Exist_Should_Return_Failure()
        {
            var eventRepository = new Mock <IEventRepository>();

            Maybe <Event> maybeEvent = null;

            eventRepository.Setup(it => it.FindById(It.IsAny <Guid>())).Returns(Task.FromResult(maybeEvent));

            var destroyEvent = new DestroyEvent(Guid.NewGuid());

            var handler = new DestroyEventHandler(eventRepository.Object);

            Result result = await handler.Handle(destroyEvent, CancellationToken.None);

            Assert.True(result.IsFailure);
        }
Пример #3
0
        public async Task Should_Return_Success()
        {
            var eventRepository = new Mock <IEventRepository>();

            Maybe <Event> maybeEvent = new Event(Guid.NewGuid(), "Christmas", new DateTime(year: 2020, month: 6, day: 25));

            var destroyEvent = new DestroyEvent(Guid.NewGuid());

            eventRepository.Setup(it => it.FindById(It.IsAny <Guid>())).Returns(Task.FromResult(maybeEvent));

            var handler = new DestroyEventHandler(eventRepository.Object);

            Result result = await handler.Handle(destroyEvent, CancellationToken.None);

            Assert.True(result.IsSuccess);
        }
Пример #4
0
        public async Task When_The_Event_Is_Not_Removed_Should_Return_Failure()
        {
            var eventRepository = new Mock <IEventRepository>();

            Maybe <Event> maybeEvent = new Event(Guid.NewGuid(), "Christmas", new DateTime(year: 2020, month: 6, day: 25));

            eventRepository.Setup(it => it.FindById(It.IsAny <Guid>())).Returns(Task.FromResult(maybeEvent));

            eventRepository.Setup(it => it.Remove(It.IsAny <Event>())).Returns(Task.FromResult(Result.Failure("Something has gone wrong...")));

            var destroyEvent = new DestroyEvent(Guid.NewGuid());

            var handler = new DestroyEventHandler(eventRepository.Object);

            Result result = await handler.Handle(destroyEvent, CancellationToken.None);

            Assert.True(result.IsFailure);
        }