예제 #1
0
        public MainWindow()
        {
            InitializeComponent();
            NotificationIcon.Setup(this);

            var ioc = Nancy.TinyIoc.TinyIoCContainer.Current;

            var successSound = new SoundPlayer(Properties.Resources.sm64_mario_here_we_go);
            var failSound    = new SoundPlayer(Properties.Resources.sm64_mario_falling);

            hub = ioc.Resolve <ITinyMessengerHub>();
            hub.Subscribe <Notification>(notification =>
            {
                var item = itemContainer.Update(notification);

                if (notification.Build.State == State.Finalized)
                {
                    if (notification.Build.Result == Result.Success)
                    {
                        if (item.AlertSuccess)
                        {
                            successSound.Play();
                        }
                    }
                    else
                    {
                        if (item.AlertFailure)
                        {
                            failSound.Play();
                        }
                    }
                }
            },
                                         new DispatcherTinyMessageProxy(Dispatcher));

            itemContainer = new ItemContainer();

            DataContext = new MainWindowModel()
            {
                Items = itemContainer.GetItems()
            };
        }