示例#1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="cmd"></param>
        private void ProcessReadDateCmd(CommCmdBase cmd)
        {
            ReadDateCommand rdcmd = cmd as ReadDateCommand;

            Debug.Assert(rdcmd != null);

            ListViewItem lvi = this.lvXg.SelectedItems[0];

            lvi.SubItems[1].Text = string.Format(
                "20{0}-{1}-{2}",
                rdcmd.Year.ToString("d2"),
                rdcmd.Month,
                rdcmd.Day
                );
        }
示例#2
0
        /// <summary>
        /// Read all xgstation Time or Date process
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void t_AfterProcessReceived(object sender, EventArgs e)
        {
            Task t = sender as Task;

            if (t.LastCommResultState == CommResultState.Correct)
            {
                XGStation xgst = t.CommCmd.Station as XGStation;
                if (t.CommCmd is ReadTimeCommand)
                {
                    ReadTimeCommand rtCmd  = t.CommCmd as ReadTimeCommand;
                    TimeSpan        xgTime = new TimeSpan(
                        0,
                        rtCmd.Hour,
                        rtCmd.Minute,
                        rtCmd.Second
                        );
                    // TODO: 2007-11-8 应先设置xgst.DtCollXgCtrlTime, 否则更新
                    //      xgCtrlTime时候,刷新listview控件是使用的是上次的采集时间
                    //
                    //xgst.XgCtrlTime = xgTime;
                    //xgst.DtCollXgCtrlTime = DateTime.Now;
                    xgst.DtCollXgCtrlTime = DateTime.Now;
                    xgst.XgCtrlTime       = xgTime;
                }
                else if (t.CommCmd is ReadDateCommand)
                {
                    ReadDateCommand rdCmd  = t.CommCmd as ReadDateCommand;
                    DateTime        xgDate = new DateTime(
                        // 2007-11-8 Modify rdCmd.Year,
                        //
                        2000 + rdCmd.Year,
                        rdCmd.Month,
                        rdCmd.Day
                        );
                    xgst.XgCtrlDate = xgDate;
                }
            }
        }