Exemple #1
0
 private void RaiseEvent(PageDelegate e, object sender, PageChangedEventArgs args)
 {
     if (e != null)
     {
         e(sender, args);
     }
 }
Exemple #2
0
		/// <summary>
		/// Create a new <see cref="PageInvoker"/> which Delegates contain the
		/// given callback for PreInit event.
		/// </summary>
		/// <param name="callback">The user callback.</param>
		/// <returns>A new <see cref="PageInvoker"/> instance.</returns>
		public static PageInvoker CreateOnPreInit (PageDelegate callback)
		{
			PageDelegates pd = new PageDelegates ();
			pd.PreInit = callback;
			PageInvoker pi = new PageInvoker (pd);
			return pi;
		}
Exemple #3
0
		/// <summary>
		/// Create a new <see cref="PageInvoker"/> which Delegates contain the
		/// given callback for Load event.
		/// </summary>
		/// <param name="callback">The user callback.</param>
		/// <returns>A new <see cref="PageInvoker"/> instance.</returns>
		public static PageInvoker CreateOnLoad (PageDelegate callback)
		{
			PageDelegates pd = new PageDelegates ();
			pd.Load = callback;
			PageInvoker pi = new PageInvoker (pd);
			return pi;
		}
Exemple #4
0
 /// <summary>
 /// will allow you to write queries on Page.
 /// </summary>
 public NodeQuery onPage(PageDelegate buildQuery)
 {
     Query.Append("...on Page{");
     buildQuery(new PageQuery(Query));
     Query.Append("}");
     return(this);
 }
        /// <summary>
        /// Find a page by its handle.
        /// </summary>
        /// <param name="handle">
        /// The handle of the page.
        /// </param>
        public QueryRootQuery pageByHandle(PageDelegate buildQuery, string handle, string alias = null)
        {
            if (alias != null)
            {
                ValidationUtils.ValidateAlias(alias);

                Query.Append("pageByHandle___");
                Query.Append(alias);
                Query.Append(":");
            }

            Query.Append("pageByHandle ");

            Arguments args = new Arguments();

            args.Add("handle", handle);

            Query.Append(args.ToString());

            Query.Append("{");
            buildQuery(new PageQuery(Query));
            Query.Append("}");

            return(this);
        }
Exemple #6
0
        /// <summary>
        /// Create a new <see cref="PageInvoker"/> which Delegates contain the
        /// given callback for Load event.
        /// </summary>
        /// <param name="callback">The user callback.</param>
        /// <returns>A new <see cref="PageInvoker"/> instance.</returns>
        public static PageInvoker CreateOnLoad(PageDelegate callback)
        {
            PageDelegates pd = new PageDelegates();

            pd.Load = callback;
            PageInvoker pi = new PageInvoker(pd);

            return(pi);
        }
Exemple #7
0
        /// <summary>
        /// 页面控件呈现
        /// </summary>
        private void Page(bool callEvent)
        {
            if (this.toolStrip1.InvokeRequired)//等待异步
            {
                PageDelegate myDelegate = new PageDelegate(SetCtrolEnabled);

                if (this.Parent != null && !this.Parent.IsHandleCreated)
                {
                    return;
                }

                if (IsDisposed || !this.IsHandleCreated || !this.toolStrip1.IsHandleCreated)
                {
                    return;
                }

                this.Invoke(myDelegate, new object[] { false });//通过委托调用
            }
            else
            {
                if (PageIndex == 0)
                {
                    PageIndex = 1;
                }

                txt_CurrentIndex.Text = PageIndex.ToString();
                lbl_PageCount.Text    = PageCount.ToString();
                lbl_RecordCount.Text  = string.Format("每页{0}条记录,共{1}条记录", PageSize, RecordCount);

                if (callEvent && OnPageChanged != null)
                {
                    OnPageChanged(this, null);//当前分页数字改变时,触发委托事件
                }
                SetCtrolEnabled();
                if (PageCount == 1)//有且仅有一页
                {
                    btn_First.Enabled    = false;
                    btn_Last.Enabled     = false;
                    btn_Next.Enabled     = false;
                    btn_Previous.Enabled = false;
                }
                else if (PageIndex == 1)//第一页
                {
                    btn_First.Enabled    = false;
                    btn_Previous.Enabled = false;
                }
                else if (PageIndex == PageCount)//最后一页
                {
                    btn_Next.Enabled = false;
                    btn_Last.Enabled = false;
                }
            }
        }
Exemple #8
0
 void Invoke(PageDelegate callback)
 {
     try {
         if (callback != null)
         {
             callback(_page);
         }
     }
     catch (Exception e) {
         WebTest.RegisterException(e);
         throw;
     }
 }
Exemple #9
0
 private void RaiseEvent(PageDelegate e, object sender)
 {
     this.RaiseEvent(e, this, null);
 }
Exemple #10
0
		public void PageHeaderLoad ()
		{
			PageDelegate pd = new PageDelegate (CheckHeader);
			WebTest t = new WebTest (PageInvoker.CreateOnLoad (pd));
			string html = t.Run ();
			string newHtml = html.Substring (html.IndexOf ("<head"), (html.IndexOf ("<body") - html.IndexOf ("<head")));
			string origHtml = @" <head id=""Head1""><title>
	                            Test
                                </title></head>";
			HtmlDiff.AssertAreEqual (origHtml, newHtml, "HeaderRenderLoad");
		}
        /// <summary>
        /// Stops the thumb from scrolling if it is currently being flicked.
        /// </summary>
        public void StopFlick()
        {
            // Stop manipulating.
            if (manipulationProcessor != null)
            {
                manipulationProcessor.CompleteManipulation();
            }
            // Stop inertia.
            if (inertiaProcessor != null)
            {
                inertiaProcessor.Complete();
            }

            PageAgain = null;
            isScrolling = false;
        }
        /// <summary>
        /// Scrolls the thumb 1 page forward over 0.5 seconds.
        /// </summary>
        public void PageForward()
        {
            // Assign the PageForward method to the PageAgain delegate so that the thumb
            // keeps moving in the correct direction.
            PageAgain = PageForward;

            // If the thumb animation is playing adjust the location it will move to
            // based on where it currently is animating to.
            if (scrollAnimation != null && scrollAnimation.IsPlaying)
            {
                AnimateTo(scrollAnimation.To + ViewportSize);
            }
            else
            {
                AnimateTo(Value + ViewportSize);
            }
        }
		public void DetailsView_EmptyDataTextPropertyRender ()
		{	
			PageDelegate pd = new PageDelegate (DetailsView_EmptyDataTextProperty);
			WebTest t = new WebTest (PageInvoker.CreateOnLoad (pd));
			string result = t.Run ();						
			FormRequest fr = new FormRequest (t.Response, "form1");
			fr.Controls.Add ("__EVENTTARGET");
			fr.Controls.Add ("__EVENTARGUMENT");
			fr.Controls["__EVENTTARGET"].Value = "LinkButton1";
			fr.Controls["__EVENTARGUMENT"].Value = "";
			t.Request = fr;
			//t.Invoker = PageInvoker.CreateOnLoad (pd);
			result = t.Run ();
			string newHtml = HtmlDiff.GetControlFromPageHtml (result); 
			string origHtml=@"<div>
					<table cellspacing=""0"" rules=""all"" border=""1"" style=""border-collapse:collapse;"">
					<tr>
					<td>Empty Data</td>
					</tr>
					</table>
					</div><a id=""LinkButton1"" href=""javascript:__doPostBack('LinkButton1','')"">Test</a>";
			HtmlDiff.AssertAreEqual(origHtml, newHtml, "EmptyDataTextTest");


		}
Exemple #14
0
		void Invoke (PageDelegate callback)
		{
			try {
				if (callback != null)
					callback (_page);
			}
			catch (Exception e) {
				WebTest.RegisterException (e);
				throw;
			}
		}
        /// <summary>
        /// Stops the thumb from scrolling if it is currently being flicked.
        /// </summary>
        public void StopFlick()
        {
            // Stop manipulating.
            if (manipulationProcessor != null)
            {
                manipulationProcessor.CompleteManipulation(stopwatch.Elapsed100Nanoseconds());
            }
            // Stop inertia.
            if (inertiaProcessor != null)
            {
                inertiaProcessor.Complete(stopwatch.Elapsed100Nanoseconds());
            }

            PageAgain = null;
            isScrolling = false;
        }
Exemple #16
0
 private void RaiseEvent(PageDelegate e, object sender, PageChangedEventArgs args)
 {
     if (e != null)
     {
         e(sender, args);
     }
 }
		public void DetailsView_EmptyDataTextPropertyRender ()
		{	
			PageDelegate pd = new PageDelegate (DetailsView_EmptyDataTextProperty);
			WebTest t = new WebTest (PageInvoker.CreateOnLoad (pd));
			string result = t.Run ();						
			FormRequest fr = new FormRequest (t.Response, "form1");
			fr.Controls.Add ("__EVENTTARGET");
			fr.Controls.Add ("__EVENTARGUMENT");
			fr.Controls["__EVENTTARGET"].Value = "LinkButton1";
			fr.Controls["__EVENTARGUMENT"].Value = "";
			t.Request = fr;
			//t.Invoker = PageInvoker.CreateOnLoad (pd);
			result = t.Run ();
			string newHtml = HtmlDiff.GetControlFromPageHtml (result); 
#if NET_4_0
			string origHtml = "<div>\r\n\t<table cellspacing=\"0\" rules=\"all\" border=\"1\" style=\"border-collapse:collapse;\">\r\n\t\t<tr>\r\n\t\t\t<td>Empty Data</td>\r\n\t\t</tr>\r\n\t</table>\r\n</div><a id=\"LinkButton1\" href=\"javascript:__doPostBack(&#39;LinkButton1&#39;,&#39;&#39;)\">Test</a>";
#else
			string origHtml = "<div>\r\n\t<table cellspacing=\"0\" rules=\"all\" border=\"1\" style=\"border-collapse:collapse;\">\r\n\t\t<tr>\r\n\t\t\t<td>Empty Data</td>\r\n\t\t</tr>\r\n\t</table>\r\n</div><a id=\"LinkButton1\" href=\"javascript:__doPostBack('LinkButton1','')\">Test</a>";
#endif
			HtmlDiff.AssertAreEqual(origHtml, newHtml, "EmptyDataTextTest");
		}
Exemple #18
0
 private void RaiseEvent(PageDelegate e, object sender)
 {
     this.RaiseEvent(e, this, null);
 }