Пример #1
0
 public void Visit(
     int nestingLevel,
     int pathId,
     ContextStatePathValueBinding binding,
     Object payload,
     ContextController contextController,
     ContextControllerInstanceHandle instanceHandle)
 {
     if (nestingLevel == _maxNestingLevel)
     {
         _agentInstanceIds.Add(instanceHandle.ContextPartitionOrPathId);
     }
 }
Пример #2
0
 public ContextControllerConditionFilter(
     IntSeqKey conditionPath,
     object[] partitionKeys,
     ContextConditionDescriptorFilter filter,
     ContextControllerConditionCallback callback,
     ContextController controller)
 {
     this.conditionPath = conditionPath;
     this.partitionKeys = partitionKeys;
     this.filter = filter;
     this.callback = callback;
     this.controller = controller;
 }
 public ContextControllerConditionTimePeriod(
     long scheduleSlot,
     ContextConditionDescriptorTimePeriod timePeriod,
     IntSeqKey conditionPath,
     ContextControllerConditionCallback callback,
     ContextController controller)
 {
     this.scheduleSlot = scheduleSlot;
     this.timePeriod = timePeriod;
     this.conditionPath = conditionPath;
     this.callback = callback;
     this.controller = controller;
 }
 public ContextControllerConditionPattern(
     IntSeqKey conditionPath,
     object[] partitionKeys,
     ContextConditionDescriptorPattern pattern,
     ContextControllerConditionCallback callback,
     ContextController controller)
 {
     this.conditionPath = conditionPath;
     this.partitionKeys = partitionKeys;
     this.pattern = pattern;
     this.callback = callback;
     this.controller = controller;
 }
Пример #5
0
 public GameLogics(
     InputController input,
     OutputController output,
     ContextController context,
     CountryController country,
     TimeController time
     )
 {
     _input   = input;
     _out     = output;
     _context = context;
     _country = country;
     _time    = time;
 }
Пример #6
0
        bool ValidateTestSettings()
        {
            DeviceEnvironment environment = ContextController.GetDeviceEnvironment();

            bool topicEmpty = string.IsNullOrEmpty(environment.TestSettings.EventTopic) ||
                              string.IsNullOrEmpty(environment.TestSettings.TopicNamespaces);

            if (topicEmpty)
            {
                ShowPrompt("Topic (with namespace) for Events tests not defined at the Management page", "Necessary settings missing");
            }

            return(!topicEmpty);
        }
Пример #7
0
 public ConquestInterface(
     ContextController context, InputController input, OutputController output, CountryController country,
     MapController map, DiscoveryController discovery, ArmyController army, ConquestController conquest
     )
 {
     _context   = context;
     _input     = input;
     _out       = output;
     _country   = country;
     _map       = map;
     _discovery = discovery;
     _army      = army;
     _conquest  = conquest;
 }
Пример #8
0
        private void RecursiveDeactivateStop(
            ContextController currentContext,
            bool leaveLocksAcquired,
            IList <AgentInstance> agentInstancesCollected)
        {
            // deactivate
            currentContext.Deactivate();

            // remove state
            var entry = _subcontexts.Pluck(currentContext);

            if (entry == null)
            {
                return;
            }

            // remove from parent
            var parent = _subcontexts.Get(entry.Parent);

            if (parent != null)
            {
                parent.ChildContexts.Remove(currentContext.PathId);
            }

            // stop instances
            if (entry.AgentInstances != null)
            {
                foreach (var entryCP in entry.AgentInstances)
                {
                    StatementAgentInstanceUtil.StopAgentInstances(
                        entryCP.Value.AgentInstances, null, _servicesContext, false, leaveLocksAcquired);
                    if (agentInstancesCollected != null)
                    {
                        agentInstancesCollected.AddAll(entryCP.Value.AgentInstances);
                    }
                    _contextPartitionIdManager.RemoveId(entryCP.Key);
                }
            }

            // deactivate child contexts
            if (entry.ChildContexts == null || entry.ChildContexts.IsEmpty())
            {
                return;
            }
            foreach (ContextController inner in entry.ChildContexts.Values)
            {
                RecursiveDeactivateStop(inner, leaveLocksAcquired, agentInstancesCollected);
            }
        }
Пример #9
0
        public void EnableControls(bool enable)
        {
            Invoke(new Action(() =>
            {
                DiscoveredDevices devices = ContextController.GetDiscoveredDevices();
                string address            = devices != null ? devices.ServiceAddress : string.Empty;

                bool testProfileSelected = false;
                if (cmbMediaProfile.SelectedItem != null)
                {
                    testProfileSelected = IsTestProfile(((MediaProfileWrapper)cmbMediaProfile.SelectedItem).Profile);
                }

                btnGetMediaUrl.Enabled = enable && !string.IsNullOrEmpty(address);
                btnGetMediaUrl.Refresh();
                btnGetProfiles.Enabled = enable && !string.IsNullOrEmpty(MediaAddress);
                btnGetProfiles.Refresh();
                btnDeleteProfile.Enabled = enable && testProfileSelected;
                btnDeleteProfile.Refresh();
                buttonGetVideoSources.Enabled = testProfileSelected && enable && !string.IsNullOrEmpty(MediaAddress);
                buttonGetVideoSources.Refresh();
                buttonGetVideoEncoders.Enabled = testProfileSelected && enable && !string.IsNullOrEmpty(MediaAddress);
                buttonGetVideoEncoders.Refresh();
                buttonGetVideoCodecs.Enabled = buttonGetVideoEncoders.Enabled && (cmbVideoEncoder.SelectedItem != null);
                buttonGetVideoCodecs.Refresh();
                buttonGetAudioSources.Enabled = testProfileSelected && enable && !string.IsNullOrEmpty(MediaAddress);
                buttonGetAudioSources.Refresh();
                buttonGetAudioEncoders.Enabled = testProfileSelected && enable && !string.IsNullOrEmpty(MediaAddress);
                buttonGetAudioEncoders.Refresh();
                buttonGetAudioCodecs.Enabled = buttonGetAudioEncoders.Enabled && (cmbAudioEncoder.SelectedItem != null);
                buttonGetAudioCodecs.Refresh();
                btnGetStreams.Enabled = (enable && cmbVideoResolution.SelectedItem != null) || (_videoWindow != null);

                cmbMediaProfile.Enabled    = enable;
                cmbAudioCodec.Enabled      = testProfileSelected && enable;
                cmbAudioEncoder.Enabled    = testProfileSelected && enable;
                cmbAudioSource.Enabled     = testProfileSelected && enable;
                cmbVideoCodec.Enabled      = testProfileSelected && enable;
                cmbVideoEncoder.Enabled    = testProfileSelected && enable;
                cmbVideoResolution.Enabled = testProfileSelected && enable;
                txtVideoBitrate.Enabled    = testProfileSelected && enable && (cmbVideoCodec.SelectedItem != null);
                txtVideoFramerate.Enabled  = testProfileSelected && enable && (cmbVideoCodec.SelectedItem != null);
                cmbVideoSource.Enabled     = testProfileSelected && enable;
                cmbAudioBitrate.Enabled    = testProfileSelected && enable;
                cmbTransport.Enabled       = testProfileSelected && enable;

                btnGetStreams.Refresh();
            }));
        }
Пример #10
0
 public ContextControllerConditionCrontabImpl(
     IntSeqKey conditionPath,
     long scheduleSlot,
     ScheduleSpec scheduleSpec,
     ContextConditionDescriptorCrontab crontab,
     ContextControllerConditionCallback callback,
     ContextController controller)
 {
     this.conditionPath = conditionPath;
     this.scheduleSlot = scheduleSlot;
     Schedule = scheduleSpec;
     this.crontab = crontab;
     this.callback = callback;
     this.controller = controller;
 }
Пример #11
0
        public ContextManagerRealization(
            ContextManagerResident contextManager,
            AgentInstanceContext agentInstanceContextCreate)
        {
            ContextManager = contextManager;
            AgentInstanceContextCreate = agentInstanceContextCreate;

            // create controllers
            var controllerFactories = contextManager.ContextDefinition.ControllerFactories;
            ContextControllers = new ContextController[controllerFactories.Length];
            for (var i = 0; i < controllerFactories.Length; i++) {
                var contextControllerFactory = controllerFactories[i];
                ContextControllers[i] = contextControllerFactory.Create(this);
            }
        }
Пример #12
0
        private void RecursivePopulateBuiltinProps(ContextController originator, IDictionary <String, Object> properties)
        {
            var entry = _subcontexts.Get(originator);

            if (entry != null)
            {
                if (entry.InitContextProperties != null)
                {
                    properties.Put(entry.Parent.Factory.FactoryContext.ContextName, entry.InitContextProperties);
                }
                if (entry.Parent != null && entry.Parent.Factory.FactoryContext.NestingLevel > 1)
                {
                    RecursivePopulateBuiltinProps(entry.Parent, properties);
                }
            }
        }
Пример #13
0
        private AgentInstanceFilterProxy GetMergedFilterAddendums(
            ContextControllerStatementDesc statement,
            ContextController originator,
            Object partitionKey,
            int contextId)
        {
            var result = new IdentityDictionary <FilterSpecCompiled, FilterValueSetParam[][]>();

            originator.Factory.PopulateFilterAddendums(result, statement, partitionKey, contextId);
            var originatorEntry = _subcontexts.Get(originator);

            if (originatorEntry != null)
            {
                RecursivePopulateFilterAddendum(statement, originatorEntry, contextId, result);
            }
            return(new AgentInstanceFilterProxyImpl(result));
        }
Пример #14
0
        public ContextManagerImpl(ContextControllerFactoryServiceContext factoryServiceContext)
        {
            _uLock                     = LockManager.CreateLock(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
            _contextName               = factoryServiceContext.ContextName;
            _servicesContext           = factoryServiceContext.ServicesContext;
            _factory                   = factoryServiceContext.AgentInstanceContextCreate.StatementContext.ContextControllerFactoryService.GetFactory(factoryServiceContext)[0];
            _rootContext               = _factory.CreateNoCallback(0, this); // single instance: created here and activated/deactivated later
            _contextPartitionIdManager = factoryServiceContext.AgentInstanceContextCreate.StatementContext.ContextControllerFactoryService.AllocatePartitionIdMgr(_contextName, factoryServiceContext.AgentInstanceContextCreate.StatementContext.StatementId);

            var resourceRegistryFactory = _factory.StatementAIResourceRegistryFactory;

            var contextProps     = _factory.ContextBuiltinProps;
            var contextPropsType = _servicesContext.EventAdapterService.CreateAnonymousMapType(_contextName, contextProps, true);
            var registry         = new ContextPropertyRegistryImpl(_factory.ContextDetailPartitionItems, contextPropsType);

            _contextDescriptor = new ContextDescriptor(_contextName, _factory.IsSingleInstanceContext, registry, resourceRegistryFactory, this, _factory.ContextDetail);
        }
Пример #15
0
        public static void SetFilters(List <Filter> new_filters, IDialogContext context)
        {
            var user_data = context.PrivateConversationData;

            user_data.SetValue <List <Filter> >(FILTERS_ATR, new_filters);

            if (IsLoggedIn(context))
            {
                User u = GetUser(context);
                ContextController.CleanFilters(u);

                foreach (Filter f in new_filters)
                {
                    ContextController.AddFilter(u, f.FilterName, f.Operator, f.Value);
                }
            }
        }
Пример #16
0
        void UpdateDeviceContext(TestSuiteParameters parameters)
        {
            DeviceEnvironment environment = ContextController.GetDeviceEnvironment();

            environment.Timeouts            = new Timeouts();
            environment.Timeouts.InterTests = parameters.TimeBetweenTests;
            environment.Timeouts.Message    = parameters.MessageTimeout;
            environment.Timeouts.Reboot     = parameters.RebootTimeout;

            environment.EnvironmentSettings             = new EnvironmentSettings();
            environment.EnvironmentSettings.DnsIpv4     = parameters.EnvironmentSettings.DnsIpv4;
            environment.EnvironmentSettings.NtpIpv4     = parameters.EnvironmentSettings.NtpIpv4;
            environment.EnvironmentSettings.DnsIpv6     = parameters.EnvironmentSettings.DnsIpv6;
            environment.EnvironmentSettings.NtpIpv6     = parameters.EnvironmentSettings.NtpIpv6;
            environment.EnvironmentSettings.GatewayIpv4 = parameters.EnvironmentSettings.DefaultGateway;
            environment.EnvironmentSettings.GatewayIpv6 = parameters.EnvironmentSettings.DefaultGatewayIpv6;

            environment.TestSettings = new TestSettings();
            environment.TestSettings.PTZNodeToken = parameters.PTZNodeToken;

            environment.TestSettings.UseEmbeddedPassword             = parameters.UseEmbeddedPassword;
            environment.TestSettings.Password1                       = parameters.Password1;
            environment.TestSettings.Password2                       = parameters.Password2;
            environment.TestSettings.OperationDelay                  = parameters.OperationDelay;
            environment.TestSettings.RecoveryDelay                   = parameters.RecoveryDelay;
            environment.TestSettings.VideoSourceToken                = parameters.VideoSourceToken;
            environment.TestSettings.FirmwareFilePath                = parameters.FirmwareFilePath;
            environment.TestSettings.CredentialIdentifierValueFirst  = parameters.CredentialIdentifierValueFirst;
            environment.TestSettings.CredentialIdentifierValueSecond = parameters.CredentialIdentifierValueSecond;
            environment.TestSettings.CredentialIdentifierValueThird  = parameters.CredentialIdentifierValueThird;

            environment.TestSettings.SecureMethod        = parameters.SecureMethod;
            environment.TestSettings.SubscriptionTimeout = parameters.SubscriptionTimeout;
            environment.TestSettings.EventTopic          = parameters.EventTopic;
            environment.TestSettings.TopicNamespaces     = parameters.TopicNamespaces;

            environment.TestSettings.RelayOutputDelayTimeMonostable = parameters.RelayOutputDelayTimeMonostable;

            environment.TestSettings.RecordingToken = parameters.RecordingToken;
            environment.TestSettings.SearchTimeout  = parameters.SearchTimeout;
            environment.TestSettings.MetadataFilter = parameters.MetadataFilter;

            environment.TestSettings.RetentionTime = parameters.RetentionTime;
        }
Пример #17
0
        public void TransferRecursive(
            IntSeqKey controllerPath,
            int subpathOrAgentInstanceId,
            ContextController originator,
            AgentInstanceTransferServices xfer)
        {
            if (controllerPath.Length != originator.Factory.FactoryEnv.NestingLevel - 1) {
                throw new IllegalStateException("Unrecognized controller path");
            }

            var nestingLevel = originator.Factory.FactoryEnv.NestingLevel; // starts at 1 for root
            if (nestingLevel >= ContextControllers.Length) {
                return;
            }

            var childController = ContextControllers[nestingLevel];
            var subPath = controllerPath.AddToEnd(subpathOrAgentInstanceId);
            childController.Transfer(subPath, nestingLevel < ContextControllers.Length - 1, xfer);
        }
Пример #18
0
        public static void RemItemComparator(IDialogContext context, string item)
        {
            List <string> items = GetComparatorItems(context);

            foreach (string i in items)
            {
                if (i.Equals(item))
                {
                    items.Remove(i);
                    context.PrivateConversationData.SetValue <List <string> >(COMPARATOR_ATR, items);

                    if (IsLoggedIn(context))
                    {
                        User u = GetUser(context);
                        ContextController.RemComparator(u, item);
                    }
                    break;
                }
            }
        }
Пример #19
0
        public static void RemItemWishlist(IDialogContext context, string item)
        {
            List <string> items = GetWishlistItems(context);

            foreach (string i in items)
            {
                if (i.Equals(item))
                {
                    items.Remove(i);
                    context.PrivateConversationData.SetValue <List <string> >(WISHLIST_ATR, items);

                    if (IsLoggedIn(context))
                    {
                        User u = GetUser(context);
                        ContextController.RemWishList(u, item);
                    }
                    break;
                }
            }
        }
Пример #20
0
        public static void AddItemComparator(IDialogContext context, string item)
        {
            List <string> items = GetComparatorItems(context);

            foreach (string i in items)
            {
                if (i.Equals(item))
                {
                    return;
                }
            }

            items.Add(item.ToString());
            context.PrivateConversationData.SetValue <List <string> >(COMPARATOR_ATR, items);

            if (IsLoggedIn(context))
            {
                User u = GetUser(context);
                ContextController.AddComparator(u, item);
            }
        }
Пример #21
0
        /// <summary>
        /// Handles button get device information click event
        /// </summary>
        /// <param name="sender">Event sender</param>
        /// <param name="e">Event argument</param>
        private void btnGetDeviceInformation_Click(object sender, EventArgs e)
        {
            DiscoveredDevices devices = ContextController.GetDiscoveredDevices();
            string            url     = devices.ServiceAddress;

            if (!string.IsNullOrEmpty(url))
            {
                try
                {
                    Controller.GetDeviceInformation();
                }
                catch (System.ServiceModel.EndpointNotFoundException)
                {
                    MessageBox.Show(this, "Could not connect to " + url, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                catch (Exception ex)
                {
                    ShowError(ex);
                }
            }
        }
Пример #22
0
        public static void Login(IDialogContext context, User user)
        {
            Context  user_context = ContextController.GetContext(user.Id);
            Customer user_crm     = CRMController.GetCustomer(user.Id);

            var userdata = context.PrivateConversationData;

            //User login
            userdata.SetValue <bool>(LOGIN_ATR, true);

            //User info
            userdata.SetValue <string>(USER_ID_ATR, user.Id.ToString());
            userdata.SetValue <string>(USER_COUNTRY_ATR, user.Country);
            userdata.SetValue <string>(USER_NAME_ATR, user.Name);
            userdata.SetValue <string>(USER_EMAIL_ATR, user.Email);
            userdata.SetValue <string>(USER_CARD_ATR, user.CustomerCard);
            userdata.SetValue <string>(USER_GENDER_ATR, user.Gender);

            //User context
            List <string> compare = new List <string>();
            List <string> wishes  = new List <string>();

            foreach (ObjectId w in user_context.WishList.ToList())
            {
                wishes.Add(w.ToString());
            }

            foreach (ObjectId c in user_context.Comparator.ToList())
            {
                compare.Add(c.ToString());
            }

            userdata.SetValue <List <string> >(WISHLIST_ATR, wishes);
            userdata.SetValue <List <string> >(COMPARATOR_ATR, compare);

            //User crm
            userdata.SetValue <List <FilterCount> >(FILTER_COUNT_ATR, user_crm.FiltersCount.ToList());
            userdata.SetValue <List <ProductClicks> >(PRODUCT_CLICKS_ATR, user_crm.ProductsClicks.ToList());
        }
Пример #23
0
        void InitText()
        {
            ApplicationInfo info = ContextController.GetApplicationInfo();

            lblToolInfo.Text = info.ToolVersionFull;

            linkOnvif.Links.Add(0, linkOnvif.Text.Length).LinkData = linkOnvif.Text;

            this.tbAgreement.Text = @"ONVIF LICENSE AGREEMENT" + Environment.NewLine +
                                    "This is a legal agreement between you (either individual or an entity) and ONVIF. By installing, copying or otherwise using the SOFTWARE, you are agreeing to be bound by the terms of this agreement." + Environment.NewLine + Environment.NewLine +
                                    "ONVIF SOFTWARE LICENSE" + Environment.NewLine +
                                    "1. GRANT OF LICENSE. ONVIF grants to you as ONVIF Member the right to use the SOFTWARE. The SOFTWARE is in \"use\" on a computer when it is loaded into temporary memory (i.e. RAM) or installed into permanent memory (e.g. hard disk, CD-ROM or other storage device) of that computer." + Environment.NewLine + Environment.NewLine +
                                    "2. COPYRIGHT. The SOFTWARE is owned by ONVIF and/or its licensor(s), if any, and is protected by copyright laws and international treaty provisions. Therefore you must treat the SOFTWARE like any other copyrighted material (e.g. a book or a musical recording) except that you may either (a) make a copy of the SOFTWARE solely for backup or archival purposes or (b) transfer the SOFTWARE to a single hard disk provided you keep the original solely for backup purposes." + Environment.NewLine + Environment.NewLine +
                                    "3. OTHER RESTRICTIONS. You may not rent, lease or sublicense the SOFTWARE. You may not reverse engineer, decompile, or disassemble the SOFTWARE." + Environment.NewLine + Environment.NewLine +
                                    "4. THIRD PARTY Software. The SOFTWARE may contain third party software, which requires notices and/or additional terms and conditions. Such required third party software notices and/or additional terms and conditions are located in the readme file or other product documentation. By accepting this license agreement, you are also accepting the additional terms and conditions, if any, set forth therein." + Environment.NewLine + Environment.NewLine +
                                    "5. TERMINATION. This License is effective until terminated. Your rights under this License will terminate automatically without notice from ONVIF if you fail to comply with any term(s) of this License. Upon the termination of this License, you shall cease all use of the SOFTWARE and destroy all copies, full or partial, of the SOFTWARE." + Environment.NewLine + Environment.NewLine +
                                    "6. GOVERNING LAW. This agreement shall be deemed performed in and shall be construed by the laws of Switzerland." + Environment.NewLine + Environment.NewLine + Environment.NewLine +
                                    "DISCLAIMER " + Environment.NewLine + Environment.NewLine +
                                    "THE SOFTWARE IS DELIVERED AS IS WITHOUT WARRANTY OF ANY KIND. THE ENTIRE RISK AS TO THE RESULTS AND PERFORMANCE OF THE SOFTWARE IS ASSUMED BY THE PURCHASER/THE USER/YOU. ONVIF DISCLAIMS ALL WARRANTIES, WHETHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT, OR ANY WARRANTY ARISING OUT OF ANY PROPOSAL, SPECIFICATION OR SAMPLE WITH RESPECT TO THE SOFTWARE." + Environment.NewLine +
                                    "ONVIF AND/OR ITS LICENSOR(S) SHALL NOT BE LIABLE FOR LOSS OF DATA, LOSS OF PRODUCTION, LOSS OF PROFIT, LOSS OF USE, LOSS OF CONTRACTS OR FOR ANY OTHER CONSEQUENTIAL, ECONOMIC OR INDIRECT LOSS WHATSOEVER IN RESPECT OF SALE, PURCHASE, DELIVERY, USE OR DISPOSITION OF THE SOFTWARE." + Environment.NewLine +
                                    "ONVIF TOTAL LIABILITY FOR ALL CLAIMS IN ACCORDANCE WITH THE SALE, PURCHASE, DELIVERY AND USE OF THE SOFTWARE SHALL NOT EXCEED THE PRICE PAID FOR THE SOFTWARE.";
        }
Пример #24
0
        /// <summary>
        /// Show information about Test Tool
        /// </summary>
        public void ShowToolInfo()
        {
            BeginInvoke(new Action(() =>
            {
                ApplicationInfo info = _controller.GetApplicationInfo();
                tbToolVersion.Text   = info.ToolVersion;
                tbTestSpec.Text      = info.TestSpecification;

                List <string> versions = new List <string>();
                _versions = new List <CoreSpecification>();
                foreach (CoreSpecification v in info.CoreSpecifications.Keys)
                {
                    _versions.Add(v);
                    versions.Add(info.CoreSpecifications[v]);
                }

                SetupInfo setupInfo         = ContextController.GetSetupInfo();
                string coreSpec             = info.CoreSpecifications[setupInfo.CoreSpecification];
                cmbCoreVersion.DataSource   = versions;
                cmbCoreVersion.SelectedItem = coreSpec;
            }));
        }
Пример #25
0
        public void EnableControls(bool enable)
        {
            Invoke(new Action(() =>
            {
                DiscoveredDevices devices = ContextController.GetDiscoveredDevices();
                string address            = devices != null ? devices.ServiceAddress : string.Empty;

                Media.Profile profile         = (cmbPTZProfiles.SelectedItem != null) ? (cmbPTZProfiles.SelectedItem as ProfileWrapper).Profile : null;
                Media.PTZConfiguration config = profile != null ? profile.PTZConfiguration : null;

                btnGetPtzUrl.Enabled       = enable && !string.IsNullOrEmpty(address);
                btnGetProfiles.Enabled     = enable && !string.IsNullOrEmpty(MediaAddress);
                btnVideo.Enabled           = (enable && !string.IsNullOrEmpty(MediaAddress)) || (_videoWindow != null);
                rbAbsoluteMove.Enabled     = enable && !string.IsNullOrEmpty(PTZAddress) && (config != null);
                rbRelativeMove.Enabled     = enable && !string.IsNullOrEmpty(PTZAddress) && (config != null);
                rbContuniousMove.Enabled   = enable && !string.IsNullOrEmpty(PTZAddress) && (config != null);
                panelAbsoluteMove.Enabled  = enable && (rbAbsoluteMove.Checked || rbRelativeMove.Checked) && !string.IsNullOrEmpty(PTZAddress) && (config != null);
                panelContiniusMove.Enabled = enable && rbContuniousMove.Checked && !string.IsNullOrEmpty(PTZAddress) && (config != null);
                btnAddPTZConfig.Enabled    = enable && (profile != null) && (config == null);

                cmbPTZProfiles.Enabled = enable;
            }));
        }
Пример #26
0
        public void Setup()
        {
            if (ContextController.Connected)
            {
                return;
            }
            var path = Path.Combine(Environment.CurrentDirectory, "credentials\\data.json");

            if (!File.Exists(path))
            {
                File.WriteAllText(path,
                                  JsonSerializer.Serialize(new List <DatabaseCredentials> {
                    new DatabaseCredentials()
                }));
                throw new Exception($"No Database Credentials found, file has been created at {path}");
            }
            var credentials = JsonSerializer.Deserialize <DatabaseCredentials[]>(
                File.ReadAllText(Path.Combine(Environment.CurrentDirectory, "credentials\\data.json")));

            //TODO Move names to json
            ContextController.AddContext("postgres", credentials.First().Type, credentials.First().GetConnectionString(), true);
            ContextController.AddContext("MsSql", credentials.Last().Type, credentials.Last().GetConnectionString());
        }
Пример #27
0
        public static bool AddFilter(Filter f, IDialogContext context)
        {
            foreach (Filter fl in GetFilters(context))
            {
                if (fl.FilterName.Equals(f.FilterName) && fl.Value.Equals(f.Value))
                {
                    return(false);
                }
            }

            var           user_data     = context.PrivateConversationData;
            List <Filter> filters_state = user_data.GetValue <List <Filter> >(FILTERS_ATR);

            filters_state.Add(f);
            user_data.SetValue <List <Filter> >(FILTERS_ATR, filters_state);

            if (IsLoggedIn(context))
            {
                ContextController.AddFilter(GetUser(context), f.FilterName, f.Operator, f.Value);
            }

            return(true);
        }
Пример #28
0
 public App()
 {
     ContextController.CreateDatabase();
 }
Пример #29
0
        public Task <IHttpActionResult> UpdateBenChainStatusTest([PexAssumeUnderTest] ContextController target, BenChainContextModel benchainContextModel)
        {
            Task <IHttpActionResult> result = target.UpdateBenChainStatus(benchainContextModel);

            return(result);
        }
Пример #30
0
        public Task <IHttpActionResult> CreatedOrUpdateTest([PexAssumeUnderTest] ContextController target, ContextModel contextModel)
        {
            Task <IHttpActionResult> result = target.CreatedOrUpdate(contextModel);

            return(result);
        }