Inheritance: IResolver
    public override Resolver ScanBarcode(Resolver resolver)
    {
        try
        {
            resolver.IsCSClient = true;
            resolver = TheResolverMgr.Resolve(resolver);

            //KSS 客户化,只有手持扫描枪需要B/S打印监控
            //if ((resolver.ModuleType == BusinessConstants.TRANSFORMER_MODULE_TYPE_SHIP || resolver.ModuleType == BusinessConstants.TRANSFORMER_MODULE_TYPE_SHIPORDER)
            //    && resolver.NeedPrintAsn && resolver.PrintUrl != null && resolver.PrintUrl.Trim() != string.Empty)
            //{
            //    //resolver.PrintUrl = null;
            //    InProcessLocation inProcessLocation = TheInProcessLocationMgr.LoadInProcessLocation(resolver.Code);
            //    inProcessLocation.IsPrinted = true;//to be refactored
            //    TheInProcessLocationMgr.UpdateInProcessLocation(inProcessLocation);
            //}
            return resolver;
        }
        catch (BusinessErrorException ex)
        {
            string exMessage = RenderingLanguage(ex.Message, resolver.UserCode, ex.MessageParams);
            throw new SoapException(exMessage, SoapException.ServerFaultCode, string.Empty);
        }
        catch (Exception ex)
        {
            throw new SoapException(ex.Message, SoapException.ServerFaultCode, string.Empty);
        }
    }
 protected override void SetDetail(Resolver resolver)
 {
     LocationLotDetail locationLotDetail = locationLotDetailMgrE.CheckLoadHuLocationLotDetail(resolver.Input, resolver.UserCode);
     TransformerDetail transformerDetail = TransformerHelper.ConvertLocationLotDetailToTransformerDetail(locationLotDetail, false);
     resolver.AddTransformerDetail(transformerDetail);
     resolver.Command = BusinessConstants.CS_BIND_VALUE_TRANSFORMERDETAIL;
 }
Example #3
0
        //private static readonly string openDnsResolver2 = "208.67.220.220";
        /// <summary>
        /// Resolves the IP address of the specified hostname.
        /// </summary>
        /// <param name="hostname">The hostname.</param>
        /// <returns>IPAddress instance.</returns>
        public IPAddress ResolveHostnameIP(string hostname)
        {
            if (!NetworkInterface.GetIsNetworkAvailable())
            {
                throw new ApplicationException(Text.Error_NoNetwork);
            }

            Resolver resolver = new Resolver(openDnsResolver1);
            IPHostEntry host = resolver.GetHostEntry(hostname);

            if (host == null || host.AddressList == null || host.AddressList.Length <= 0)
            {
                throw new ApplicationException(string.Format(Text.Error_CantResolveHostnameIP, hostname));
            }

            IPAddress result = host
                .AddressList
                .FirstOrDefault(ip => ip.AddressFamily == AddressFamily.InterNetwork);

            if (result == null)
            {
                throw new ApplicationException(string.Format(Text.Error_CantResolveHostnameIP, hostname));
            }

            log.DebugFormat(Text.Debug_ResolvedHostname, hostname, result.ToString());

            return result;
        }
        public void FillResolverByASN(Resolver resolver)
        {
            User user = userMgrE.CheckAndLoadUser(resolver.UserCode);
            InProcessLocation inProcessLocation = inProcessLocationMgrE.CheckAndLoadInProcessLocation(resolver.Input);

            //if (!user.HasPermission(inProcessLocation.PartyFrom.Code) ||
            //    !user.HasPermission(inProcessLocation.PartyTo.Code))
            //{
            //    throw new BusinessErrorException("Common.Business.Error.NoPermission");
            //}

            #region CopyProperty from ASN
            resolver.Code = inProcessLocation.IpNo;
            resolver.Status = inProcessLocation.Status;
            //resolver.IsDetailContainHu = inProcessLocation.IsDetailContainHu;
            resolver.IsScanHu = inProcessLocation.IsReceiptScanHu;
            if (inProcessLocation.InProcessLocationDetails != null && inProcessLocation.InProcessLocationDetails.Count > 0)
            {
                OrderHead orderHead =  inProcessLocation.InProcessLocationDetails[0].OrderLocationTransaction.OrderDetail.OrderHead;
                resolver.AntiResolveHu = orderHead.AntiResolveHu;
                resolver.FulfillUnitCount = orderHead.FulfillUnitCount;
                resolver.AllowExceed = orderHead.AllowExceed;
            }
            resolver.PickBy = inProcessLocation.IsDetailContainHu ? BusinessConstants.CODE_MASTER_PICKBY_HU : BusinessConstants.CODE_MASTER_PICKBY_ITEM;
            //resolver.PickBy = inProcessLocation.IsReceiptScanHu ? BusinessConstants.CODE_MASTER_PICKBY_HU : BusinessConstants.CODE_MASTER_PICKBY_ITEM;
            resolver.OrderType = inProcessLocation.OrderType;

            //resolver.AntiResolveHu = 
            #endregion
        }
Example #5
0
 protected override void ExecuteSubmit(Resolver resolver)
 {
     User user = userMgr.LoadUser(resolver.UserCode, false, true);
     IList<CycleCountDetail> cycleCountDetailList = this.ConvertResolverToCycleCountDetail(resolver);
     if (resolver.CodePrefix == BusinessConstants.CODE_PREFIX_CYCCNT)
     {
         cycleCountMgr.RecordCycleCountDetail(resolver.Code, cycleCountDetailList, user);
         resolver.Result = languageMgr.TranslateMessage("CycCnt.Process.Successfully", resolver.UserCode);
         resolver.Transformers = null;
         resolver.Command = BusinessConstants.CS_BIND_VALUE_TRANSFORMER;
         resolver.BinCode = null;
         resolver.LocationCode = null;
     }
     //else if (resolver.LocationCode != null && resolver.LocationCode.Trim() != string.Empty)
     //{
     //    if (resolver.BinCode != null && resolver.BinCode.Trim() != string.Empty)
     //    {
     //        StorageBin bin = storageBinMgr.CheckAndLoadStorageBin(resolver.BinCode);
     //        cycleCountMgr.CreateCycleCount(bin, cycleCountDetailList, user);
     //    }
     //    else
     //    {
     //        Location location = locationMgr.CheckAndLoadLocation(resolver.LocationCode);
     //        cycleCountMgr.CreateCycleCount(location, cycleCountDetailList, user);
     //    }
     //}
     else
     {
         throw new BusinessErrorException("Common.Business.Error.ScanFlowOrStorageBinFirst");
     }
 }
 public override void Resolve(Resolver resolver)
 {
     paramBindings = new List<Binding>(generator.ParamKeys.Count);
     foreach (var key in generator.ParamKeys) {
         paramBindings.Add(resolver.RequestBinding(key, generator.ProviderMethod.FullName));
     }
 }
        protected void ResolveInput(string input, bool bind)
        {
            CacheResolver.Input = input;
            CacheResolver = TheResolverMgr.Resolve(this.CacheResolver);

            if (bind) Bind();
        }
Example #8
0
        private void WriteToDisk(IExpression expression, Resolver resolver)
        {
            var name = "Output.exe";

            var assemblyName = new AssemblyName(name);

            var assemblyBuilder = AppDomain.CurrentDomain.DefineDynamicAssembly(
                assemblyName,
                AssemblyBuilderAccess.RunAndSave
            );

            var moduleBuilder = assemblyBuilder.DefineDynamicModule(name);

            var programClass = moduleBuilder.DefineType("Program", TypeAttributes.Public);

            var mainMethod = programClass.DefineMethod("Main", MethodAttributes.Public | MethodAttributes.Static, null, new[] { typeof(string[]) });

            var il = mainMethod.GetILGenerator();

            new Compiler(il, resolver).Compile(expression);

            programClass.CreateType();

            assemblyBuilder.SetEntryPoint(programClass.GetMethod("Main"));
            assemblyBuilder.Save(name);
        }
Example #9
0
        public void CreateRepack(Resolver resolver)
        {
            IList<RepackDetail> repackDetailList = executeMgr.ConvertTransformerListToRepackDetail(resolver.Transformers);
            if (repackDetailList.Count == 0)
            {
                throw new BusinessErrorException("MasterData.Inventory.Repack.Error.RepackDetailEmpty");
            }
            Repack repack = repackMgr.CreateRepack(repackDetailList, userMgr.LoadUser(resolver.UserCode, false, true));
            resolver.Code = repack.RepackNo;
            resolver.Transformers = null;
            resolver.Command = BusinessConstants.CS_BIND_VALUE_TRANSFORMERDETAIL;
            resolver.Result = languageMgr.TranslateMessage("MasterData.Inventory.Repack.Successfully", resolver.UserCode);

            #region 打印
            if (resolver.IsCSClient)
            {
                IList<Hu> huList = new List<Hu>();
                repack = repackMgr.LoadRepack(resolver.Code, true);
                foreach (RepackDetail repackDet in repack.RepackDetails)
                {
                    if (repackDet.IOType == BusinessConstants.IO_TYPE_OUT && repackDet.LocationLotDetail.Hu != null
                        && repackDet.LocationLotDetail.Hu.PrintCount == 0)
                    {
                        huList.Add(repackDet.LocationLotDetail.Hu);
                    }
                }
                resolver.PrintUrl = PrintHu(huList,resolver.UserCode);
            }
            #endregion
        }
Example #10
0
 protected override void SetDetail(Resolver resolver)
 {
     List<string> flowTypes = new List<string>();
     flowTypes.Add(BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_PRODUCTION);
     bool isHaslocationLotDetail = locationLotDetailMgrE.CheckHuLocationExist(resolver.Input);
     if (!isHaslocationLotDetail)
     {
         throw new BusinessErrorException("Hu.Error.NoInventory", resolver.Input);
     }
     Hu hu = huMgrE.CheckAndLoadHu(resolver.Input);
     FlowView flowView = null;
     //如果是扫描Bin,根据Hu和Bin匹配出flow
     if (resolver.CodePrefix == null || resolver.CodePrefix.Trim() == string.Empty)
     {
         //确定flow和flowView
         flowView = flowMgrE.CheckAndLoadFlowView(null, resolver.UserCode, string.Empty, null, hu, flowTypes);
         setBaseMgrE.FillResolverByFlow(resolver, flowView.Flow);
     }
     //如果已经确定了Flow
     else
     {
         //根据Flow和Hu匹配出flowView
         flowView = flowMgrE.CheckAndLoadFlowView(resolver.Code, null, null, null, hu, flowTypes);
     }
     setDetailMgrE.MatchHuByFlowView(resolver, flowView, hu);
 }
 public void CancelRepackOperation(Resolver resolver)
 {
     if (resolver.Transformers.Count == 2)
     {
         if (resolver.Transformers[1].TransformerDetails != null && resolver.Transformers[1].TransformerDetails.Count > 0)
         {
             //resolver.Transformers[1].TransformerDetails = null;
             int maxSeq = setDetailMgrE.FindMaxSeq(resolver.Transformers[1]);
             resolver.Transformers[1].TransformerDetails.RemoveAt(maxSeq);
             resolver.IOType = BusinessConstants.IO_TYPE_OUT;
         }
         else if ((resolver.Transformers[1].TransformerDetails == null || resolver.Transformers[1].TransformerDetails.Count == 0)
             && resolver.IOType == BusinessConstants.IO_TYPE_OUT && resolver.ModuleType == BusinessConstants.TRANSFORMER_MODULE_TYPE_REPACK)
         {
             resolver.IOType = BusinessConstants.IO_TYPE_IN;
         }
         else if (resolver.Transformers[0].TransformerDetails != null && resolver.Transformers[0].TransformerDetails.Count > 0)
         {
             //resolver.Transformers[0].TransformerDetails = null;
             //resolver.Transformers[1].TransformerDetails = null;
             int maxSeq = setDetailMgrE.FindMaxSeq(resolver.Transformers[0]);
             resolver.Transformers[0].TransformerDetails.RemoveAt(maxSeq);
             resolver.IOType = BusinessConstants.IO_TYPE_IN;
         }
     }
 }
 /// <summary>
 /// 只有发货扫描条码才支持不扫物流路线,扫描库格移库
 /// </summary>
 /// <param name="resolver"></param>
 protected override void SetDetail(Resolver resolver)
 {
     List<string> flowTypes = new List<string>();
     flowTypes.Add(BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_TRANSFER);
     Hu hu = huMgrE.CheckAndLoadHu(resolver.Input);
     if (this.locationMgrE.IsHuOcuppyByPickList(resolver.Input))
     {
         throw new BusinessErrorException("Order.Error.PickUp.HuOcuppied", resolver.Input);
     }
     FlowView flowView = null;
     if (resolver.CodePrefix != null && resolver.CodePrefix.Trim() != string.Empty)
     {
         flowView = flowMgrE.CheckAndLoadFlowView(resolver.Code, null, null, null, hu, flowTypes);
     }
     else
     {
         if (resolver.BinCode == string.Empty)
         {
             throw new BusinessErrorException("Common.Business.Error.ScanFlowOrStorageBinFirst");
         }
         else
         {
             flowView = flowMgrE.CheckAndLoadFlowView(null, resolver.UserCode, hu.Location, resolver.LocationToCode, hu, flowTypes);
             setBaseMgrE.FillResolverByFlow(resolver, flowView.Flow);
         }
     }
     setDetailMgrE.MatchHuByFlowView(resolver, flowView, hu);
 }
Example #13
0
 protected override void ExecuteSubmit(Resolver resolver)
 {
     IList<Hu> huList = new List<Hu>();
     if (resolver.Transformers != null)
     {
         foreach (Transformer transformer in resolver.Transformers)
         {
             if (transformer.TransformerDetails != null)
             {
                 foreach (TransformerDetail transformerDetail in transformer.TransformerDetails)
                 {
                     Hu hu = huMgrE.LoadHu(transformerDetail.HuId);
                     huList.Add(hu);
                 }
             }
         }
     }
     if (huList.Count > 0)
     {
         orderMgrE.CreateOrder(resolver.Code, resolver.UserCode, huList);
         resolver.Result = languageMgrE.TranslateMessage("Order.Reuse.Successfully", resolver.UserCode);
         resolver.Transformers = null;
         resolver.Command = BusinessConstants.CS_BIND_VALUE_TRANSFORMER;
     }
     else
     {
         throw new BusinessErrorException("Common.Business.Error.OprationFailed");
     }
 }
		public CodeAssistanceContextProvider(Scope scope, string source)
		{
			_scope = scope;
			_completionParser = new CompletionParser(_errorReporter, source);
			_resolver = new Resolver(_errorReporter, _scope);
		    _normalizer = new Normalizer();
		}
        public AGSCheckBox(string id, Resolver resolver) : base(id, resolver)
        {            
            _uIEvents = AddComponent<IUIEvents>();            
            _skinComponent = AddComponent<ISkinComponent>();            
            _hasRoom = AddComponent<IHasRoom>();            
            _animationContainer = AddComponent<IAnimationContainer>();            
            _inObjectTree = AddComponent<IInObjectTree>();            
            _collider = AddComponent<ICollider>();            
            _visibleComponent = AddComponent<IVisibleComponent>();            
            _enabledComponent = AddComponent<IEnabledComponent>();            
            _customProperties = AddComponent<ICustomPropertiesComponent>();            
            _drawableInfo = AddComponent<IDrawableInfo>();            
            _hotspotComponent = AddComponent<IHotspotComponent>();            
            _shaderComponent = AddComponent<IShaderComponent>();            
            _translateComponent = AddComponent<ITranslateComponent>();            
            _imageComponent = AddComponent<IImageComponent>();            
            _scaleComponent = AddComponent<IScaleComponent>();            
            _rotateComponent = AddComponent<IRotateComponent>();            
            _pixelPerfectComponent = AddComponent<IPixelPerfectComponent>();            
            _textComponent = AddComponent<ITextComponent>();            
            _checkboxComponent = AddComponent<ICheckboxComponent>();
			beforeInitComponents(resolver);            
			InitComponents();
            afterInitComponents(resolver);            
        }
Example #16
0
        static DNSManager()
        {
            try
            {
                IPEndPoint[] osDNSServers = Resolver.GetDnsServers();
                if (osDNSServers != null && osDNSServers.Length > 0)
                {
                    logger.Debug("Initialising DNS resolver with operating system DNS server entries.");
                    m_resolver = new Resolver(osDNSServers);
                }
                else
                {
                    logger.Debug("Initialising DNS resolver with OpenDNS server entries.");
                    m_resolver = new Resolver(Resolver.DefaultDnsServers.ToArray());
                }
                //m_resolver.Recursion = true;
                //m_resolver.UseCache = false;

                for (int index = 0; index < NUMBER_LOOKUP_THREADS; index++)
                {
                    Thread lookupThread = new Thread(new ThreadStart(ProcessLookups));
                    lookupThread.Name = LOOKUP_THREAD_NAME + "-" + index.ToString();
                    lookupThread.Start();
                }
            }
            catch (Exception excp)
            {
                logger.Error("Exception DNSManager (static ctor). " + excp);
            }
        }
        public AGSCharacter(string id, Resolver resolver, IOutfit outfit) : base(id, resolver)
        {            
            _hasRoom = AddComponent<IHasRoom>();            
            _animationContainer = AddComponent<IAnimationContainer>();            
            _inObjectTree = AddComponent<IInObjectTree>();            
            _collider = AddComponent<ICollider>();            
            _visibleComponent = AddComponent<IVisibleComponent>();            
            _enabledComponent = AddComponent<IEnabledComponent>();            
            _customProperties = AddComponent<ICustomPropertiesComponent>();            
            _drawableInfo = AddComponent<IDrawableInfo>();            
            _hotspotComponent = AddComponent<IHotspotComponent>();            
            _shaderComponent = AddComponent<IShaderComponent>();            
            _transformComponent = AddComponent<ITranslateComponent>();            
            _imageComponent = AddComponent<IImageComponent>();            
            _scaleComponent = AddComponent<IScaleComponent>();            
            _rotateComponent = AddComponent<IRotateComponent>();            
            _pixelPerfectComponent = AddComponent<IPixelPerfectComponent>();            
            _faceDirectionBehavior = AddComponent<IFaceDirectionBehavior>();            
            _hasOutfit = AddComponent<IHasOutfit>();            
            _hasInventory = AddComponent<IHasInventory>();            
            _followBehavior = AddComponent<IFollowBehavior>();
			beforeInitComponents(resolver, outfit);            
			InitComponents();
            afterInitComponents(resolver, outfit);            
        }
Example #18
0
        public StopSpider(IPAddress providerDNS, IPAddress censorRedirect, string provider, string country, string reporter)
        {
            // initiate spiderlist

            this.providerDNS = providerDNS;
            this.censorRedirect = censorRedirect;
            this.provider = provider;
            this.country = country;
            this.reporter = reporter;
            this.openDnsResolver = new Resolver(Resolver.DefaultDnsServers[0]);

            // add an initial list in randomized order, this will also prevent adding already known urls!
            SortedList<int, string> rlist = new SortedList<int, string>();
            TextReader inputurls = new StreamReader(Assembly.GetExecutingAssembly().GetManifestResourceStream("shortlist.txt"));
            string url; Random r = new Random();
            while ((url = inputurls.ReadLine()) != null)
            {
                rlist.Add(r.Next(), url);
            }

            foreach (string uri in rlist.Values)
            {
                spiderlist.Add(new SpiderInfo(uri, 0));
                spidercheck.Add(uri, true);
            }
        }
 protected override void SetBaseInfo(Resolver resolver)
 {
     if (resolver.CodePrefix == BusinessConstants.CODE_PREFIX_INSPECTION)
     {
         InspectOrder inspectOrder = inspectOrderMgrE.CheckAndLoadInspectOrder(resolver.Input);
         if (inspectOrder.Status != BusinessConstants.CODE_MASTER_STATUS_VALUE_CREATE)
         {
             throw new BusinessErrorException("InspectOrder.Error.StatusIsNotValid", resolver.Input, inspectOrder.Status);
         }
         resolver.Code = inspectOrder.InspectNo;
         resolver.IsScanHu = inspectOrder.IsDetailHasHu;
         resolver.Status = inspectOrder.Status;
         if (resolver.IsScanHu)
         {
             resolver.PickBy = BusinessConstants.CODE_MASTER_PICKBY_HU;
         }
         else
         {
             resolver.PickBy = BusinessConstants.CODE_MASTER_PICKBY_ITEM;
         }
     }
     else
     {
         throw new BusinessErrorException("Common.Business.Error.BarCodeInvalid");
     }
 }
 protected override void GetDetail(Resolver resolver)
 {
     InspectOrder inspectOrder = inspectOrderMgrE.LoadInspectOrder(resolver.Code, true);
     resolver.Transformers = TransformerHelper.ConvertInspectDetailToTransformer(inspectOrder.InspectOrderDetails);
     resolver.Command = BusinessConstants.CS_BIND_VALUE_TRANSFORMER;
     resolver.Result = languageMgrE.TranslateMessage("MasterData.Inventory.CurrentInspectOrder", resolver.UserCode, resolver.Code);
 }
 protected override void SetDetail(Resolver resolver)
 {
     if (resolver.CodePrefix == string.Empty)
     {
         throw new BusinessErrorException("Common.Business.Error.ScanProductLineFirst");
     }
 }
Example #22
0
 public void PickList(Resolver resolver)
 {
     PickList pickList = pickListMgrE.CheckAndLoadPickList(resolver.Code);
     pickList.PickListDetails = new List<PickListDetail>();
     if (resolver.Transformers != null)
     {
         foreach (Transformer transformer in resolver.Transformers)
         {
             PickListDetail pickListDetail = pickListDetailMgrE.LoadPickListDetail(transformer.Id, true);
             if (transformer != null)
             {
                 foreach (TransformerDetail transformerDetail in transformer.TransformerDetails)
                 {
                     if (transformerDetail != null && transformerDetail.HuId != null && transformerDetail.HuId != string.Empty
                         && transformerDetail.CurrentQty != 0)
                     {
                         PickListResult pickListResult = new PickListResult();
                         //pickListResult.LocationLotDetail = locationLotDetailMgrE.LoadLocationLotDetail(transformerDetail.LocationLotDetId);
                         pickListResult.LocationLotDetail = locationLotDetailMgrE.CheckLoadHuLocationLotDetail(transformerDetail.HuId);
                         pickListResult.PickListDetail = pickListDetail;
                         pickListResult.Qty = transformerDetail.CurrentQty * pickListDetail.OrderLocationTransaction.UnitQty;
                         pickListDetail.AddPickListResult(pickListResult);
                     }
                 }
             }
             pickList.AddPickListDetail(pickListDetail);
         }
     }
     pickListMgrE.DoPick(pickList, resolver.UserCode);
     resolver.Result = languageMgrE.TranslateMessage("MasterData.PickList.Pick.Successfully", resolver.UserCode, resolver.Code);
     resolver.Transformers = null;
     resolver.Command = BusinessConstants.CS_BIND_VALUE_TRANSFORMER;
 }
 public void Process(Resolver resolver)
 {
     if (!dicBarcodeHead.ContainsKey(resolver.BarcodeHead))
     {
         throw new BusinessErrorException("Common.Business.Error.BarCodeInvalid");
     }
     switch (dicBarcodeHead[resolver.BarcodeHead])
     {
         case 1:
             SetBaseInfo(resolver);
             GetDetail(resolver);
             break;
         case 2:
             Execute(resolver);
             break;
         case 3:
             GetReceiptNotes(resolver);
             break;
         case 4:
             SetBaseInfo(resolver);
             break;
         default:
             resolver.Input = resolver.Input;
             SetDetail(resolver);//Hu,match or add
             break;
     }
 }
 protected override void SetDetail(Resolver resolver)
 {
     if (resolver.CodePrefix == string.Empty)
     {
         throw new BusinessErrorException("Common.Business.Error.ScanFlowFirst");
     }
     setDetailMgrE.MatchInspet(resolver);
 }
 protected override void SetBaseInfo(Resolver resolver)
 {
     setBaseMgrE.FillResolverByFlow(resolver);
     if (resolver.OrderType != BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_PRODUCTION)
     {
         throw new BusinessErrorException("Flow.ShipReturn.Error.FlowTypeIsNotDistribution", resolver.OrderType);
     }
 }
Example #26
0
        protected override void GetDetail(Resolver resolver)
        {
            PickList pickList = pickListMgrE.LoadPickList(resolver.Input, true, true);

            resolver.Transformers = TransformerHelper.ConvertPickListDetailsToTransformers(pickList.PickListDetails);
            resolver.Result = languageMgrE.TranslateMessage("Common.Business.PickList", resolver.UserCode) + ":" + resolver.Code;
            resolver.Command = BusinessConstants.CS_BIND_VALUE_TRANSFORMER;
        }
Example #27
0
 public void Given_Resolver_When_Print_Then_ItShouldFindAppropriateType()
 {
     var resolver=new Resolver();
     
     var print = new Print(resolver.ResolvePrinterType());
     string printedText = print.print();
     Assert.Pass(printedText);
 }
 protected override void ExecuteSubmit(Resolver resolver)
 {
     IList<InspectOrderDetail> repackDetailList = executeMgrE.ConvertResolverToInspectOrderDetails(resolver);
     inspectOrderMgrE.ProcessInspectOrder(repackDetailList, resolver.UserCode);
     resolver.Result = languageMgrE.TranslateMessage("MasterData.InspectOrder.Process.Successfully", resolver.UserCode, resolver.Code);
     resolver.Transformers = null;
     resolver.Command = BusinessConstants.CS_BIND_VALUE_TRANSFORMER;
 }
 protected override void ExecuteSubmit(Resolver resolver)
 {
     IList<MaterialIn> materialInList = executeMgrE.ConvertTransformersToMaterialIns(resolver.Transformers);
     productLineInProcessLocationDetailMgrE.RawMaterialIn(resolver.Code, materialInList, userMgrE.CheckAndLoadUser(resolver.UserCode));
     resolver.Transformers = null;
     resolver.Result = languageMgrE.TranslateMessage("MasterData.MaterialIn.Successfully", resolver.UserCode, resolver.Code);
     resolver.Command = BusinessConstants.CS_BIND_VALUE_TRANSFORMER;
 }
Example #30
0
        public Compiler(ILGenerator il, Resolver resolver)
        {
            Require.NotNull(il, "il");
            Require.NotNull(resolver, "resolver");

            _il = il;
            _resolver = resolver;
        }
Example #31
0
        public SettingsHelpPage()
        {
            _googleAnalyticsService = Resolver.Resolve <IGoogleAnalyticsService>();

            Init();
        }
Example #32
0
        public Boolean Init()
        {
            this.Hostname = Util.checkregstring("HKLM", @"SOFTWARE\dagent\messagebroker", "hostname", this.Hostname);
            this.Password = Util.checkregstring("HKLM", @"SOFTWARE\dagent\messagebroker", "password", this.Password);
            this.Username = Util.checkregstring("HKLM", @"SOFTWARE\dagent\messagebroker", "username", this.Username);
            this.UUID     = Util.checkregstring("HKLM", @"SOFTWARE\dagent\messagebroker", "uuid", this.UUID);
            this.Port     = Util.checkregint("HKLM", @"SOFTWARE\dagent\messagebroker", "port", this.Port);
            this.Vhost    = Util.checkregstring("HKLM", @"SOFTWARE\dagent\messagebroker", "vhost", this.Vhost);
            this.RootKey  = Util.checkregstring("HKLM", @"SOFTWARE\dagent\messagebroker", "rootkey", this.RootKey);

            /*
             * Look for TXT records defining all the possible access methods which are available.
             */
            Resolver Resolver = new Resolver();
            Response response = Resolver.Query(this.Hostname, QType.TXT, QClass.ANY);
            LinkedList <Connector> AnyConnector      = new LinkedList <Connector>();
            LinkedList <Connector> MacConnector      = new LinkedList <Connector>();
            LinkedList <Connector> RouterIPConnector = new LinkedList <Connector>();

            foreach (AnswerRR answerRR in response.Answers)
            {
                switch (answerRR.Type)
                {
                case Heijden.DNS.Type.TXT:
                    String[] strippedresponse = answerRR.RECORD.ToString().Split('\"');
                    String[] value            = strippedresponse[1].Split('!');
                    if (value[0].ToLower().Equals("dagent"))
                    {
                        switch (value[1].ToLower())
                        {
                        case "connector":
                            Connector conn = new Connector(value, 2);
                            Util.log(this.ToString(), 99, conn.ToString());
                            switch (conn.Match)
                            {
                            case "any":
                                AnyConnector.AddLast(conn);
                                break;
                            }
                            break;

                        case "rootkey":
                            break;
                        }
                    }
                    break;
                }
            }

            /*
             * Fallback method to use DNS A Records
             */
            if (this._connection == null)
            {
                IPHostEntry ipentry = Dns.GetHostEntry(this.Hostname);
                foreach (IPAddress ip in ipentry.AddressList)
                {
                    try
                    {
                        Util.log(this.ToString(), 99, "Attempting connection to " + ip.ToString() + ":" + this.Port.ToString());
                        var factory = new ConnectionFactory()
                        {
                            HostName    = ip.ToString(),
                            Password    = this.Password,
                            UserName    = this.Username,
                            Port        = this.Port,
                            VirtualHost = this.Vhost
                        };
                        this._connection = factory.CreateConnection();
                        break;
                    }
                    catch (Exception e)
                    {
                        Util.log(this.ToString(), 1, e.ToString());
                    }
                }
                if (this._connection == null)
                {
                    Util.log(this.ToString(), 0, "Unable to connect to " + this.Hostname);
                    return(false);
                }

                this.persistant = this.NewChannel();
                String queuename = "persist." + this.UUID + ".control";
                this.persistant.QueueDeclare(queuename, true);
                this.persistant.QueueBind(queuename, "dagent.control", "");
                return(true);
            }
            return(false);
        }
Example #33
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AcceleratorSensorPage"/> class.
        /// </summary>
        public GyroscopePage()
        {
            var device = Resolver.Resolve <IDevice> ();

            if (device != null && device.Gyroscope != null)
            {
                this.gyroscope = device.Gyroscope;
            }
            else
            {
                this.gyroscope = Resolver.Resolve <IGyroscope>() ?? DependencyService.Get <IGyroscope>();
            }

            if (gyroscope == null)
            {
                Content = new Label()
                {
                    TextColor = Color.Red,
                    Text      = "Device does not have gyroscope sensor or it is not enabled."
                };

                return;
            }

            Title = "Accelerator Sensor";

            var grid = new StackLayout();

            this.xsensor = new SensorBarView()
            {
                HeightRequest        = 75,
                WidthRequest         = 250,
                MinimumHeightRequest = 10,
                MinimumWidthRequest  = 50,
                BackgroundColor      = BackgroundColor
//                VerticalOptions = LayoutOptions.Fill,
//                HorizontalOptions = LayoutOptions.Fill
            };

            this.ysensor = new SensorBarView()
            {
                HeightRequest        = 75,
                WidthRequest         = 250,
                MinimumHeightRequest = 10,
                MinimumWidthRequest  = 50,
                BackgroundColor      = BackgroundColor
//                VerticalOptions = LayoutOptions.Fill,
//                HorizontalOptions = LayoutOptions.Fill
            };

            this.zsensor = new SensorBarView()
            {
                HeightRequest        = 75,
                WidthRequest         = 250,
                MinimumHeightRequest = 10,
                MinimumWidthRequest  = 50,
                BackgroundColor      = BackgroundColor
//                VerticalOptions = LayoutOptions.Fill,
//                HorizontalOptions = LayoutOptions.Fill
            };


            grid.Children.Add(new Label()
            {
                Text = string.Format("Accelerometer data for {0}", device.Name)
            });
            grid.Children.Add(new Label()
            {
                Text = "X", XAlign = TextAlignment.Center
            });
            grid.Children.Add(this.xsensor);
            grid.Children.Add(new Label()
            {
                Text = "Y", XAlign = TextAlignment.Center
            });
            grid.Children.Add(this.ysensor);
            grid.Children.Add(new Label()
            {
                Text = "Z", XAlign = TextAlignment.Center
            });
            grid.Children.Add(this.zsensor);

            Content = grid;
        }
Example #34
0
 protected override void GetDetail(Resolver resolver)
 {
     //IList<CycleCountDetail> cycleCountDetailList = cycleCountDetailMgr.GetCycleCountDetail(resolver.Code);
     resolver.Transformers = null;
 }
Example #35
0
 public T Get <T>()
 {
     return(GetOrCreate(typeof(T).FullName, () => Resolver.Resolve <T>()));
 }
Example #36
0
        protected override void SetBaseInfo(Resolver resolver)
        {
            if (resolver.ModuleType == BusinessConstants.TRANSFORMER_MODULE_TYPE_HUSTATUS)
            {
                return;
            }
            if (resolver.BarcodeHead == BusinessConstants.CODE_PREFIX_CYCCNT)
            {
                CycleCount cycleCount = cycleCountMgr.CheckAndLoadCycleCount(resolver.Input);

                resolver.Code          = cycleCount.Code;
                resolver.Description   = StringHelper.GetCodeDescriptionString(cycleCount.Location.Code, cycleCount.Location.Name);
                resolver.Status        = cycleCount.Status;
                resolver.OrderType     = cycleCount.Type;
                resolver.IsScanHu      = cycleCount.IsScanHu;
                resolver.LocationCode  = cycleCount.Location.Code;
                resolver.Result        = resolver.Description;
                resolver.IsPickFromBin = cycleCount.Location.EnableAdvWM;
                if (!resolver.IsScanHu)
                {
                    throw new BusinessErrorException("CycCnt.Error.IsNotScanHu");
                }

                resolver.WorkingHours = new List <string[]>();
                if (cycleCount.Items != null && cycleCount.Items != string.Empty)
                {
                    resolver.WorkingHours.Add(cycleCount.Items.Split('|'));
                }
                else
                {
                    resolver.WorkingHours.Add(new string[] { });
                }
                if (cycleCount.Bins != null && cycleCount.Bins != string.Empty)
                {
                    resolver.WorkingHours.Add(cycleCount.Bins.Split('|'));
                }
                else
                {
                    resolver.WorkingHours.Add(new string[] { });
                }

                resolver.Command = BusinessConstants.CS_BIND_VALUE_TRANSFORMER;

                if (resolver.Status != BusinessConstants.CODE_MASTER_STATUS_VALUE_INPROCESS)
                {
                    throw new BusinessErrorException("Common.Business.Error.StatusError", resolver.Code, resolver.Status);
                }
            }
            else if (resolver.BarcodeHead == BusinessConstants.BARCODE_HEAD_BIN)
            {
                if (resolver.Code == null || resolver.Code == string.Empty)
                {
                    throw new BusinessErrorException("CycCnt.Error.ScanCycCountFirst");
                }
                //if (!resolver.IsPickFromBin)
                //{
                //    //没有启用高位货架,不用扫描库格
                //    throw new BusinessErrorException("CycCnt.Error.NotEnableAdvWM");
                //}
                IList <StorageBin> storageBinList = storageBinMgr.GetStorageBinByLocation(resolver.LocationCode);
                setBaseMgr.FillResolverByBin(resolver);

                //CycleCount cycleCount = cycleCountMgr.CheckAndLoadCycleCount(resolver.Code);
                var bins = storageBinList.Select(s => s.Code);
                if (!bins.Contains(resolver.BinCode))
                {
                    //库格没有在盘点库位上面
                    throw new BusinessErrorException("CycCnt.Error.BinNotInLocation");
                }
                if (resolver.WorkingHours != null && resolver.WorkingHours.Count == 2)
                {
                    if (resolver.WorkingHours[1] != null && resolver.WorkingHours[1].Length > 0 &&
                        !resolver.WorkingHours[1].Contains(resolver.BinCode))
                    {
                        if (resolver.WorkingHours[1].Length > 0)
                        {
                            throw new BusinessErrorException("CycCnt.Error.NotContainTheBin");
                        }
                    }
                }
                else
                {
                    throw new BusinessErrorException("CycCnt.Error");
                }
            }

            //else if (resolver.BarcodeHead == BusinessConstants.BARCODE_HEAD_LOCATION)
            //{
            //    if (resolver.LocationCode != null && resolver.LocationCode.Trim() != string.Empty)
            //    {
            //        throw new BusinessErrorException("CycCnt.Please.ScanHu");
            //    }
            //    setBaseMgr.FillResolverByLocation(resolver);
            //    resolver.IsScanHu = true;
            //    resolver.BinCode = null;
            //}
            else
            {
                throw new BusinessErrorException("Common.Business.Error.BarCodeInvalid");
            }
        }
Example #37
0
 public void resolving_func_of_enums()
 {
     Resolver.AddDependency <Simple>();
     Should.NotThrow(() => Resolver.Resolve <Func <IEnumerable <Simple> > >()().ShouldHaveSingleItem().ShouldNotBeNull());
 }
 /// <summary>
 /// Register an plugin to be used in this configuration.
 /// </summary>
 /// <param name="key">The key used to identify the plugin.</param>
 /// <param name="pluginType">The plugin type to be added.</param>
 public void AddPlugin(string key, Type pluginType)
 {
     _plugins[key] = new PluginRegistration(key, GetPriority(pluginType), new Lazy <IEventPlugin>(() => Resolver.Resolve(pluginType) as IEventPlugin));
 }
Example #39
0
 public StationReadModelTests()
 {
     _stationsReadModel = Resolver.Resolve <IInMemoryReadStore <StationsReadModel> >();
 }
Example #40
0
 private ContentResolver() {
    this.list = new Resolver<ContentType>();
 }
Example #41
0
 public AGSEmptyEntity(string id, Resolver resolver) : base(id, resolver)
 {
     InitComponents();
 }
 protected override void SetBaseInfo(Resolver resolver)
 {
 }
Example #43
0
            public bool TryConvert(object from, out T result)
            {
                if (from == null)
                {
                    result = default(T);
                    return(false);
                }

                try
                {
                    if (_resolvedToType != null)
                    {
                        return(TryConvertResolvedTo(from, out result));
                    }

                    TypeConverter fromConverter = TypeDescriptor.GetConverter(from);
                    if (fromConverter.CanConvertTo(_toType))
                    {
                        result = (T)fromConverter.ConvertTo(from, _toType);
                        return(true);
                    }

                    //Use TryConvert for misc types when fromType is string:
                    if (from is string)
                    {
                        if (_toType == typeof(double))
                        {
                            double d;
                            var    numberStyle = NumberStyles.AllowDecimalPoint | NumberStyles.AllowLeadingWhite |
                                                 NumberStyles.AllowTrailingWhite;
                            if (double.TryParse((string)from, numberStyle, CultureInfo.InvariantCulture, out d))
                            {
                                result = (T)(object)d;
                                return(true);
                            }
                        }
                    }

                    Type          fromType    = from.GetType();
                    TypeConverter toConverter = TypeDescriptor.GetConverter(_toType);
                    if (toConverter.CanConvertFrom(fromType))
                    {
                        result = (T)toConverter.ConvertFrom(from);
                        return(true);
                    }

                    //Try to use ConvertTo. If that fails, resolve the object-type, and try to convert to that type.
                    try
                    {
                        result = ConvertTo(from);
                    }
                    catch (InvalidCastException)
                    {
                        object o = Resolver.Resolve <T>(null, null);
                        if (o == null)
                        {
                            throw;
                        }
                        _resolvedToType = o.GetType();
                        return(TryConvertResolvedTo(from, out result));
                    }
                    return(true);
                }
#if DEBUG
                catch (Exception ex)
                {
                    Console.WriteLine("DEBUG: TryConvert failed to convert from {0} to {1}. Exception: {2}", from.GetType(), _toType, ex);
                }
#else
                catch { Exception }
#endif
                result = default(T);
                return(false);
            }
Example #44
0
 protected override void GetReceiptNotes(Resolver resolver)
 {
 }
 /// <summary>
 /// Register an enrichment to be used in this configuration.
 /// </summary>
 /// <param name="key">The key used to identify the enrichment.</param>
 /// <param name="enrichmentType">The enrichment type to be added.</param>
 public void AddEnrichment(string key, Type enrichmentType)
 {
     _enrichments[key] = new Lazy <IEventEnrichment>(() => Resolver.Resolve(enrichmentType) as IEventEnrichment);
 }
Example #46
0
        protected override void SetDetail(Resolver resolver)
        {
            #region Hu状态查询
            if (resolver.ModuleType == BusinessConstants.TRANSFORMER_MODULE_TYPE_HUSTATUS)
            {
                Hu hu = null;
                //检查库存
                LocationLotDetail locationLotDetail = locationLotDetailMgr.LoadHuLocationLotDetail(resolver.Input);
                if (locationLotDetail == null)//库存中没有,检查HuDet
                {
                    hu = huMgr.CheckAndLoadHu(resolver.Input);
                    //修正状态
                    if (hu.Status == BusinessConstants.CODE_MASTER_HU_STATUS_VALUE_INVENTORY)
                    {
                        hu.Status = "ERROR";
                    }
                }
                else
                {
                    hu = locationLotDetail.Hu;
                    //修正库位 数量
                    hu.Location = locationLotDetail.Location.Code;
                    hu.Qty      = locationLotDetail.Qty / hu.UnitQty;
                    if (hu.Status == BusinessConstants.CODE_MASTER_HU_STATUS_VALUE_INVENTORY)
                    {
                        if (this.locationMgr.IsHuOcuppyByPickList(resolver.Input))
                        {
                            hu.Status += languageMgr.TranslateMessage("MasterDate.PickList.Ocuppied", resolver.UserCode);
                        }
                    }
                }
                TransformerDetail transformerDetail = TransformerHelper.ConvertHuToTransformerDetail(hu);
                if (locationLotDetail != null && locationLotDetail.StorageBin != null)
                {
                    transformerDetail.StorageBinCode = locationLotDetail.StorageBin.Code;
                }
                resolver.Transformers = null;
                resolver.AddTransformerDetail(transformerDetail);
            }
            #endregion

            #region 盘点
            else
            {
                if (resolver.WorkingHours == null || resolver.WorkingHours.Count != 2)
                {
                    //出错
                    throw new BusinessErrorException("CycCnt.Error.ScanCycCountFirst");
                }
                if (resolver.LocationCode == null || resolver.LocationCode == string.Empty)
                {
                    throw new BusinessErrorException("CycCnt.Error.HasNoLocation");
                }
                //如果指定了库格或启用了高级仓库管理,需要先扫描库格.
                //if ((resolver.BinCode == null || resolver.BinCode == string.Empty)
                //    && (resolver.WorkingHours[1].Length > 0 || resolver.IsPickFromBin))
                //{
                //    throw new BusinessErrorException("CycCnt.Error.ScanStorageBinFirst");
                //}

                //检查当月盘点重复扫描
                this.cycleCountMgr.CheckHuExistThisCount(resolver.Input);
                Hu hu = huMgr.CheckAndLoadHu(resolver.Input);

                if (hu.Status == BusinessConstants.CODE_MASTER_HU_STATUS_VALUE_CLOSE)
                {
                    throw new BusinessErrorException("CycCnt.Error.HuStatusError", hu.Status);
                }

                if (resolver.WorkingHours[0].Length > 0 && !resolver.WorkingHours[0].Contains(hu.Item.Code))
                {
                    if (resolver.WorkingHours[0].Length > 0)
                    {
                        throw new BusinessErrorException("CycCnt.Error.NotContainTheItem");
                    }
                    else
                    {
                        //nothing todo
                    }
                }

                TransformerDetail transformerDetail = Utility.TransformerHelper.ConvertHuToTransformerDetail(hu);
                transformerDetail.StorageBinCode = resolver.BinCode;
                resolver.AddTransformerDetail(transformerDetail);
            }
            #endregion
        }
 protected override void SetDetail(Resolver resolver)
 {
 }
Example #48
0
 public void SetStringComparisonOptions(StringComparisonOptions options)
 {
     StringComparisonOptions = options;
     Resolver.RegisterInstance(typeof(StringComparisonOptions), StringComparisonOptions);
 }
Example #49
0
 protected override void ExecuteCancel(Resolver resolver)
 {
     executeMgr.CancelOperation(resolver);
 }
 protected override void ExecuteSubmit(Resolver resolver)
 {
 }
 protected override void ExecuteCancel(Resolver resolver)
 {
 }
 protected override void ExecutePrint(Resolver resolver)
 {
 }
 public virtual async Task ReadModelAsync()
 {
     _model = await Resolver.Resolve <IModelHandler>().ProcessAsync <T>(Resolver);
 }
Example #54
0
 public AutofillService()
 {
     _appSettings = Resolver.Resolve <IAppSettingsService>();
 }
Example #55
0
        public override void ViewDidLoad()
        {
            _passwordGenerationService = Resolver.Resolve <IPasswordGenerationService>();
            _settings = Resolver.Resolve <ISettings>();
            _googleAnalyticsService = Resolver.Resolve <IGoogleAnalyticsService>();

            NavItem.Title         = AppResources.PasswordGenerator;
            CancelBarButton.Title = AppResources.Cancel;
            SelectBarButton.Title = AppResources.Select;
            View.BackgroundColor  = new UIColor(red: 0.94f, green: 0.94f, blue: 0.96f, alpha: 1.0f);

            var descriptor = UIFontDescriptor.PreferredBody;

            PasswordLabel.Font                      = UIFont.FromName("Menlo-Regular", descriptor.PointSize * 1.3f);
            PasswordLabel.LineBreakMode             = UILineBreakMode.TailTruncation;
            PasswordLabel.Lines                     = 1;
            PasswordLabel.AdjustsFontSizeToFitWidth = false;

            var controller = ChildViewControllers.LastOrDefault();

            if (controller != null)
            {
                OptionsTableViewController = controller as UITableViewController;
            }

            if (OptionsTableViewController != null)
            {
                OptionsTableViewController.TableView.RowHeight          = UITableView.AutomaticDimension;
                OptionsTableViewController.TableView.EstimatedRowHeight = 70;
                OptionsTableViewController.TableView.Source             = new TableSource(this);
                OptionsTableViewController.TableView.AllowsSelection    = true;
                OptionsTableViewController.View.BackgroundColor         = new UIColor(red: 0.94f, green: 0.94f, blue: 0.96f, alpha: 1.0f);
            }

            UppercaseCell.Switch.On = _settings.GetValueOrDefault(Constants.PasswordGeneratorUppercase, true);
            LowercaseCell.Switch.On = _settings.GetValueOrDefault(Constants.PasswordGeneratorLowercase, true);
            SpecialCell.Switch.On   = _settings.GetValueOrDefault(Constants.PasswordGeneratorSpecial, true);
            NumbersCell.Switch.On   = _settings.GetValueOrDefault(Constants.PasswordGeneratorNumbers, true);
            MinNumbersCell.Value    = _settings.GetValueOrDefault(Constants.PasswordGeneratorMinNumbers, 1);
            MinSpecialCell.Value    = _settings.GetValueOrDefault(Constants.PasswordGeneratorMinSpecial, 1);
            LengthCell.Value        = _settings.GetValueOrDefault(Constants.PasswordGeneratorLength, 10);

            UppercaseCell.ValueChanged  += Options_ValueChanged;
            LowercaseCell.ValueChanged  += Options_ValueChanged;
            NumbersCell.ValueChanged    += Options_ValueChanged;
            SpecialCell.ValueChanged    += Options_ValueChanged;
            MinNumbersCell.ValueChanged += Options_ValueChanged;
            MinSpecialCell.ValueChanged += Options_ValueChanged;
            LengthCell.ValueChanged     += Options_ValueChanged;

            // Adjust based on context password options
            if (Context.PasswordOptions != null)
            {
                if (Context.PasswordOptions.RequireDigits)
                {
                    NumbersCell.Switch.On      = true;
                    NumbersCell.Switch.Enabled = false;

                    if (MinNumbersCell.Value < 1)
                    {
                        MinNumbersCell.Value = 1;
                    }

                    MinNumbersCell.Stepper.MinimumValue = 1;
                }

                if (Context.PasswordOptions.RequireSymbols)
                {
                    SpecialCell.Switch.On      = true;
                    SpecialCell.Switch.Enabled = false;

                    if (MinSpecialCell.Value < 1)
                    {
                        MinSpecialCell.Value = 1;
                    }

                    MinSpecialCell.Stepper.MinimumValue = 1;
                }

                if (Context.PasswordOptions.MinLength < Context.PasswordOptions.MaxLength)
                {
                    if (Context.PasswordOptions.MinLength > 0 && Context.PasswordOptions.MinLength > LengthCell.Slider.MinValue)
                    {
                        if (LengthCell.Value < Context.PasswordOptions.MinLength)
                        {
                            LengthCell.Slider.Value = Context.PasswordOptions.MinLength;
                        }

                        LengthCell.Slider.MinValue = Context.PasswordOptions.MinLength;
                    }

                    if (Context.PasswordOptions.MaxLength > 5 && Context.PasswordOptions.MaxLength < LengthCell.Slider.MaxValue)
                    {
                        if (LengthCell.Value > Context.PasswordOptions.MaxLength)
                        {
                            LengthCell.Slider.Value = Context.PasswordOptions.MaxLength;
                        }

                        LengthCell.Slider.MaxValue = Context.PasswordOptions.MaxLength;
                    }
                }
            }

            GeneratePassword();
            _googleAnalyticsService.TrackExtensionEvent("GeneratedPassword");
            base.ViewDidLoad();
        }
Example #56
0
 public bool CanDelete(Resolver resolver)
 {
     return(resolver.OperationalProcessTypes == null ||
            !resolver.OperationalProcessTypes.Any());
 }
Example #57
0
 protected virtual IActionInvoker CreateActionInvoker()
 {
     // Controller supports asynchronous operations by default.
     return(Resolver.GetService <IAsyncActionInvoker>() ?? Resolver.GetService <IActionInvoker>() ?? new AsyncControllerActionInvoker());
 }
Example #58
0
        public static Cell MakeFieldCell(FieldType type, string label, string value,
                                         TableSection fieldsSection, Page page)
        {
            Cell           cell;
            FormEntryCell  feCell = null;
            FormSwitchCell fsCell = null;

            switch (type)
            {
            case FieldType.Text:
            case FieldType.Hidden:
                var hidden = type == FieldType.Hidden;
                cell = feCell = new FormEntryCell(label, isPassword: hidden,
                                                  button1: hidden ? "eye.png" : "cog_alt.png", button2: hidden ? "cog_alt.png" : null);
                feCell.Entry.Text = value;
                feCell.Entry.DisableAutocapitalize = true;
                feCell.Entry.Autocorrect           = false;

                if (hidden)
                {
                    feCell.Entry.FontFamily = OnPlatform(iOS: "Menlo-Regular", Android: "monospace",
                                                         Windows: "Courier");
                    feCell.Button1.Command = new Command(() =>
                    {
                        feCell.Entry.InvokeToggleIsPassword();
                        feCell.Button1.Image = "eye" +
                                               (!feCell.Entry.IsPasswordFromToggled ? "_slash" : string.Empty) + ".png";
                    });
                }
                break;

            case FieldType.Boolean:
                cell = fsCell = new FormSwitchCell(label, "cog_alt.png");
                fsCell.Switch.IsToggled = value == "true";
                break;

            default:
                cell = null;
                break;
            }

            if (cell != null)
            {
                var optionsButton = feCell != null ? feCell.Button2 ?? feCell.Button1 : fsCell.Button1;
                optionsButton.Command = new Command(async() =>
                {
                    var optionsVal = await page.DisplayActionSheet(AppResources.Options, AppResources.Cancel,
                                                                   null, AppResources.Edit, AppResources.Remove);
                    if (optionsVal == AppResources.Remove)
                    {
                        if (fieldsSection.Contains(cell))
                        {
                            fieldsSection.Remove(cell);
                        }

                        if (feCell != null)
                        {
                            feCell.Dispose();
                        }
                        cell   = null;
                        feCell = null;
                        fsCell = null;
                    }
                    else if (optionsVal == AppResources.Edit)
                    {
                        var existingLabel = feCell?.Label.Text ?? fsCell?.Label.Text;
                        var daService     = Resolver.Resolve <IDeviceActionService>();
                        var editLabel     = await daService.DisplayPromptAync(AppResources.CustomFieldName,
                                                                              null, existingLabel);
                        if (editLabel != null)
                        {
                            if (feCell != null)
                            {
                                feCell.Label.Text = editLabel;
                            }
                            else if (fsCell != null)
                            {
                                fsCell.Label.Text = editLabel;
                            }
                        }
                    }
                });
            }

            return(cell);
        }
Example #59
0
        /// <summary>
        /// Gets the services page.
        /// </summary>
        /// <param name="mainPage">The main page.</param>
        /// <returns>Content Page.</returns>
        private static ContentPage GetServicesPage(VisualElement mainPage)
        {
            var listItems = new List <string>()
            {
                "TextToSpeech",
                "DeviceExtended",
                "PhoneService",
                "GeoLocator",
                "Camera",
                "Accelerometer",
                "Display",
                "Cache",
                "Sound",
                "FontManager",
                "NFC",
                "Email",
                "SecureStorage",
                //"WaveRecorder",
                //"Bluetooth",
            };

            var lstServices = new ListView
            {
                ItemsSource = listItems
            };

            lstServices.ItemSelected += async(sender, e) =>
            {
                if (e.SelectedItem == null)
                {
                    return;
                }

                lstServices.SelectedItem = null;

                switch (e.SelectedItem.ToString().ToLower())
                {
                case "texttospeech":
                    await mainPage.Navigation.PushAsync(new TextToSpeechPage());

                    break;

                case "deviceextended":
                    await mainPage.Navigation.PushAsync(new ExtendedDeviceInfoPage(Resolver.Resolve <IDevice>()));

                    break;

                case "phoneservice":
                    await mainPage.Navigation.PushAsync(new PhoneServicePage());

                    break;

                case "geolocator":
                    await mainPage.Navigation.PushAsync(ViewFactory.CreatePage <GeolocatorViewModel, Page>() as Page);

                    break;

                case "camera":
                    await mainPage.Navigation.PushAsync(ViewFactory.CreatePage <CameraViewModel, Page>() as Page);

                    break;

                case "accelerometer":
                    await mainPage.Navigation.PushAsync(new AcceleratorSensorPage());

                    break;

                case "display":
                    await mainPage.Navigation.PushAsync(new AbsoluteLayoutWithDisplayInfoPage(Resolver.Resolve <IDisplay>()));

                    break;

                case "cache":
                    await mainPage.Navigation.PushAsync(ViewFactory.CreatePage <CacheServiceViewModel, Page>() as Page);

                    break;

                case "sound":
                    await mainPage.Navigation.PushAsync(ViewFactory.CreatePage <SoundServiceViewModel, Page>() as Page);

                    break;

                //case "bluetooth":
                //    await mainPage.Navigation.PushAsync(new BluetoothPage());
                //    break;
                case "fontmanager":
                    await mainPage.Navigation.PushAsync(new FontManagerPage(Resolver.Resolve <IDisplay>(), Resolver.Resolve <IFontManager>()));

                    break;

                case "nfc":
                    await mainPage.Navigation.PushAsync(new NfcDevicePage());

                    break;

                case "waverecorder":
                    await mainPage.Navigation.PushAsync(ViewFactory.CreatePage <WaveRecorderViewModel, Page>() as Page);

                    break;

                case "email":
                    await mainPage.Navigation.PushAsync(new EmailPage());

                    break;

                case "securestorage":
                    await mainPage.Navigation.PushAsync(new SecureStoragePage());

                    break;
                }
            };

            var services = new ContentPage
            {
                Title   = "Services",
                Icon    = Device.OnPlatform("services1_32.png", "services1_32.png", "Images/services1_32.png"),
                Content = lstServices,
            };

            return(services);
        }
Example #60
0
 protected virtual ITempDataProvider CreateTempDataProvider()
 {
     return(Resolver.GetService <ITempDataProvider>() ?? new SessionStateTempDataProvider());
 }