コード例 #1
0
        /// <summary>
        /// Loads and initializes the channels.
        /// </summary>
        public static void Channels()
        {
            var channels = ClientState.Current.DataService.SelectAll <ChannelConfig>();

            foreach (var channel in channels)
            {
                ChannelsManager.Add(ChannelFactory.Create(channel));
            }
        }
コード例 #2
0
        /// <summary>
        /// Saves the channel.
        /// </summary>
        /// <param name="values">The values.</param>
        void SaveChannel(Dictionary <string, object> values)
        {
            var config = new ChannelConfig
            {
                DisplayName          = ChannelConfiguration.DisplayName,
                Hostname             = ChannelConfiguration.InputChannel.Hostname,
                Port                 = ChannelConfiguration.InputChannel.Port,
                Username             = ChannelConfiguration.InputChannel.Authentication.Username,
                Password             = ChannelConfiguration.InputChannel.Authentication.Password,
                SSL                  = ChannelConfiguration.InputChannel.IsSecured,
                Type                 = ChannelConfiguration.InputChannel.TypeSurrogate,
                IsVisible            = true,
                IsDefault            = ChannelConfiguration.IsDefault,
                IsManuallyCustomized = IsManuallyCustomized,
                DateCreated          = DateTime.Now
            };

            if (ChannelConfiguration.OutputChannel != null)
            {
                config.OutgoingUsername = ChannelConfiguration.OutputChannel.Authentication.Username;
                config.OutgoingPassword = ChannelConfiguration.OutputChannel.Authentication.Password;
                config.OutgoingHostname = ChannelConfiguration.OutputChannel.Hostname;
                config.OutgoingPort     = ChannelConfiguration.OutputChannel.Port;
                config.OutgoingSSL      = ChannelConfiguration.OutputChannel.IsSecured;
            }

            config.ChannelConnection = ChannelConnection.Local;

            ClientState.Current.DataService.Save(config);

            // Replace ChannelConfiguration with new channel instance
            ChannelConfiguration = ChannelFactory.Create(config);

            // Save temporary settings to channelcontext
            var context = new ChannelClientContext(ClientState.Current.Context, ChannelConfiguration);

            values.Keys.ForEach(key => context.SaveSetting(key, values[key]));

            var instance = ChannelsManager.Add(ChannelConfiguration);

            if (instance.StatusUpdatesChannel != null)
            {
                EventBroker.Publish(AppEvents.RequestDockChannel, instance);
            }
        }
コード例 #3
0
 public IActionResult Add([FromBody] FlowChannel channel)
 {
     return(_channelsManager.Add(channel, User?.Identity?.Name));
 }
コード例 #4
0
 public IActionResult Add([FromBody] DensityChannel channel)
 {
     return(_manager.Add(channel, User?.Identity?.Name));
 }