示例#1
0
 private static void OnClearEvent(object sender, ConfigurationEventArgs args)
 {
     if (!args.BeforeOperation)
     {
         UpdateAllProperties();
     }
 }
示例#2
0
        private static void OnConfigurationChanged(object sender, ConfigurationEventArgs args)
        {
            switch (args.Type)
            {
            case ConcurrentCompositeConfiguration.ConfigurationSourceChanged:
                UpdateAllProperties();
                break;

            case ConfigurationEventType.AddProperty:
                OnAddPropertyEvent(sender, args);
                break;

            case ConfigurationEventType.SetProperty:
                OnSetPropertyEvent(sender, args);
                break;

            case ConfigurationEventType.ClearProperty:
                OnClearPropertyEvent(sender, args);
                break;

            case ConfigurationEventType.Clear:
                OnClearEvent(sender, args);
                break;
            }
        }
        private void OnRemoteConfigurationRemoved(object sender, ConfigurationEventArgs e)
        {
            Configuration  configuration;
            IConfiguration remoteConfiguration = e.Configuration;
            Guid           configurationUid;

            try
            {
                configurationUid = remoteConfiguration.Uid;
            }
            catch (Exception exception)
            {
                LoggingProvider.Current.Log(TraceEventType.Error, exception);
                return;
            }
            lock (_collection)
            {
                VerifyDisposed();
                if (_collection.TryGetValue(configurationUid, out configuration))
                {
                    _collection.Remove(configurationUid);
                }
            }
            if (configuration == null)
            {
                configuration = new Configuration(remoteConfiguration, _application);
            }
            ConfigurationEventArgs.RaiseEvent((EventHandler <ConfigurationEventArgs>)_configurationRemoved, this, configuration);
            configuration.Dispose();
        }
        public void OnConfigurationsChanged(object sender, ConfigurationEventArgs args)
        {
            ITreeBuilder tb = Context.GetTreeBuilder(sender);

            if (tb != null)
            {
                tb.UpdateAll();
            }
        }
 static void ConfigurationChanged(ConfigurationEventArgs args)
 {
     // Empty the default values
     _activeChannel         = null;
     _isEnabled             = false;
     _server                = string.Empty;
     _bucket                = string.Empty;
     _defaultExpirationTime = default(TimeSpan);
 }
示例#6
0
        private void OnConfigurationChange(object s, ConfigurationEventArgs e)
        {
            var old = shouldUpdate;

            shouldUpdate = Configuration.GetBool("objExpAutoUpdate", false);
            if (!old)
            {
                StartCoroutine(AutoUpdate());
            }
        }
示例#7
0
 private static void OnClearPropertyEvent(object sender, ConfigurationEventArgs args)
 {
     if (!args.BeforeOperation)
     {
         UpdateProperty(args.Name, args.Value);
     }
     else
     {
         //Validate(args.Name, args.Value);
     }
 }
        private void OnHostConfigurationCreated(object sender, ConfigurationEventArgs e)
        {
            IConfiguration hostConfiguration = e.Configuration;

            lock (Lock)
            {
                VerifyDisposed();
                if (!ContainsKey(hostConfiguration.Uid))
                {
                    Add(hostConfiguration.Uid, hostConfiguration);
                }
            }
            ConfigurationEventArgs.RaiseEvent((EventHandler <ConfigurationEventArgs>)_configurationCreated, this, hostConfiguration);
        }
        private void OnHostConfigurationRemoved(object sender, ConfigurationEventArgs e)
        {
            IConfiguration hostConfiguration = e.Configuration;
            bool           configurationRemoved;

            lock (Lock)
            {
                VerifyDisposed();
                configurationRemoved = Remove(hostConfiguration.Uid);
            }
            if (configurationRemoved)
            {
                ConfigurationEventArgs.RaiseEvent((EventHandler <ConfigurationEventArgs>)_configurationRemoved, this, hostConfiguration);
            }
        }
示例#10
0
 private void OnConfigurationChanged(object sender, ConfigurationEventArgs args)
 {
     if (args.BeforeOperation)
     {
         return;
     }
     switch (args.Type)
     {
     case ConfigurationEventType.AddProperty:
     case ConfigurationEventType.SetProperty:
     case ConfigurationEventType.ClearProperty:
         ++m_EventCount;
         break;
     }
 }
示例#11
0
        private async Task SendOrSaveChanges(ConfigurationEventArgs args)
        {
            if (args == null)
            {
                return;
            }

            if (args.Configuration != null)
            {
                _msgService.SendConfig(args.Configuration);
            }

            else if (args.Entity != null)
            {
                await _dbService.AddOrUpdateAsync(args.Entity);
            }
        }
示例#12
0
        private void configurationService_onConfigurationEvent(object sender, ConfigurationEventArgs e)
        {
            if (e.Value == null)
            {
                return;
            }

            switch (e.Folder)
            {
            case Configuration.ConfFolder.IDENTITY:
                switch (e.Entry)
                {
                case Configuration.ConfEntry.DISPLAY_NAME:
                    this.textBoxDisplayName.Text = e.Value.ToString();
                    break;

                case Configuration.ConfEntry.IMPI:
                    this.textBoxPrivateIdentity.Text = e.Value.ToString();
                    break;

                case Configuration.ConfEntry.IMPU:
                    this.textBoxPublicIdentity.Text = e.Value.ToString();
                    break;

                case Configuration.ConfEntry.PASSWORD:
                    this.passwordBox.Password = e.Value.ToString();
                    break;
                }
                break;

            case Configuration.ConfFolder.NETWORK:
                switch (e.Entry)
                {
                case Configuration.ConfEntry.EARLY_IMS:
                    this.checkBoxEarlyIMS.IsChecked = e.Value.Equals(Boolean.TrueString);
                    break;

                case Configuration.ConfEntry.REALM:
                    this.textBoxRealm.Text = e.Value.ToString();
                    break;
                }
                break;
            }
        }
示例#13
0
        // Example dialplan handler
        static void HandleDialPlanRequest(object sender, ConfigurationEventArgs e)
        {
            var evt = e.FsArgs.Parameters; // get the native event that caused this dialplan lookup

            // extract the minimum variables you will need
            var context     = evt.GetValueOfHeader("Hunt-Context");            // the context
            var destination = evt.GetValueOfHeader("Hunt-Destination-Number"); // the dialed number or "DID"
            var ani         = evt.GetValueOfHeader("Hunt-ANI");                // The ANI/CallerID number

            // A place to return the dialplan actions you want
            var actions = new List <String>(); // format is "app,data"

            // add the actions for your code they shouldn't be static this is just an example
            actions.Add("set,continue_on_fail=true");
            actions.Add("brige,sofia/mygateway/" + destination);
            actions.Add("transfer,fialedDest XML failedcontext");
            e.Result = new fsDialPlanDocument(context, actions);
            return; // Isn't this easy?
        }
示例#14
0
        public async void CaptureEvent(object sender, ConfigurationEventArgs args)
        {
            try
            {
                if (_smService.GetInstance() == null)
                {
                    Device.BeginInvokeOnMainThread(async() =>
                    {
                        await Application.Current.MainPage.DisplayAlert("Select a Mirror!", "You will need to select a Lustro instance before your changes show up.", "OK");
                    });
                }
                else
                {
                    await SendOrSaveChanges(args);

                    _dbService.GetConnection().GetConnection().Commit();
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
            }
        }
示例#15
0
        public void TestListeners()
        {
            ConcurrentDictionaryConfiguration conf = new ConcurrentDictionaryConfiguration();

            object eventSender = null;
            ConfigurationEventArgs eventArgs = null;

            conf.ConfigurationChanged += (sender, args) =>
            {
                eventSender = sender;
                eventArgs   = args;
            };

            conf.AddProperty("key", "1");
            Assert.AreEqual(1, conf.GetInt("key"));
            Assert.AreEqual("key", eventArgs.Name);
            Assert.AreEqual("1", eventArgs.Value);
            Assert.AreSame(conf, eventSender);
            Assert.AreEqual(ConfigurationEventType.AddProperty, eventArgs.Type);
            conf.SetProperty("key", "2");

            Assert.AreEqual("key", eventArgs.Name);
            Assert.AreEqual("2", eventArgs.Value);
            Assert.AreSame(conf, eventSender);
            Assert.AreEqual(ConfigurationEventType.SetProperty, eventArgs.Type);

            conf.ClearProperty("key");
            Assert.AreEqual("key", eventArgs.Name);
            Assert.IsNull(eventArgs.Value);
            Assert.AreSame(conf, eventSender);
            Assert.AreEqual(ConfigurationEventType.ClearProperty, eventArgs.Type);

            conf.Clear();
            Assert.IsEmpty(conf.Keys);
            Assert.AreSame(conf, eventSender);
            Assert.AreEqual(ConfigurationEventType.Clear, eventArgs.Type);
        }
示例#16
0
        private void configurationService_onConfigurationEvent(object sender, ConfigurationEventArgs e)
        {
            if (e.Value == null)
            {
                return;
            }

            switch (e.Folder)
            {
            case Configuration.ConfFolder.IDENTITY:
            {
                switch (e.Entry)
                {
                case Configuration.ConfEntry.DISPLAY_NAME:
                {
                    this.labelDisplayName.Content = e.Value;
                    break;
                }
                }
                break;
            }

            case Configuration.ConfFolder.RCS:
            {
                switch (e.Entry)
                {
                case Configuration.ConfEntry.FREE_TEXT:
                {
                    this.labelFreeText.Content = e.Value;
                    break;
                }
                }
                break;
            }
            }
        }
示例#17
0
 protected override void OnDefaultConfigurationChanged(ConfigurationEventArgs args)
 {
     base.OnDefaultConfigurationChanged(args);
 }
示例#18
0
 private void OnConfigurationEvent(object sender, ConfigurationEventArgs e)
 {
     _console.OutputInformation($"{e.Command}: {e.Response}");
 }
示例#19
0
        static void HandleDirectoryLookups(Object sender, ConfigurationEventArgs e)
        {
            e.Result = null; // not found example just return after this
            // return;  // uncomment to just return not-fouond

            // return a directory object that will work
            var evt       = e.FsArgs.Parameters;               // Get the raw event that generated the userDir lookup
            var eventName = evt.GetHeader("Event-Name").value; // Find the event name

            // If your module handles voicemail authorization then implment the following
            // to update the voicemail password, when they change their voicemail password using TUI
            if (eventName == "CUSTOM")
            {
                var subClass = evt.GetValueOfHeader("Event-Subclass");
                if (subClass == "vm::maintenance")
                {
                    var vmaction    = evt.GetValueOfHeader("VM-Actoun");
                    var username    = evt.GetValueOfHeader("VM-User");
                    var newPassword = evt.GetValueOfHeader("VM-User-Password");
                    if (vmaction == "change-password" && !string.IsNullOrEmpty(username) &&
                        !String.IsNullOrEmpty(newPassword))
                    {
                        // implment your code to update the users vm password in your database
                        return; // No more processing we don't actually do an auth just a notification
                    }
                }
            }

            // to make sure we don't have some future events messing us up...
            if (eventName != "REQUEST_PARAMS" && eventName != "GENERAL")
            {
                return;
            }

            // implment the following if you want to handle gateway lookup from directory when a profile loads
            if (evt.GetValueOfHeader("purpose") == "gateways")
            {
                var profileName = evt.GetValueOfHeader("profile");
                // implment your gateway lookup
                //e.Result = new fsDomainGatewayDirectoryDocument(myGwStructure);
                return;
            }

            var action = evt.GetValueOfHeader("action", "none"); // get the action

            // If you want to handle ESL Logins implment the following
            if (action == "event_socket_auth")
            {
                // preform your stuff here
                // e.result = ...
                return;
            }

            // Normal lookup processing
            if (evt.GetHeader("user") == null || evt.GetHeader("domain") == null)
            {
                return; // does't have required fields
            }
            var method = evt.GetValueOfHeader("sip_auth_method", "unknown");
            var user   = evt.GetValueOfHeader("user");
            var domain = evt.GetValueOfHeader("domain");

            // Some variables to return the params and variables section of the user record
            var variables = new Dictionary <String, String>();
            var uparams   = new Dictionary <String, String>();


            // if you're implmenting reverse-auth of devices
            if (action == "reverse-auth-lookup")
            {
                // lookup stuff in your db
                uparams.Add("reverse-auth-user", "device uername");
                uparams.Add("reverse-auth-pass", "device password");
            }

            // if you handle voicemail passwords ...
            if (true /*check for voicemail box */)
            {
                uparams.Add("vm-password", "theirvmpassword");
                // the following is optional
                uparams.Add("MWI-Account", "registrationstring");
            }
            // add more parameters here
            uparams.Add("anyotherparameters", "value");

            // add variables here for example
            variables.Add("user_context", "theuserscontext");

            e.Result = new fsDirectoryDocument(
                domain,
                user,
                "theirpassword",
                uparams,
                variables);

            return;
        }
示例#20
0
 private static void OnConfigurationComplete(object sender, ConfigurationEventArgs configurationEventArgs)
 {
     configurationEventArgs.Configuration.IdempotenceTracker = IdempotenceTracker.Default();
 }
 void OnConfugurationChanged(object ob, ConfigurationEventArgs args)
 {
     OnActiveConfigurationChanged();
 }
 private void OnConfigurationChanged(object sender, ConfigurationEventArgs args)
 {
     Interlocked.Increment(ref m_EventCount);
 }
示例#23
0
 private void OnConfigurationChange(object s, ConfigurationEventArgs e)
 {
     maxMessages = Configuration.GetInt("maxConsoleMessages", 250);
 }
 private void OnConfigurationChanged(object sender, ConfigurationEventArgs args)
 {
     if (args.BeforeOperation)
     {
         return;
     }
     switch (args.Type)
     {
         case ConfigurationEventType.AddProperty:
         case ConfigurationEventType.SetProperty:
         case ConfigurationEventType.ClearProperty:
             ++m_EventCount;
             break;
     }
 }
示例#25
0
 private void OnConfigurationChanged(object sender, ConfigurationEventArgs args)
 {
     Interlocked.Increment(ref m_EventCount);
 }
 private void OnConfigurationChange(object s, ConfigurationEventArgs e)
 {
     var old = shouldUpdate;
       shouldUpdate = Configuration.GetBool("objExpAutoUpdate", false);
       if (!old)
       {
     StartCoroutine(AutoUpdate());
       }
 }
示例#27
0
 /// <summary>
 ///     Handles the QueryConfiguration event of the Solution control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="ConfigurationEventArgs" /> instance containing the event data.</param>
 private void Solution_QueryConfiguration(object sender, ConfigurationEventArgs e)
 {
     e.ConfigurationLayer = LoadConfigurationLayer();
 }