Exemple #1
0
        public object Get(ShipmentApplicaotinHelperType name, AutomationElement rootAutomationElement)
        {
            if (ApplicationMapObjects.ContainsKey(name) && ApplicationMapObjects[name].GetNativeWindowHandle() == rootAutomationElement.Current.NativeWindowHandle)
            {
                return(ApplicationMapObjects[name]);
            }
            object applicationHelper;

            switch (name)
            {
            case ShipmentApplicaotinHelperType.FedexShipManagerMap:
                applicationHelper = new FedexShipManagerMap(new ShipmentAutomationUIControlHelper(), rootAutomationElement, _messagesProvider);
                Set(ShipmentApplicaotinHelperType.FedexShipManagerMap, (ShipmentAutomationMapBase)applicationHelper);
                break;

            case ShipmentApplicaotinHelperType.FedExMultiPieceShipmentMap:
                applicationHelper = new FedExMultiPieceShipmentMap(new ShipmentAutomationUIControlHelper(), rootAutomationElement, _messagesProvider);
                Set(ShipmentApplicaotinHelperType.FedExMultiPieceShipmentMap, (ShipmentAutomationMapBase)applicationHelper);
                break;

            case ShipmentApplicaotinHelperType.UpsManagerMap:
                applicationHelper = new UpsManagerMap(new ShipmentWinApiControlHelper(), rootAutomationElement, _messagesProvider);
                Set(ShipmentApplicaotinHelperType.UpsManagerMap, (ShipmentAutomationMapBase)applicationHelper);
                break;

            case ShipmentApplicaotinHelperType.FedExShipAlertTabMap:
                applicationHelper = new FedExShipAlertTabMap(new ShipmentAutomationUIControlHelper(), rootAutomationElement, _messagesProvider);
                Set(ShipmentApplicaotinHelperType.FedExShipAlertTabMap, (ShipmentAutomationMapBase)applicationHelper);
                break;

            case ShipmentApplicaotinHelperType.FedExShipManagerShellMap:
                applicationHelper = new FedExShipMahagerShellMap(new ShipmentAutomationUIControlHelper(), rootAutomationElement, _messagesProvider);
                Set(ShipmentApplicaotinHelperType.FedExShipManagerShellMap, (ShipmentAutomationMapBase)applicationHelper);
                break;

            case ShipmentApplicaotinHelperType.UpsManagerShellMap:
                applicationHelper = new UpsManagerShellMap(new ShipmentWinApiControlHelper(), rootAutomationElement, _messagesProvider);
                Set(ShipmentApplicaotinHelperType.UpsManagerShellMap, (ShipmentAutomationMapBase)applicationHelper);
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(name), name, string.Format(InformationResources.ERROR_CREATE_APPLICATION_MAP_CACHE, nameof(name)));
            }
            return(applicationHelper);
        }
Exemple #2
0
        public bool PopulateApplicaitonControlMap()
        {
            //Try set UI for input shipment
            _fedExShipMahagerShellMap = (FedExShipMahagerShellMap)_cache.Get(ShipmentApplicaotinHelperType.FedExShipManagerShellMap, _mainWindow);
            _fedExShipMahagerShellMap.ClearUIForStartInput();

            //Find and map UI controls
            _fedexShipManagerMap = (FedexShipManagerMap)_cache.Get(ShipmentApplicaotinHelperType.FedexShipManagerMap, _mainWindow);
            _fedexShipManagerMap.Map();

            if (NeedClearing(_fedexShipManagerMap.ShipmentAutomationControls))
            {
                _messagesProvider.Info(InformationResources.WARN_CURRENT_SHIPMENT_SCREEN_ISNOT_EMPTY);
                return(false);
            }
            _fedExShipMahagerShellMap.BottomToolboxControl?.GetButtons()?[0].Click();
            _messagesProvider.Log(InformationResources.INFO_FEDEX_INIT_CONTROL_MAP);
            return(true);
        }