Пример #1
0
        public IComGeneralDemo(ILegacyMetasysClient legacyClient)
        {
            this.legacyClient = legacyClient;
            Type declaringType = MethodBase.GetCurrentMethod().DeclaringType;

            log = new LogInitializer(declaringType);
        }
Пример #2
0
        private static bool MainMenu(ILegacyMetasysClient legacyClient)
        {
            Console.Clear();
            Console.WriteLine("Choose an option:");
            Console.WriteLine("1) Get Object Identifier");
            Console.WriteLine("2) General Demo");
            Console.WriteLine("3) Refresh Token");
            Console.WriteLine("4) Spaces and Equipment");
            Console.WriteLine("5) Alarms");
            Console.WriteLine("6) Trends");
            Console.WriteLine("7) Audits");
            Console.WriteLine("8) Exit");
            Console.Write("\r\nSelect an option: ");

            switch (Console.ReadLine())
            {
            case "1":
                new IComGetObjectIdentifierDemo(legacyClient).Run();
                return(true);

            case "2":
                new IComGeneralDemo(legacyClient).Run();
                return(true);

            case "3":
                new IComRefreshTokenDemo(legacyClient).Run();
                return(true);

            case "4":
                new IComSpacesDemo(legacyClient).Run();
                return(true);

            case "5":
                new IComAlarmsDemo(legacyClient).Run();
                return(true);

            case "6":
                new IComTrendsDemo(legacyClient).Run();
                return(true);

            case "7":
                new IComAuditsDemo(legacyClient).Run();
                return(true);

            case "8":
                return(false);

            default:
                return(true);
            }
        }
        public void MethodInitialize()
        {
        
            ComMetasysClientFactory = new ComMetasysClientFactory();
            LClient = ComMetasysClientFactory.GetLegacyClient("hostname");
            httpTest = new HttpTest();

            Mapper = new MapperConfiguration(cfg =>
            {
                cfg.CreateMap<AccessToken, IComAccessToken>();
                cfg.CreateMap<Variant, IComVariant>();
                cfg.CreateMap<VariantMultiple, IComVariantMultiple>();
                cfg.CreateMap<MetasysObject, IComMetasysObject>().ForMember(dest => dest.Children, opt => opt.MapFrom(src => Mapper.Map<IComMetasysObject[]>(src.Children)));
                cfg.CreateMap<VariantMultiple, IComVariantMultiple>()
                    .ForMember(dest => dest.Values, opt => opt.MapFrom(src => Mapper.Map<IComVariant[]>(src.Values)));
                cfg.CreateMap<Command, IComCommand>();
                cfg.CreateMap<MetasysObjectType, IComMetasysObjectType>();
            }).CreateMapper();
        }