/// <include file='doc\UpWmlMobileTextWriter.uex' path='docs/doc[@for="UpWmlMobileTextWriter.BeginForm"]/*' />
        public override void BeginForm(Form form)
        {
            ResetState();
            if (AnalyzeMode)
            {
                AllocateNewCard();
                base.BeginForm(form);
            }
            else
            {
                if (form == form.MobilePage.ActiveForm)
                {
                    PreRenderActiveForm();
                }

                base.BeginForm(form);
                RenderCardOpening(0);
            }
        }
        // Renders the beginning of a form.
        // 

        /// <include file='doc\WmlMobileTextWriter.uex' path='docs/doc[@for="WmlMobileTextWriter.RenderBeginForm"]/*' />
        protected virtual void RenderBeginForm(Form form)
        {
            WmlFormAdapter formAdapter = (WmlFormAdapter)CurrentForm.Adapter;

            IDictionary attributes = new ListDictionary();
            if (ShouldWriteFormID(form))
            {
                attributes.Add("id", form.ClientID);
            }

            String title = form.Title;
            if (title.Length > 0)
            {
                attributes.Add("title", title);
            }

            // Let the form adapter render the tag. This bit of indirection is 
            // somewhat horky, but necessary so that people can subclass adapters
            // without worrying about the fact that much of the real work is done
            // in the writer.

            formAdapter.RenderCardTag(this, attributes);

            // Write form variables.

            if ((_formVariables != null && _formVariables.Count > 0) &&
                    (!_provideBackButton ||
                 Device.CanRenderOneventAndPrevElementsTogether))
            {
                _writtenFormVariables = true;
                Write("<onevent type=\"onenterforward\"><refresh>");
                foreach (DictionaryEntry entry in _formVariables)
                {
                    WriteBeginTag("setvar");
                    WriteAttribute("name", (String)entry.Key);
                    WriteTextEncodedAttribute("value", (String)entry.Value);
                    Write(" />");
                }
                WriteLine("</refresh></onevent>");

            }

            formAdapter.RenderExtraCardElements(this);

            if (_provideBackButton)
            {
                Write("<do type=\"prev\" label=\"");
                Write(SR.GetString(SR.WmlMobileTextWriterBackLabel));
                WriteLine("\"><prev /></do>");
            }
        }
 internal virtual bool ShouldWriteFormID(Form form)
 {
     WmlPageAdapter pageAdapter = (WmlPageAdapter)CurrentForm.MobilePage.Adapter;
     
     return (form.ID != null && pageAdapter.RendersMultipleForms());
 }
        /// <include file='doc\WmlMobileTextWriter.uex' path='docs/doc[@for="WmlMobileTextWriter.BeginForm"]/*' />
        public virtual void BeginForm(Form form)
        {
            _cachedFormQueryString = null;
            _currentForm = form;

            _writtenFormVariables = false;

            // To keep track of postbacks which submit form variables,
            // and postbacks that don't. Used for postback cards
            // (see UsePostBackCards)

            _usingPostBackType[0] = _usingPostBackType[1] = false;

            if (AnalyzeMode)
            {
                _numberOfPostBacks = 0;
                _postBackCardsEfficient = false;
                _controlShortNames = null;
            }
            else
            {
                PendingBreak = false;
                _currentWrittenLayout = null;
                _currentWrittenFormat = null;

                RenderBeginForm(form);
            }
        }
 // Should be called by controls/adapters after _renderableForms is
 // set in this.Render()
 /// <include file='doc\WmlPageAdapter.uex' path='docs/doc[@for="WmlPageAdapter.IsFormRendered"]/*' />
 public virtual bool IsFormRendered(Form form)
 {
     Debug.Assert(_renderableForms != null, "_renderableForms is null");
     return _renderableForms.Contains(form);
 }
 /// <include file='doc\WmlPageAdapter.uex' path='docs/doc[@for="WmlPageAdapter.RenderForm"]/*' />
 protected virtual void RenderForm(WmlMobileTextWriter writer, Form form)
 {
     writer.AnalyzeMode = true;
     form.RenderControl(writer);
     writer.AnalyzeMode = false;
     form.RenderControl(writer);
 }
        /// <summary>
        ///    <para>
        ///       Initializes the designer using
        ///       the specified component.
        ///    </para>
        /// </summary>
        /// <param name='component'>
        ///    The control element being designed.
        /// </param>
        /// <remarks>
        ///    <para>
        ///       This is called by the designer host to establish the component being
        ///       designed.
        ///    </para>
        /// </remarks>
        /// <seealso cref='System.ComponentModel.Design.IDesigner'/>
        public override void Initialize(IComponent component)
        {
            Debug.Assert(component is Form,
                         "FormDesigner.Initialize - Invalid Form Control");

            // This must be called first in order to get properties from runtime control.
            base.Initialize(component);

            _form = (Form) component;

            if (_form.DeviceSpecific != null) {
                _form.DeviceSpecific = null;
            }

            SystemEvents.UserPreferenceChanged += 
                new UserPreferenceChangedEventHandler(this.OnUserPreferenceChanged);
        }
 internal override bool ShouldWriteFormID(Form form)
 {
     if (RequiresLoopDetectionCard)
     {
         return true;
     }
     return base.ShouldWriteFormID(form);
 }
Esempio n. 9
0
 internal void EnterFormRender(Form form)
 {
     _isRenderingInForm = true;
 }
Esempio n. 10
0
        /// <include file='doc\MobilePage.uex' path='docs/doc[@for="MobilePage.OnLoad"]/*' />
        protected override void OnLoad(EventArgs e)
        {
            // AUI 865

            if (_eventSource != null && _eventSource.Length > 0)
            {
                MobileControl control = FindControl (_eventSource) as MobileControl;
                if (control != null && (control is IPostBackEventHandler))
                {
                    _activeForm = control.Form;
                    _activeForm.Activated = true;
                }
            }

            Adapter.OnLoad(e);
            base.OnLoad(e);

            if (!IsPostBack)
            {
                ActiveForm.FireActivate(EventArgs.Empty);
            }
        }
Esempio n. 11
0
 public override void Initialize(IComponent component)
 {
     base.Initialize(component);
     this._form = (Form) component;
     SystemEvents.UserPreferenceChanged += new UserPreferenceChangedEventHandler(this.OnUserPreferenceChanged);
 }
        /// <include file='doc\ErrorFormatterPage.uex' path='docs/doc[@for="ErrorFormatterPage.InitContent"]/*' />
        protected virtual void InitContent()
        {
            Form form;
            MobileControl ctl;

            // Error form.

            form = new Form();
            form.Title = SR.GetString(SR.ErrorFormatterPage_ServerError,
                                      HttpRuntime.AppDomainAppVirtualPath);
            form.Wrapping = Wrapping.Wrap;
            IParserAccessor formAdd = (IParserAccessor)form;
             
            // Error title.

            ctl = CreateControlForText(ErrorInfo.Type);
            ctl.StyleReference = Constants.ErrorStyle;
            ctl.Font.Size = FontSize.Large;
            ctl.Font.Bold = BooleanOption.True;
            formAdd.AddParsedSubObject(ctl);

            // Error description.

            ctl = CreateControlForText(ErrorInfo.Description);
            formAdd.AddParsedSubObject(ctl);

            // Error miscellaneous text, if there is any.

            if (ErrorInfo.MiscTitle.Length > 0)
            {
                ctl = CreateControlForText(SR.GetString(SR.ErrorFormatterPage_MiscErrorMessage,
                                                        ErrorInfo.MiscTitle,
                                                        ErrorInfo.MiscText));
                formAdd.AddParsedSubObject(ctl);
            }

            // File/Line number info, if any.

            if (ErrorInfo.File.Length > 0)
            {
                Label label;

                label = new Label();
                label.Text = SR.GetString(SR.ErrorFormatterPage_File, ErrorInfo.File);
                formAdd.AddParsedSubObject(label);

                label = new Label();
                label.Text = SR.GetString(SR.ErrorFormatterPage_Line, ErrorInfo.LineNumber);
                formAdd.AddParsedSubObject(label);
            }

            Controls.Add(form);
        }
Esempio n. 13
0
 /// <include file='doc\ControlPager.uex' path='docs/doc[@for="ControlPager.ControlPager"]/*' />
 public ControlPager(Form form, int pageWeight)
 {
     _form = form;
     _pageWeight = pageWeight;
 }