/// <summary> /// Updates the values of the item. /// </summary> private void DoInsert() { // get the values to insert. mValues_ = new TsCHdaAnnotationValueCollection[] { valuesCtrl_.GetValues() }; // check if there is nothing to do. if (mValues_[0] == null || mValues_[0].Count == 0) { return; } // create item (if necessary). TsCHdaItem item = mTrend_.Items[mItem_]; if (item == null) { item = mTrend_.AddItem(mItem_); } // add the item identifier information to the collection. mValues_[0].ItemName = item.ItemName; mValues_[0].ItemPath = item.ItemPath; mValues_[0].ServerHandle = item.ServerHandle; mValues_[0].ClientHandle = item.ClientHandle; if (mSynchronous_) { // insert data. TsCHdaResultCollection[] results = mServer_.InsertAnnotations(mValues_); if (results == null || results.Length != 1) { ////throw new InvalidResponseException(); } // display results. resultsCtrl_.Initialize(mServer_, mValues_, results); // save results. mResults_ = results; } else { // check if already waiting for results. if (mAsyncSent_) { return; } // begin insert data. OpcItemResult[] results = mServer_.InsertAnnotations( mValues_, null, new TsCHdaUpdateCompleteEventHandler(OnUpdateComplete), out mRequest_); if (results == null || results.Length != 1) { ////throw new InvalidResponseException(); } // display initial results. asyncResultsCtrl_.Initialize(mServer_, results); mAsyncSent_ = true; } }
/// <summary> /// Updates the values of the item. /// </summary> private void DoInsert() { // get the values to insert. m_values = new TsCHdaAnnotationValueCollection[] { ValuesCTRL.GetValues() }; // check if there is nothing to do. if (m_values[0] == null || m_values[0].Count == 0) { return; } // create item (if necessary). TsCHdaItem item = m_trend.Items[m_item]; if (item == null) { item = m_trend.AddItem(m_item); } // add the item identifier information to the collection. m_values[0].ItemName = item.ItemName; m_values[0].ItemPath = item.ItemPath; m_values[0].ServerHandle = item.ServerHandle; m_values[0].ClientHandle = item.ClientHandle; if (m_synchronous) { // insert data. TsCHdaResultCollection[] results = m_server.InsertAnnotations(m_values); if (results == null || results.Length != 1) { ////throw new InvalidResponseException(); } // display results. ResultsCTRL.Initialize(m_server, m_values, results); // save results. m_results = results; } else { // check if already waiting for results. if (m_asyncSent) { return; } // begin insert data. OpcItemResult[] results = m_server.InsertAnnotations( m_values, null, new TsCHdaUpdateCompleteEventHandler(OnUpdateComplete), out m_request); if (results == null || results.Length != 1) { ////throw new InvalidResponseException(); } // display initial results. AsyncResultsCTRL.Initialize(m_server, results); m_asyncSent = true; } }