Ejemplo n.º 1
0
        public ReadArticle()
        {
            InitializeComponent();

            NavigationInTransition nvs = new NavigationInTransition();
            NavigationTransition n = new NavigationTransition();

#if PIPROFILING
            var pi = new ProgressIndicator();
            pi.IsVisible = true;
            SystemTray.SetProgressIndicator(this, pi);
            Messenger.Default.Register<SetProgressIndicator>(this, (a) => Common.ProcessProgressIndicator(SystemTray.GetProgressIndicator(this), a));
#endif
        }
        /// <summary>
        /// Completes a transition operation by stopping it, restoring
        /// interactivity, and then firing the OnEndTransition event.
        /// </summary>
        /// <param name="navigationTransition">The navigation transition.</param>
        /// <param name="presenter">The content presenter.</param>
        /// <param name="transition">The transition instance.</param>
        private static void CompleteTransition(NavigationTransition navigationTransition, ContentPresenter presenter, ITransition transition)
        {
            if (transition != null)
            {
                transition.Stop();
            }

            RestoreContentPresenterInteractivity(presenter);

            if (navigationTransition != null)
            {
                navigationTransition.OnEndTransition();
            }
        }
Ejemplo n.º 3
0
        public ViewComments()
        {
            InitializeComponent();

            NavigationInTransition nvs = new NavigationInTransition();
            NavigationTransition n = new NavigationTransition();
            Loaded += new RoutedEventHandler(ViewComments_Loaded);

            Messenger.Default.Register<ReferenceCommentMessage>(this, (a) =>
            {
                if (commentBox.Text.Length > 0)
                    commentBox.Text += "\n";
                commentBox.Text += "[blockquote]" + "引用@" + a.comment.nickname + " 的话:" + a.comment.ReferenceContent + "[/blockquote]\n";
            });
            Messenger.Default.Register<DeleteCommentComplete>(this, (a) =>
                {
                    if (a.Exception != null)
                        MessageBox.Show("删除失败。。" + a.Exception.errmsg);
                    else
                    {
                        var vm = DataContext as ViewCommentsViewModel;
                        if (vm == null)
                            return;
                        if (vm.the_article.CommentList.ArticleList.Remove(a.comment))
                            MessageBox.Show("删除成功!\n\n <( ̄oo, ̄)/ ");
#if false
                        if (pi != null)
                        {
                            pi.Text = "删除完成!";
                            pi.IsVisible = true;
                            var dt = new DispatcherTimer();
                            dt.Interval = TimeSpan.FromSeconds(3);
                            dt.Tick += (ss, ee) =>
                            {
                                pi.IsVisible = false;
                                dt.Stop();
                            };
                            dt.Start();
                        }
#endif
                    }
                });

#if PIPROFILING
            var pi = new ProgressIndicator();
            pi.IsVisible = true;
            SystemTray.SetProgressIndicator(this, pi);
            Messenger.Default.Register<SetProgressIndicator>(this, (a) => Common.ProcessProgressIndicator(SystemTray.GetProgressIndicator(this), a));
#endif
        }
 /// <summary>
 /// Performs a transition when given the appropriate components,
 /// includes calling the appropriate start event and ensuring opacity
 /// on the content presenter.
 /// </summary>
 /// <param name="navigationTransition">The navigation transition.</param>
 /// <param name="presenter">The content presenter.</param>
 /// <param name="transition">The transition instance.</param>
 private static void PerformTransition(NavigationTransition navigationTransition, ContentPresenter presenter, ITransition transition)
 {
     if (navigationTransition != null)
     {
         navigationTransition.OnBeginTransition();
     }
     if (presenter != null && presenter.Opacity != 1)
     {
         presenter.Opacity = 1;
     }
     if (transition != null)
     {
         transition.Begin();
     }
 }
Ejemplo n.º 5
0
        public ReadArticle()
        {
            InitializeComponent();

            NavigationInTransition nvs = new NavigationInTransition();
            NavigationTransition n = new NavigationTransition();

#if !DEBUG
            debugTextBox.Visibility = System.Windows.Visibility.Collapsed;
            wbDebugTextbox.Visibility = System.Windows.Visibility.Collapsed;
#else
            Messenger.Default.Register<MyWebBrowserStatusChanged>(this, (s) => Deployment.Current.Dispatcher.BeginInvoke(
                () => wbDebugTextbox.Text = s.NewStatus));
#endif

        }
Ejemplo n.º 6
0
        public ViewComments()
        {
            InitializeComponent();

            NavigationInTransition nvs = new NavigationInTransition();
            NavigationTransition n = new NavigationTransition();
            Loaded += new RoutedEventHandler(ViewComments_Loaded);

#if DEBUG
            debugTextBox.Visibility = System.Windows.Visibility.Visible;
            debugButton.Visibility = System.Windows.Visibility.Visible;
#endif

            Messenger.Default.Register<ReferenceCommentMessage>(this, (a) =>
                commentBox.Text += "[blockquote]" + "引用@" + a.comment.nickname + " 的话:\n" + a.comment.ReferenceContent + "[/blockquote]");
            Messenger.Default.Register<DeleteCommentComplete>(this, (a) =>
                {
                    if (a.Exception != null)
                        MessageBox.Show("删除失败。。" + a.Exception.errmsg);
                    else
                    {
                        var vm = DataContext as ViewCommentsViewModel;
                        if (vm == null)
                            return;
                        if(vm.the_article.CommentList.ArticleList.Remove(a.comment))
                            MessageBox.Show("删除成功!\n\n <( ̄oo, ̄)/ ");
#if false
                        if (pi != null)
                        {
                            pi.Text = "删除完成!";
                            pi.IsVisible = true;
                            var dt = new DispatcherTimer();
                            dt.Interval = TimeSpan.FromSeconds(3);
                            dt.Tick += (ss, ee) =>
                            {
                                pi.IsVisible = false;
                                dt.Stop();
                            };
                            dt.Start();
                        }
#endif
                    }
                });
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Completes a transition operation by stopping it, restoring 
        /// interactivity, and then firing the OnEndTransition event.
        /// </summary>
        /// <param name="navigationTransition">The navigation transition.</param>
        /// <param name="presenter">The content presenter.</param>
        /// <param name="transition">The transition instance.</param>
        private static void CompleteTransition(NavigationTransition navigationTransition, ContentPresenter presenter, ITransition transition)
        {
            if (transition != null)
            {
                transition.Stop();
            }

            RestoreContentPresenterInteractivity(presenter);

            if (navigationTransition != null)
            {
                navigationTransition.OnEndTransition();
            }
        }
Ejemplo n.º 8
0
 /// <summary>
 /// Performs a transition when given the appropriate components,
 /// includes calling the appropriate start event and ensuring opacity
 /// on the content presenter.
 /// </summary>
 /// <param name="navigationTransition">The navigation transition.</param>
 /// <param name="presenter">The content presenter.</param>
 /// <param name="transition">The transition instance.</param>
 private static void PerformTransition(NavigationTransition navigationTransition, ContentPresenter presenter, ITransition transition)
 {
     if (navigationTransition != null)
     {
         navigationTransition.OnBeginTransition();
     }
     if (presenter != null && presenter.Opacity != 1)
     {
         presenter.Opacity = 1;
     }
     if (transition != null)
     {
         transition.Begin();
     }
 }