Example #1
0
        public void Navigate(IPausableControl nextPage)
        {
            Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action <IPausableControl>
                                       ((p) =>
            {
                if (p != null)
                {
                    Debug.WriteLine("Switching to new View " + p.GetType().Name);
                    var page     = p as UserControl;
                    page.Opacity = 0.0;
                    DoubleAnimation animation = new DoubleAnimation
                    {
                        From     = 0.0,
                        To       = 1.0,
                        Duration =
                            new Duration(TimeSpan.FromMilliseconds(400.0)),
                        AutoReverse = false,
                    };


                    //Grid parent = page.Parent as Grid;
                    //if (parent != null)
                    //{
                    //    parent.Children.Remove(page);
                    //}

                    MediaGrid.Children.Remove(page);

                    p.UnPause();
                    this.MediaGrid.Children.Add(page);
                    page.BeginAnimation(UIElement.OpacityProperty, animation);
                }

                if (Switcher.LastPage != null && Switcher.LastPage != p)
                {
                    Debug.WriteLine("Removing LastPAge Added" + Switcher.LastPage.GetType().Name);
                    Charging lastPage = Switcher.LastPage as Charging;
                    if (lastPage != null)
                    {
                        lastPage.LocationWidget.Visibility = Visibility.Hidden;
                    }
                    DoubleAnimation animation2 = new DoubleAnimation
                    {
                        From        = 1.0,
                        To          = 0.0,
                        Duration    = new Duration(TimeSpan.FromMilliseconds(400.0)),
                        AutoReverse = false
                    };
                    var lp = Switcher.LastPage as UserControl;

                    Debug.WriteLine("Removing LastPAge BeginAni");
                    MediaGrid.Children.Remove(lp);
                    Switcher.LastPage.Pause();
                    Debug.WriteLine("Pased LastPAge ");
                    lp.BeginAnimation(UIElement.OpacityProperty, animation2);
                }
            }), nextPage);
        }
Example #2
0
        public ClientManager()
        {
            //      RenderOptions.ProcessRenderMode = RenderMode.SoftwareOnly;

            //Listeners

            TextWriterTraceListener[] listeners = new TextWriterTraceListener[]
            {
                new TextWriterTraceListener("log.txt"),
                new TextWriterTraceListener(Console.Out),
            };


            Debug.Listeners.AddRange(listeners);

            EventHandler handler = null;

            this._schedulerTimer    = new System.Timers.Timer();
            this.ScheduleChangeLock = new object();
            Instance = this;
            this.InitializeComponent();
            if (!Directory.Exists(Settings.Default.LibraryPath) ||
                !Directory.Exists(Settings.Default.LibraryPath + @"\backgrounds\"))
            {
                Directory.CreateDirectory(Settings.Default.LibraryPath + @"\backgrounds");
                Directory.CreateDirectory(Settings.Default.LibraryPath + @"\Layouts");
                Directory.CreateDirectory(Settings.Default.LibraryPath + @"\Uploads\Media");
            }
            this.SetCacheManager();
            this.ShowSplashScreen();
            OptionForm.SetGlobalProxy();
            if (handler == null)
            {
                handler = new EventHandler((y, t) =>
                {
                    this.Closing();
                    Environment.Exit(0);
                });
            }
            base.Closed += handler;
            MyCommand.InputGestures.Add(new KeyGesture(Key.Q, ModifierKeys.Control));
            base.CommandBindings.Add(new CommandBinding(MyCommand,
                                                        new ExecutedRoutedEventHandler(this.MyCommandExecuted)));
            this.InitializeComponent();
            Switcher.ClientManager = this;
            OptionForm.SetGlobalProxy();
            this._statLog = new ClientApp.Core.StatLog();

            Switcher.Switch(AdvertPlayer.Instance);
            this.StartMessageReceiveThread();
            try
            {
                this._schedule = new ClientApp.Schedule(App.UserAppDataPath + @"\" + Settings.Default.ScheduleFile,
                                                        Instance.CacheManager);
                this._schedule.ScheduleChangeEvent +=
                    new ClientApp.Schedule.ScheduleChangeDelegate(this.ScheduleScheduleChangeEvent);
                this._schedule.InitializeComponents();
            }
            catch (Exception)
            {
                MessageBox.Show("Fatal Error initialising eAd", "Fatal Error");
                Environment.Exit(0);
            }


            Charging       instance = Charging.Instance;
            LoadingProfile profile1 = LoadingProfile.Instance;


            //Todo: Make this an option ... Lower fps of  app
            Timeline.DesiredFrameRateProperty.OverrideMetadata(

                typeof(Timeline),

                new FrameworkPropertyMetadata {
                DefaultValue = 20
            }

                );
        }