Esempio n. 1
0
        public ImagePage()
        {
            ViewData = new NijieImageViewModel();
            InitializeComponent();
#if DEBUG
            //iewData.ImageId = 15880;
            ViewData.ImageId = 67940;
#endif
            this.DataContext = ViewData;

            timer          = new DispatcherTimer();
            timer.Interval = TimeSpan.FromSeconds(1);
            timer.Tick    += timer_Tick;

            //if (ViewData.IsVideo != Visibility.Collapsed)
            //{
            video.MediaEnded  += Video_MediaEnded;
            video.MediaOpened += Video_MediaOpened;
            //}
            //else
            //{
            //    video.MediaEnded -= Video_MediaEnded;
            //    video.MediaOpened -= Video_MediaOpened;
            //}
        }
Esempio n. 2
0
        private void ExecuteGetImageCommand(object sender, ExecutedRoutedEventArgs e)
        {
            ViewData = new NijieImageViewModel()
            {
                ImageId = ViewData.ImageId
            };
            ModernDialog d = new ModernDialog();

            d.Content = "Loading data...";
            //d.Closed += new EventHandler((s, ex) => { ViewData.Message = "Still loading..."; });
            System.Threading.ThreadPool.QueueUserWorkItem(
                (x) =>
            {
                ViewData.GetImage();
                this.Dispatcher.BeginInvoke(
                    new Action <ImagePage>((y) =>
                {
                    this.DataContext = ViewData;
                    d.Close();
                    //ViewData.Message = "Image(s) Loaded";
                }),
                    new object[] { this }
                    );
            }, null
                );

            d.ShowDialog();
        }