Exemple #1
0
        private void btnExport_Click(object sender, EventArgs e)
        {
            // отправка команды экспорта
            int    ctrlCnlNum;
            string cmdDataStr = cbDataSource.Text;

            if (sender == btnExportArcData)
            {
                ctrlCnlNum = ArcDataCtrlCnlNum;
                DateTime dateTime = dtpArcDataDate.Value.Date.Add(dtpArcDataTime.Value.TimeOfDay);
                cmdDataStr += "\n" + ScadaUtils.XmlValToStr(dateTime);
            }
            else if (sender == btnExportEvents)
            {
                ctrlCnlNum = EventsCtrlCnlNum;
                DateTime date = dtpEventsDate.Value.Date;
                cmdDataStr += "\n" + ScadaUtils.XmlValToStr(date);
            }
            else
            {
                ctrlCnlNum = CurDataCtrlCnlNum;
            }

            byte[] cmdData = Encoding.Default.GetBytes(cmdDataStr);

            if (ServerComm.SendBinaryCommand(0, ctrlCnlNum, cmdData, out bool result))
            {
                ScadaUiUtils.ShowInfo(ModPhrases.CmdSentSuccessfully);
            }
            else
            {
                ScadaUiUtils.ShowError(ServerComm.ErrMsg);
            }
        }