Esempio n. 1
0
        public void TryAsynFactoty()
        {
            async Task Try()
            {
                PageViewer viewer = await PageViewer.CreateAsync("www.google.com");
            }

            Try();
        }
Esempio n. 2
0
 public override void                        Move(IMotionInfo info, object context, double delta)
 {
     if (info.NativeDirection > 0)
     {
         PageViewer.PreviousPage();
     }
     else
     {
         PageViewer.NextPage();
     }
 }
Esempio n. 3
0
		public Task<BitmapSource> GetRenderedImage(double width = 1920D, double height = 1080D)
			{
			Task<BitmapSource> t = new Task<BitmapSource>(() =>
			{
				var pageViewer = new PageViewer() { Page = this, Width = width, Height = height };
				pageViewer.Measure(pageViewer.DesiredSize);
				pageViewer.Arrange(new Rect(pageViewer.DesiredSize));
				pageViewer.UpdateLayout();

				List<System.Windows.Controls.Image> img = pageViewer.GetVisualChildsByCondition<System.Windows.Controls.Image>(i => true);
				pageViewer.MakeVideoVisiblie(TimeSpan.FromSeconds(5));
				foreach (var image in img)
					{
					BindingOperations.ClearBinding(image, System.Windows.Controls.Image.SourceProperty);
					image.Source = (image.DataContext as IImageVisual).IBitmapSource;
					}

				var bitmapSource = pageViewer.ConvertTo_Image();
				bitmapSource.Freeze();
				return bitmapSource;
			}, TaskCreationOptions.LongRunning);
			t.Start(Table.StaTaskScheduler);
			return t;
			}
Esempio n. 4
0
 public MainPage()
 {
     this.InitializeComponent();
     SharedModel.PageViewer = PageViewer;
     PageViewer.Navigate(typeof(LogInPage));
 }
        private void InitializeComponent()
        {
            this.components = (IContainer) new Container();
            ComponentResourceManager componentResourceManager = new ComponentResourceManager(typeof(PDFViewer1С));

            this.splitContainer1  = new SplitContainer();
            this.tvwOutline       = new TreeView();
            this.toolStrip1       = new ToolStrip();
            this.tsbOpen          = new ToolStripButton();
            this.tsbPrintAs       = new ToolStripButton();
            this.tsbPrev          = new ToolStripButton();
            this.txtPage          = new ToolStripTextBox();
            this.tsbNext          = new ToolStripButton();
            this.tsbSearch        = new ToolStripButton();
            this.tsbPrint         = new ToolStripButton();
            this.toolStripButton1 = new ToolStripButton();
            this.toolStripButton2 = new ToolStripButton();
            this.tsbAbout         = new ToolStripButton();
            this.printDialog1     = new PrintDialog();
            this.printDocument1   = new PrintDocument();
            this.saveFileDialog1  = new SaveFileDialog();
            this.ttpLink          = new ToolTip(this.components);
            this.statusStrip1     = new StatusStrip();
            this.StatusLabel      = new ToolStripStatusLabel();
            this.pageViewControl1 = new PageViewer();
            this.splitContainer1.Panel1.SuspendLayout();
            this.splitContainer1.Panel2.SuspendLayout();
            this.splitContainer1.SuspendLayout();
            this.toolStrip1.SuspendLayout();
            this.statusStrip1.SuspendLayout();
            this.SuspendLayout();
            componentResourceManager.ApplyResources((object)this.splitContainer1, "splitContainer1");
            this.splitContainer1.Name = "splitContainer1";
            this.splitContainer1.Panel1.Controls.Add((Control)this.tvwOutline);
            componentResourceManager.ApplyResources((object)this.splitContainer1.Panel1, "splitContainer1.Panel1");
            this.splitContainer1.Panel2.Controls.Add((Control)this.pageViewControl1);
            componentResourceManager.ApplyResources((object)this.splitContainer1.Panel2, "splitContainer1.Panel2");
            componentResourceManager.ApplyResources((object)this.tvwOutline, "tvwOutline");
            this.tvwOutline.Name = "tvwOutline";
            this.toolStrip1.Items.AddRange(new ToolStripItem[10]
            {
                (ToolStripItem)this.tsbOpen,
                (ToolStripItem)this.tsbPrintAs,
                (ToolStripItem)this.tsbPrev,
                (ToolStripItem)this.txtPage,
                (ToolStripItem)this.tsbNext,
                (ToolStripItem)this.tsbSearch,
                (ToolStripItem)this.tsbPrint,
                (ToolStripItem)this.toolStripButton1,
                (ToolStripItem)this.toolStripButton2,
                (ToolStripItem)this.tsbAbout
            });
            componentResourceManager.ApplyResources((object)this.toolStrip1, "toolStrip1");
            this.toolStrip1.Name      = "toolStrip1";
            this.tsbOpen.DisplayStyle = ToolStripItemDisplayStyle.Image;
            this.tsbOpen.Image        = (Image)Resources.dmdskres_373_9_16x16x32;
            componentResourceManager.ApplyResources((object)this.tsbOpen, "tsbOpen");
            this.tsbOpen.Name            = "tsbOpen";
            this.tsbOpen.Click          += new EventHandler(this.tsbOpen_Click);
            this.tsbPrintAs.DisplayStyle = ToolStripItemDisplayStyle.Image;
            this.tsbPrintAs.Image        = (Image)Resources.PrintBrmUi_102_6_16x16x32;
            componentResourceManager.ApplyResources((object)this.tsbPrintAs, "tsbPrintAs");
            this.tsbPrintAs.Name      = "tsbPrintAs";
            this.tsbPrintAs.Click    += new EventHandler(this.tsbPrintAs_Click);
            this.tsbPrev.DisplayStyle = ToolStripItemDisplayStyle.Image;
            this.tsbPrev.Image        = (Image)Resources.netshell_21611_1_16x16x32;
            componentResourceManager.ApplyResources((object)this.tsbPrev, "tsbPrev");
            this.tsbPrev.Name   = "tsbPrev";
            this.tsbPrev.Click += new EventHandler(this.tsbPrev_Click);
            this.txtPage.Name   = "txtPage";
            componentResourceManager.ApplyResources((object)this.txtPage, "txtPage");
            this.txtPage.KeyDown     += new KeyEventHandler(this.txtPage_KeyDown);
            this.tsbNext.DisplayStyle = ToolStripItemDisplayStyle.Image;
            this.tsbNext.Image        = (Image)Resources.netshell_1611_1_16x16x32;
            componentResourceManager.ApplyResources((object)this.tsbNext, "tsbNext");
            this.tsbNext.Name           = "tsbNext";
            this.tsbNext.Click         += new EventHandler(this.tsbNext_Click);
            this.tsbSearch.DisplayStyle = ToolStripItemDisplayStyle.Image;
            this.tsbSearch.Image        = (Image)Resources.SearchFolder_323_3_16x16x32;
            componentResourceManager.ApplyResources((object)this.tsbSearch, "tsbSearch");
            this.tsbSearch.Name        = "tsbSearch";
            this.tsbSearch.Click      += new EventHandler(this.tsbSearch_Click);
            this.tsbPrint.DisplayStyle = ToolStripItemDisplayStyle.Image;
            this.tsbPrint.Image        = (Image)Resources.FeedbackTool_109_12_16x16x32;
            componentResourceManager.ApplyResources((object)this.tsbPrint, "tsbPrint");
            this.tsbPrint.Name   = "tsbPrint";
            this.tsbPrint.Click += new EventHandler(this.toolStripButton1_Click);
            this.toolStripButton1.DisplayStyle = ToolStripItemDisplayStyle.Image;
            this.toolStripButton1.Image        = (Image)Resources.ZoomIn;
            componentResourceManager.ApplyResources((object)this.toolStripButton1, "toolStripButton1");
            this.toolStripButton1.Name         = "toolStripButton1";
            this.toolStripButton1.Click       += new EventHandler(this.tsbZoomIn_Click);
            this.toolStripButton2.DisplayStyle = ToolStripItemDisplayStyle.Image;
            this.toolStripButton2.Image        = (Image)Resources.ZoomOut;
            componentResourceManager.ApplyResources((object)this.toolStripButton2, "toolStripButton2");
            this.toolStripButton2.Name   = "toolStripButton2";
            this.toolStripButton2.Click += new EventHandler(this.tsbZoomOut_Click);
            this.tsbAbout.DisplayStyle   = ToolStripItemDisplayStyle.Image;
            this.tsbAbout.Image          = (Image)Resources.psr_206_4_16x16x32;
            componentResourceManager.ApplyResources((object)this.tsbAbout, "tsbAbout");
            this.tsbAbout.Name            = "tsbAbout";
            this.tsbAbout.Click          += new EventHandler(this.tsbAbout_Click);
            this.printDialog1.UseEXDialog = true;
            this.statusStrip1.Items.AddRange(new ToolStripItem[1]
            {
                (ToolStripItem)this.StatusLabel
            });
            componentResourceManager.ApplyResources((object)this.statusStrip1, "statusStrip1");
            this.statusStrip1.Name = "statusStrip1";
            this.StatusLabel.Name  = "StatusLabel";
            componentResourceManager.ApplyResources((object)this.StatusLabel, "StatusLabel");
            this.pageViewControl1.BackColor   = SystemColors.AppWorkspace;
            this.pageViewControl1.BorderColor = System.Drawing.Color.Black;
            componentResourceManager.ApplyResources((object)this.pageViewControl1, "pageViewControl1");
            this.pageViewControl1.DrawBorder     = false;
            this.pageViewControl1.DrawShadow     = true;
            this.pageViewControl1.Name           = "pageViewControl1";
            this.pageViewControl1.PageColor      = SystemColors.AppWorkspace;
            this.pageViewControl1.PageSize       = new Size(0, 0);
            this.pageViewControl1.PaintMethod    = PageViewer.DoubleBufferMethod.BuiltInOptimizedDoubleBuffer;
            this.pageViewControl1.ScrollPosition = new System.Drawing.Point(-10, -10);
            this.pageViewControl1.PreviousPage  += new PageViewer.MovePageHandler(this.doubleBufferControl1_PreviousPage);
            this.pageViewControl1.NextPage      += new PageViewer.MovePageHandler(this.doubleBufferControl1_NextPage);
            this.pageViewControl1.PaintControl  += new PageViewer.PaintControlHandler(this.doubleBufferControl1_PaintControl);
            componentResourceManager.ApplyResources((object)this, "$this");
            this.AutoScaleMode = AutoScaleMode.Font;
            this.Controls.Add((Control)this.statusStrip1);
            this.Controls.Add((Control)this.splitContainer1);
            this.Controls.Add((Control)this.toolStrip1);
            this.DoubleBuffered = true;
            this.Name           = "PDFViewer1С";
            this.splitContainer1.Panel1.ResumeLayout(false);
            this.splitContainer1.Panel2.ResumeLayout(false);
            this.splitContainer1.ResumeLayout(false);
            this.toolStrip1.ResumeLayout(false);
            this.toolStrip1.PerformLayout();
            this.statusStrip1.ResumeLayout(false);
            this.statusStrip1.PerformLayout();
            this.ResumeLayout(false);
            this.PerformLayout();
        }
Esempio n. 6
0
        private async void ButtonSend_Click(object sender, RoutedEventArgs e)
        {
            string errorDescription = string.Empty;

            try
            {
                await _doOauthAsync();

                TextStatus.Text = "Oauth is completed, ready to send email.";
            }
            catch (Exception ep)
            {
                errorDescription = string.Format("Failed to do oauth, exception: {0}", ep.Message);
            }

            if (!string.IsNullOrWhiteSpace(errorDescription))
            {
                await new MessageDialog(errorDescription).ShowAsync();
                TextStatus.Text = errorDescription;
                return;
            }

            if (string.IsNullOrWhiteSpace(TextTo.Text) && string.IsNullOrWhiteSpace(TextCc.Text))
            {
                MessageDialog dlg = new MessageDialog("Please input a recipient at least!");
                await dlg.ShowAsync();

                TextTo.Text = ""; TextCc.Text = "";
                TextTo.Focus(Windows.UI.Xaml.FocusState.Programmatic);
                return;
            }

            if (string.IsNullOrWhiteSpace(TextServer.Text))
            {
                MessageDialog dlg = new MessageDialog("Please input server address!");
                await dlg.ShowAsync();

                TextServer.Text = "";
                TextServer.Focus(Windows.UI.Xaml.FocusState.Programmatic);
                return;
            }

            ButtonSend.IsEnabled          = false;
            ProgressBarSending.Value      = 0;
            ProgressBarSending.Visibility = Visibility.Visible;
            PageViewer.ChangeView(0, PageViewer.ScrollableHeight, 1);
            this.Focus(FocusState.Programmatic);

            try
            {
                await _sendEmailAsync();
            }
            catch (Exception ep)
            {
                errorDescription = string.Format("Failed to do oauth, exception: {0}", ep.Message);
            }

            if (!string.IsNullOrWhiteSpace(errorDescription))
            {
                await new MessageDialog(errorDescription).ShowAsync();
                TextStatus.Text = errorDescription;
            }

            ProgressBarSending.Visibility = Visibility.Collapsed;
            _asyncCancel = null;

            ButtonSend.IsEnabled   = true;
            ButtonCancel.IsEnabled = false;
            ButtonClear.IsEnabled  = true;
        }
 public MainWindow()
 {
     InitializeComponent();
     PageViewer.Navigate(MainPage);
     OpenConnection();
 }
Esempio n. 8
0
    protected Personify.WebControls.Base.Business.PersonifyIdentity GetPersonifyUser()
    {
        //if (this.Page is PageBuilderViewer)
        //{
        //    Personify.WebControls.Base.Business.PersonifyIdentity pageUser = (this.Page as PageBuilderViewer).PersonifyUser;
        //    if (pageUser != null)
        //    {
        //        return pageUser;
        //    }
        //}

        var user = new Personify.WebControls.Base.Business.PersonifyIdentity
        {
            ContainerName = "Kentico",
            CurrencyCode  = "USD",
            SubCustomerId = 0
        };



        // var userApi = new Ektron.Cms.UserAPI();

        // if (userApi.IsLoggedIn && !userApi.IsAdmin())
        //  if (!string.IsNullOrEmpty(MembershipContext.AuthenticatedUser.FirstName))
        if (CMS.Membership.AuthenticationHelper.IsAuthenticated())
        {
            if (HttpContext.Current.Session["PersonifyToken"] != null)
            {
                HttpContext.Current.Session["PersonifyToken"] = ValidateCustomerToken(HttpContext.Current.Session["PersonifyToken"].ToString());

                if (!string.IsNullOrEmpty(HttpContext.Current.Session["PersonifyToken"] as string))
                {
                    //Ektron.Cms.UserData ud = _ektronUserApi.GetUser(userApi.UserId);
                    UserInfo ud = UserInfoProvider.GetUserInfo(MembershipContext.AuthenticatedUser.UserID);

                    // string cRemoteid = ConfigurationManager.AppSettings["EktronCustomProperty_MasterCustomerId"];
                    if (HttpContext.Current.Session["userClass"] != null)
                    {
                        userinfo ui = (userinfo)HttpContext.Current.Session["userClass"];
                        if (ui != null)
                        {
                            user.CustomerName     = MembershipContext.AuthenticatedUser.FirstName + " " + MembershipContext.AuthenticatedUser.LastName;
                            user.MasterCustomerId = ui.ID;
                            //"RemoteID";//ud.CustomProperties[cRemoteid].Value.ToString(); ;

                            user.IsLoggedIn       = true;
                            user.ShoppingGUID     = ui.ID;
                            user.MasterCustomerId = ui.ID;
                        }
                    }
                    //  if (ud.CustomProperties[cRemoteid] != null)
                    {
                        //user.IsMember = false;
                    }
                }
            }
        }
        ///pass dummy credentials if not logged in
        if (string.IsNullOrEmpty(user.MasterCustomerId))
        {
            //return dummy user
            user.CustomerName     = "Steven Karl";
            user.IsMember         = false;
            user.IsLoggedIn       = false;
            user.MasterCustomerId = "01786850";
        }
        if (CMS.Membership.AuthenticationHelper.IsAuthenticated())
        {
            bool     flagadmin = false;
            UserInfo userdata  = CMS.Membership.UserInfoProvider.GetUserInfo(MembershipContext.AuthenticatedUser.UserName);

            DataTable dt = UserInfoProvider.GetUserRoles(userdata);

            if (dt.Rows.Count > 0 && dt != null)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    if (dr["RoleName"].ToString().ToLower().Contains("administrator"))
                    {
                        flagadmin = true;
                    }
                }
            }

            if (flagadmin)
            {
                user.IsAdministrator = true;
            }
            else
            {
                var ck = HttpContext.Current.Request.Cookies[PersonifyControlBase.PersonifyShoppingCartGuidCookieName];
                if (ck != null && ck.Value != null)
                {
                    user.ShoppingGUID = ck.Value;
                }
                else
                {
                    var cookieValue = HttpContext.Current.Session.SessionID;

                    DateTime dtExpire = DateTime.Now.AddDays(CookieDurationDays);

                    var myCookie = new HttpCookie(PersonifyControlBase.PersonifyShoppingCartGuidCookieName)
                    {
                        Value   = cookieValue,
                        Expires = dtExpire
                    };

                    HttpContext.Current.Response.Cookies.Add(myCookie);

                    user.ShoppingGUID = cookieValue;
                }
            }

            PageViewer p = new PageViewer();
            p.PersonifyUser = user;
        }



        return(user);
    }
Esempio n. 9
0
        private void GoToPage(object sender, RoutedPropertyChangedEventArgs <double> e)
        {
            var number = e.NewValue;

            PageViewer.GoToPage((int)number);
        }
Esempio n. 10
0
            public static Task <PageViewer> CreateAsync(string url)
            {
                PageViewer viewer = new PageViewer();

                return(viewer.InitAsync(url));
            }