Esempio n. 1
0
        private void SaveChannels()
        {
            Interfaces.IChannel[] channels = new Interfaces.IChannel[grid.RowsCount - 1];
            for (int i = 1; i < grid.RowsCount; i++)
            {
                string name     = grid[i, 0].DisplayText;
                double interval = (double)(grid[i, 2]).Value;

                string type = null;
                foreach (KeyValuePair <string, string> pair in variableTypeNames)
                {
                    if (grid[i, 1].DisplayText == pair.Value)
                    {
                        type = pair.Key;
                        break;
                    }
                }
                if (type == null)
                {
                    continue;
                }

                channels[i - 1] = ChannelFactory.CreateChannel(type, name, plugin, interval);
            }
            plugin.Channels = channels;
            plugin.SaveSettings();
        }
Esempio n. 2
0
        private void SaveSettings()
        {
            Interfaces.IChannel[] channels = new Interfaces.IChannel[grid.RowsCount - 1];
            for (int i = 1; i < grid.RowsCount; i++)
            {
                channels[i - 1] = (Interfaces.IChannel)grid[i, gridColName].Tag;
            }
            plugin.Channels = channels;

            IModbusStation[] stations = new IModbusStation[stationGrid.RowsCount - 1];
            for (int i = 1; i < stationGrid.RowsCount; i++)
            {
                stations[i - 1] = (IModbusStation)stationGrid[i, stationGridColName].Tag;
                stations[i - 1].StationActive = (bool)stationGrid[i, stationGridColActive].Value;
            }
            plugin.Stations = stations;

            foreach (IModbusStation stat in stations)
            {
                stat.ClearChannels();
                foreach (ModbusChannelImp chan in channels)
                {
                    if (chan.ModbusStation == stat.Name)
                    {
                        stat.AddChannel(chan);
                        chan.MyStation = (ModbusBaseClientStation)stat;
                    }
                }
            }

            plugin.SaveSettings();
        }
        private void SaveSettings()
        {
            Interfaces.IChannel[] channels = new Interfaces.IChannel[grid.RowsCount - 1];
            for (int i = 1; i < grid.RowsCount; i++)
            {
                channels[i - 1] = (Interfaces.IChannel)grid[i, gridColName].Tag;
            }
            plugin.Channels = channels;

            SNMPAgent[] agents = new SNMPAgent[agentGrid.RowsCount - 1];
            for (int i = 1; i < agentGrid.RowsCount; i++)
            {
                agents[i - 1]             = (SNMPAgent)agentGrid[i, agentGridColName].Tag;
                agents[i - 1].AgentActive = (bool)agentGrid[i, agentGridColActive].Value;
            }
            plugin.Agents = agents;

            foreach (SNMPAgent stat in agents)
            {
                stat.ClearChannels();
                foreach (SNMPChannelImp chan in channels)
                {
                    if (chan.AgentName == stat.Name)
                    {
                        stat.AddChannel(chan);
                        chan.MyAgent = (SNMPAgent)stat;
                    }
                }
            }

            plugin.SaveSettings();
        }
Esempio n. 4
0
 private void SaveChannels()
 {
     Interfaces.IChannel[] channels = new Interfaces.IChannel[grid.RowsCount - 1];
     for (int i = 1; i < grid.RowsCount; i++)
     {
         channels[i - 1] = ChannelFactory.CreateChannel(grid[i, 0].DisplayText,
                                                        plugin,
                                                        grid[i, 1].DisplayText,
                                                        grid[i, 2].DisplayText,
                                                        grid[i, 3].DisplayText);
     }
     plugin.Channels = channels;
     plugin.SaveSettings();
 }
Esempio n. 5
0
 protected override void BeginQuery()
 {
     if (ChannelName.Equals(string.Empty))
     {
         return;
     }
     FreeSCADA.Interfaces.IChannel ch;
     ch      = Env.Current.CommunicationPlugins.GetChannel(ChannelName);
     channel = ch;
     if (Env.Current.Mode == FreeSCADA.Interfaces.EnvironmentMode.Designer && !IsBindInDesign || StopUpdate)
     {
         ch = null;
     }
     base.OnQueryFinished(ch);
 }
Esempio n. 6
0
        private void SaveChannels()
        {
            Interfaces.IChannel[] channels = new Interfaces.IChannel[grid.RowsCount - 1];
            for (int i = 1; i < grid.RowsCount; i++)
            {
                Type type = typeof(object);
                if (grid.Rows[i].Tag != null && grid.Rows[i].Tag is Type)
                {
                    type = grid.Rows[i].Tag as Type;
                }

                channels[i - 1] = ChannelFactory.CreateChannel(grid[i, 0].DisplayText,
                                                               plugin,
                                                               grid[i, 2].DisplayText,
                                                               grid[i, 1].DisplayText,
                                                               (int)grid[i, 3].Value,
                                                               type);
            }
            plugin.Channels = channels;
            plugin.SaveSettings();
        }
Esempio n. 7
0
        private void SaveChannels()
        {
            Interfaces.IChannel[] channels = new Interfaces.IChannel[grid.RowsCount - 1];
            for (int i = 1; i < grid.RowsCount; i++)
            {
                string name     = grid[i, 0].DisplayText;
                bool   readOnly = (bool)((SourceGrid.Cells.CheckBox)grid[i, 2]).Checked;

                string type = null;
                foreach (KeyValuePair <string, string> pair in variableTypeNames)
                {
                    if (grid[i, 1].DisplayText == pair.Value)
                    {
                        type = pair.Key;
                        break;
                    }
                }
                if (type == null)
                {
                    continue;
                }

                if (type == typeof(ComputableChannel).FullName)
                {
                    string expression = "";
                    if (grid.Rows[i].Tag != null)
                    {
                        expression = (string)grid.Rows[i].Tag;
                    }
                    channels[i - 1] = new ComputableChannel(name, plugin, expression);
                }
                else
                {
                    channels[i - 1] = ChannelFactory.CreateChannel(type, name, readOnly, plugin);
                }
            }
            plugin.Channels = channels;
            plugin.SaveSettings();
        }