static BindingServiceProvider()
 {
     BindingModeToBehaviorField = new Dictionary <string, IBindingBehavior>(StringComparer.OrdinalIgnoreCase)
     {
         { "Default", null },
         { "TwoWay", new TwoWayBindingMode() },
         { "OneWay", new OneWayBindingMode() },
         { "OneTime", new OneTimeBindingMode() },
         { "OneWayToSource", new OneWayToSourceBindingMode() },
         { "None", NoneBindingMode.Instance }
     };
     MemberPriorities = new Dictionary <string, int>
     {
         { AttachedMemberConstants.DataContext, DataContextMemberPriority },
         { AttachedMemberConstants.ItemTemplate, TemplateMemberPriority },
         { AttachedMemberConstants.ItemTemplateSelector, TemplateMemberPriority },
         { AttachedMemberConstants.ContentTemplate, TemplateMemberPriority },
         { AttachedMemberConstants.ContentTemplateSelector, TemplateMemberPriority }
     };
     FakeMemberPrefixesField = new List <string>
     {
         "_Fake",
         "Fake"
     };
     DataContextMemberAliasesField = new HashSet <string>(StringComparer.Ordinal)
     {
         AttachedMemberConstants.DataContext
     };
     SetDefaultValues();
     MvvmApplication.InitializeDesignTimeManager();
     ViewManager.GetDataContext = BindingExtensions.DataContext;
     ViewManager.SetDataContext = BindingExtensions.SetDataContext;
 }
예제 #2
0
        static void Main(string[] args)
        {
            log4net.Config.XmlConfigurator.Configure();
            ILog log = LogManager.GetLogger(typeof(Program));

            try
            {
                log.Info(LogFormat.Message("", "Application_start", LogStatus.Success, ""));

                MultiLanguageManager.SetDefaultLabelsDictionary <DSW.Localisation.Labels.Dictionary>();
                MultiLanguageManager.SetDefaultMessageDictionary <DSW.Localisation.Messages.Dictionary>();

                if (SingleInstanceApplication.IsExist())
                {
                    FormUtility.EnableTaskBar(false);
                    FormUtility.EnableTaskBar(true);

                    MessageUtility.DisplayErrorMsg(MultiLanguageManager.Messages.GetString(DSW.Localisation.Messages.Dictionary.Common.HT_COM_MS029),
                                                   MultiLanguageManager.Messages.GetString(DSW.Localisation.Messages.Dictionary.Common.HT_COM_CAP001));

                    log.Info(LogFormat.Message("", "Application_end", LogStatus.Failed, DSW.Localisation.Messages.Dictionary.Common.HT_COM_MS029));

                    Application.Exit();

                    return;
                }

                FormUtility.EnableTaskBar(false);

                AppDataService.SetSettingApiAddress(Setting.ApiAddress);

                var appModule       = new AppModule();
                var mvvmApplication = new MvvmApplication(appModule);

                mvvmApplication.Run <StocktakeNewView>();

                FormUtility.EnableTaskBar(true);

                log.Info(LogFormat.Message("", "Application_end", LogStatus.Success, ""));

                LogManager.Shutdown();
            }
            catch (Exception ex)
            {
                log.Info(LogFormat.Message("", "Application_end", LogStatus.Failed, ex.Message + Environment.NewLine + ex.StackTrace));

                LogManager.Shutdown();

                FormUtility.EnableTaskBar(false);
                FormUtility.EnableTaskBar(true);

                MessageUtility.DisplayErrorMsg(ex.Message,
                                               MultiLanguageManager.Messages.GetString(DSW.Localisation.Messages.Dictionary.Common.HT_COM_CAP001));

                Application.Exit();
            }
        }
예제 #3
0
 public virtual void Start()
 {
     Initialize();
     if (!MvvmApplication.Context.Contains(NavigationConstants.IsDialog))
     {
         MvvmApplication.Context.Add(NavigationConstants.IsDialog, false);
     }
     IocContainer.Get <IViewModelPresenter>().DynamicPresenters.Add(this);
     MvvmApplication.Start();
 }
예제 #4
0
 protected virtual void InitializeInternal()
 {
     MvvmApplication = CreateApplication();
     IocContainer    = CreateIocContainer();
     if (IsDesignMode)
     {
         InitializationContext = InitializationContext.ToNonReadOnly();
         InitializationContext.AddOrUpdate(InitializationConstants.IsDesignMode, true);
     }
     MvvmApplication.Initialize(Platform, IocContainer, GetAssemblies(), InitializationContext ?? DataContext.Empty);
 }
        public virtual void Start()
        {
            Initialize();
            if (!MvvmApplication.Context.Contains(NavigationConstants.IsDialog))
            {
                MvvmApplication.Context.Add(NavigationConstants.IsDialog, false);
            }
            var rootPresenter = GetRootPresenter();

            if (rootPresenter != null)
            {
                IocContainer.Get <IViewModelPresenter>().DynamicPresenters.Add(rootPresenter);
            }
            MvvmApplication.Start();
        }
 public BindingEditorView()
 {
     MvvmApplication.InitializeDesignTimeManager();
     InitializeComponent();
     bindingEditor.Handler             = this;
     _controlsDictionary               = new SortedDictionary <string, SortedDictionary <string, AutoCompleteItem> >(StringComparer.CurrentCulture);
     _controlsCompleteItems            = new SortedDictionary <string, AutoCompleteItem>(StringComparer.CurrentCulture);
     _typeCompleteItems                = new Dictionary <Type, SortedDictionary <string, AutoCompleteItem> >();
     _attachedControlAutoCompleteItems = BindingServiceProvider
                                         .MemberProvider
                                         .GetAttachedMembers(typeof(Control))
                                         .ToArrayEx(s => new AutoCompleteItem(s.Key, s.Key, MemberTypes.Custom));
     controlsTreeView.Nodes.Add(GetComponents(CurrentControl));
     controlsTreeView.ExpandAll();
 }
예제 #7
0
        protected virtual IList <Assembly> GetAssemblies()
        {
            var assemblies = new HashSet <Assembly>
            {
                GetType().GetAssembly(),
                typeof(BootstrapperBase).GetAssembly()
            };

            TryLoadAssemblyByType("BindingServiceProvider", "MugenMvvmToolkit.Binding", assemblies);
            if (MvvmApplication != null)
            {
                assemblies.Add(MvvmApplication.GetType().GetAssembly());
            }
            UpdateAssemblies(assemblies);
            return(assemblies.ToArrayEx());
        }
예제 #8
0
        static XamarinFormsBootstrapperBase()
        {
            MvvmApplication.SetDefaultDesignTimeManager();
            if (Device.OS != TargetPlatform.WinPhone)
            {
                LinkerInclude.Initialize();
            }
            DynamicMultiViewModelPresenter.CanShowViewModelDefault      = CanShowViewModelTabPresenter;
            DynamicViewModelNavigationPresenter.CanShowViewModelDefault = CanShowViewModelNavigationPresenter;
            ViewManager.ViewCleared     += OnViewCleared;
            ViewManager.ClearDataContext = true;
            var contextName = ToolkitExtensions.GetMemberName <BindableObject>(() => e => e.BindingContext);

            BindingServiceProvider.DataContextMemberAliases.Add(contextName);
            BindingServiceProvider.BindingMemberPriorities[contextName] = BindingServiceProvider.DataContextMemberPriority;
        }
예제 #9
0
        public virtual void Start()
        {
            if (Current != null && !ReferenceEquals(Current, this))
            {
                Current.Start();
                return;
            }
            Initialize();
            ToolkitServiceProvider.EventAggregator.Publish(this, ApplicationStartingMessage.Instance);

            var context            = new DataContext(MvvmApplication.Context);
            var viewModelPresenter = IocContainer.Get <IViewModelPresenter>();
            var presenter          = viewModelPresenter as IRestorableViewModelPresenter;

            if (presenter == null || !presenter.TryRestore(context))
            {
                MvvmApplication.Start();
            }
        }
예제 #10
0
        public virtual void Start()
        {
            if (Current != null && !ReferenceEquals(Current, this))
            {
                Current.Start();
                return;
            }
            Initialize();
            OnStart();

            var context = new DataContext(MvvmApplication.Context);

            _hasRootPage = false;

            var viewModelPresenter = IocContainer.Get <IViewModelPresenter>();
            var presenter          = viewModelPresenter as IRestorableViewModelPresenter;

            if (presenter == null || !presenter.TryRestore(context))
            {
                MvvmApplication.Start();
            }
        }
예제 #11
0
 public virtual void Start()
 {
     Initialize();
     MvvmApplication.Start();
 }
예제 #12
0
 public virtual void Start()
 {
     Initialize();
     _isStarted = true;
     MvvmApplication.Start();
 }