Пример #1
0
 public override void OnRegister()
 {
     base.OnRegister();
     Preferences = Facade.RetrieveProxy <PreferencesProxy>();
     Facade.RegisterMediator(new AvatarMediator(Preferences.Avatar, Preferences.IsDanish));
     InitializeView();
 }
        public override void OnRegister()
        {
            base.OnRegister();

            var hasSelectedLanguage = Facade.HasProxy <PreferencesProxy>();

            if (!hasSelectedLanguage)
            {
                Facade.RegisterProxy(new PreferencesProxy());
            }
            Preferences = Facade.RetrieveProxy <PreferencesProxy>();
            InitializeView(hasSelectedLanguage);
        }
        public override void HandleNotification(INotification notification)
        {
            switch (notification.Name)
            {
            case PreferencesMediator.Notifications.PreferencesSelected:
                Preferences = Facade.RetrieveProxy <PreferencesProxy>();
                View.Initialize(Preferences.UseVr);
                break;

            case Notifications.PrepareVideo:
                var progress    = (int)notification.Body;
                var languageKey = (Preferences.IsDanish) ? "da" : "en";
                View.Prepare((Preferences.UseVr) ? Urls.VrVideos[languageKey].SafeGet(progress) : Urls.NormalVideos[languageKey].SafeGet(progress));
                break;

            case Notifications.PlayVideo:
                View.PlayVideo();
                break;

            case Notifications.TogglePause:
                var paused = View.TogglePause();
                SendNotification((paused) ? Notifications.VideoPaused : Notifications.VideoResumed);
                break;

            case Notifications.StopVideo:
                View.StopVideo();
                break;

            case Notifications.StartVideoSeek:
                View.StartSeek();
                break;

            case Notifications.VideoSeek:
                View.SeekTo((float)notification.Body);
                break;

            case Notifications.EndVideoSeek:
                View.EndSeek();
                break;
            }
        }