Exemple #1
0
        protected Page CreateAndBindPage(Type viewModelType, object parameter)
        {
            try
            {
                Type pageType = GetPageTypeForViewModel(viewModelType);

                if (pageType == null)
                {
                    throw new Exception($"Mapping type for {viewModelType} is not a page");
                }
                Page          page      = Activator.CreateInstance(pageType) as Page;
                PageModelBase viewModel = PageModelLocator.Instance.Resolve(viewModelType) as PageModelBase;
                page.BindingContext = viewModel;

                if (page is IPageWithParameters)
                {
                    ((IPageWithParameters)page).InitializeWith(parameter);
                }

                return(page);
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
        }
Exemple #2
0
        /// <summary>
        /// 收集所有的page之后,再response
        /// </summary>
        /// <param name="topic"></param>
        /// <param name="payload"></param>
        private async void TagSetupReceived(string topic, byte[] payload)
        {
            string     strPayload = Encoding.UTF8.GetString(payload);
            SetupModel setup      = JsonSrialize.Desrialize <SetupModel>(strPayload);

            LogHelper.Debug("TagSetupReceived: " + strPayload);
            if (!(PageModelBase <GroupRes> .GatherAllPages(setup, 5000, null) is SetupModel pages))
            {
                return;
            }

            var   task = Setup2Proxys(pages);
            await task;

            if (task.Result != null)
            {
                LogHelper.Debug("task.Result.code = " + task.Result.code);
                await MqttMgr.Inst.PublishAsync(topic + "/response", JsonSrialize.Srialize(task.Result));
            }
        }
Exemple #3
0
 public static void AfterFeature()
 {
     PageModelBase.CloseDownDriver();
 }
Exemple #4
0
 public static void BeforeFeature()
 {
     PageModelBase.InitialiseDriver();
 }
Exemple #5
0
 public static void BeforeScenario()
 {
     //Reset to initial URL
     PageModelBase.ReturnHome();
 }