示例#1
0
        /// <summary>
        /// Prompts the user to select items and specify trend properties.
        /// </summary>
        public TsCHdaTrend ShowDialog(TsCHdaServer server)
        {
            if (server == null)
            {
                throw new ArgumentNullException("server");
            }

            m_server  = server;
            m_results = null;

            // create new trend.
            TsCHdaTrend trend = new TsCHdaTrend(m_server);

            // set reasonable defaults.
            trend.StartTime = new TsCHdaTime("YEAR");
            trend.EndTime   = new TsCHdaTime("YEAR+1H");

            BrowseCTRL.Browse(m_server, null);
            TrendCTRL.Initialize(trend, RequestType.None);
            ItemsCTRL.Initialize(m_server, (OpcItem[])null);
            ResultsCTRL.Initialize(m_server, m_results);

            // update dialog state.
            SetState(false);

            // show dialog.
            if (ShowDialog() != DialogResult.OK)
            {
                return(null);
            }

            // create or update the trend.
            TrendCTRL.Update(trend);

            // add new items.
            if (m_results != null)
            {
                foreach (OpcItemResult item in m_results)
                {
                    if (item.Result.Succeeded())
                    {
                        trend.Items.Add(new TsCHdaItem(item));
                    }
                }
            }

            // return new trend.
            return(trend);
        }
示例#2
0
 /// <summary>
 /// Displays the current server status in a modal dialog.
 /// </summary>
 public void ShowDialog(TsCHdaServer server)
 {
     if (server == null)
     {
         throw new ArgumentNullException("server");
     }
     BrowseItemsTV.Browse(server, null);
     ShowDialog();
 }
示例#3
0
        /// <summary>
        /// Prompts the user to select an item and specify trend properties.
        /// </summary>
        public TsCHdaResultCollection[] ShowDialog(TsCHdaServer server, RequestType type, bool synchronous)
        {
            if (server == null)
            {
                throw new ArgumentNullException("server");
            }

            m_server      = server;
            m_type        = type;
            m_synchronous = synchronous;
            m_singleItem  = true;
            m_results     = null;

            // create new trend.
            m_trend = new TsCHdaTrend(m_server);

            // set reasonable defaults.
            m_trend.StartTime = new TsCHdaTime("YEAR");
            m_trend.EndTime   = new TsCHdaTime("YEAR+1H");

            BrowseCTRL.Browse(m_server, null);
            TrendItemsCTRL.Initialize(m_trend, false, null);
            TrendCTRL.Initialize(m_trend, type);
            ItemsCTRL.Initialize(null);
            ResultsCTRL.Initialize(m_server, null);
            AsyncResultsCTRL.Initialize(m_server, null);

            // update dialog state.
            SetState();

            // show dialog.
            bool result = (ShowDialog() == DialogResult.OK);

            // release item handles.
            m_trend.ClearItems();

            // return item values.
            return(m_results);
        }
示例#4
0
        /// <summary>
        /// Prompts the user to select attributes to read for an item.
        /// </summary>
        public TsCHdaItemAttributeCollection ShowDialog(
            TsCHdaServer server,
            OpcItem item,
            TsCHdaTime startTime,
            TsCHdaTime endTime,
            bool synchronous)
        {
            if (server == null)
            {
                throw new ArgumentNullException("server");
            }

            m_server      = server;
            m_item        = item;
            m_fixedItem   = item != null;
            m_synchronous = synchronous;
            m_results     = null;

            // create new trend.
            m_trend = new TsCHdaTrend(m_server);

            // set reasonable defaults.
            m_trend.StartTime = startTime;
            m_trend.EndTime   = endTime;

            BrowseCTRL.Browse(m_server, null);
            TrendCTRL.Initialize(m_trend, RequestType.ReadAttributes);
            AttributesCTRL.Initialize(m_server, null);
            ResultsCTRL.Initialize(m_server, m_results);
            AsyncResultsCTRL.Initialize(m_server, null);

            // update dialog state.
            SetState();

            // show dialog.
            bool result = (ShowDialog() == DialogResult.OK);

            // release item handles.
            m_trend.ClearItems();

            // return item values.
            return((result)?m_results:null);
        }
        /// <summary>
        /// Prompts the user to specify values to insert for an item.
        /// </summary>
        public bool ShowDialog(TsCHdaServer server, OpcItem item, bool replace, bool synchronous)
        {
            if (server == null)
            {
                throw new ArgumentNullException("server");
            }

            m_server      = server;
            m_replace     = replace;
            m_synchronous = synchronous;
            m_item        = item;
            m_values      = null;
            m_results     = null;

            // create new trend.
            m_trend = new TsCHdaTrend(m_server);

            // set reasonable defaults.
            m_trend.StartTime = new TsCHdaTime("YEAR");
            m_trend.EndTime   = new TsCHdaTime("YEAR+1H");

            BrowseCTRL.Browse(m_server, null);
            ValuesCTRL.Initialize(m_server, null);
            ResultsCTRL.Initialize(m_server, m_values, m_results);
            AsyncResultsCTRL.Initialize(m_server, null);

            // update dialog state.
            SetState();

            // show dialog.
            bool result = (ShowDialog() == DialogResult.OK);

            // release item handles.
            m_trend.ClearItems();

            // return dialog result.
            return(result);
        }