Home page/Parent section

 


>>
Home

>>
Curriculum

>>
Articles

>>
Calendar

>>
Events

>>
Books

>>
Links

>>
Discuss

>>
Downloads



Login
Register


The DNA of many growing companies is their development team - we can help you leverage the power of .NET to successfully complete projects


       Skip Navigation LinksHome Curriculum Mar
Mobile Device Development - MVP

Bill Kratochvil presented code for his Mobile Framework.  It utilizes the Model-View-Presenter pattern (principals learned in earlier user group meetings) and shows how concepts learned for the Desktop and ASP.NET can be also applied to Mobile development.   Bill discussed some serious issues with Mobile Development (designer is very fragile when subclassing forms and usercontrols) along with their work-arounds.

We also discussed Multi-targeting development (using the same code for multiple platforms) and explained how Bill is using the same source code for the Desktop, Silverlight and Mobile application for an application he is developing for a local client.  He referenced a WebCast he had created on the “ProjectLinker“ application (click HERE for blog w/webcast).

The following screen shows the demo application at work.   With a few lines of code,
and by simply dropping controls, we have the following functionality (select and click):

The following Interface, View and Presenter code reflects the foundation for every Form (view) and shows all the code required to make the above work; it relies on the framework's base classes to wireup the controls (buttons, comboBox, etc) and gives the developer a means to tap into the events within UserControls as well as Forms (using the same presenter baseclass).

namespace PasswordManager.Main

{

    public interface IMainView : IViewBase

    {

    }

}

namespace PasswordManager

{

    public partial class MainView : FormBase, IMainView

    {

        public MainView(object sender, EventArgs e)

        {

            InitializeComponent();

 

            if (DesignMode.IsTrue)

                return;

 

            Presenter = new MainViewPresenter(this, e);

        }

 

        private IPresenterBase _presenter;

        public IPresenterBase Presenter

        {

            get { return _presenter; }

            set { _presenter = (MainViewPresenter)value; }

        }

    }

}

namespace PasswordManager.Main

{

    public class MainViewPresenter : PresenterBase<IMainView>

    {

        string selectedValue;

 

        private ComboBox cboTestList {

            get { return ((IViewBase)View)
                  .FindControl<
ComboBox>("cboTestList"); } }

 

 

        public MainViewPresenter() { }

        public MainViewPresenter(object sender, EventArgs e)

            : base(sender, e)

        {

        }

 

        public override void OnViewReady(object sender, EventArgs e)

        {

            cboTestList.SelectedIndex = 0;

        }

 

        public override void OnComboBoxSelectedIndexChanged(
              
object sender, EventArgs e)

        {

            selectedValue = cboTestList.SelectedItem.ToString();

        }

 

        public override void OnButtonClick(object sender, EventArgs e)

        {

            MessageBox.Show(selectedValue);

        }

    }

}

Source code, video clips and blog links available => http://mobile5framework.codeplex.com/

 

 

 

 



Global Webnet, LLC


You must be the change you wish to see in the world.
--- Mahatma Ghandi

Home   |  Curriculum   |  Articles   |  Calendar   |  Events   |  Books   |  Links   |  Discuss   |  Downloads