示例#1
0
        /// <summary>
        /// Read XML node of a user info collection
        /// </summary>
        /// <param name="xCollection">XML node to read</param>
        /// <returns>Node reading error: True = No error / False =  Error</returns>
        public bool Read_UserInfoCollectionXmlNode(XmlNode xCollection)
        {
            try
            {
                Informations = new List <CS_RecordUserInfo>();

                foreach (XmlNode xInfo in xCollection.ChildNodes)
                {
                    if (xInfo.Name.Equals("UserInfo"))
                    {
                        CS_RecordUserInfo sInfo = new CS_RecordUserInfo();

                        sInfo.Title = xInfo.Attributes["Title"].Value;
                        sInfo.Value = xInfo.InnerText;

                        Informations.Add(sInfo);
                    }
                }
            }
            catch
            {
                return(false);
            }

            return(true);
        }
示例#2
0
        private void Export_UserInfo()
        {
            Dlg_SaveFile.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\CANStream\\Record User Information";

            if (Dlg_SaveFile.ShowDialog().Equals(DialogResult.OK))
            {
                CS_RecordUserInfoCollection oInfoCollection = new CS_RecordUserInfoCollection();

                foreach (DataGridViewRow oRow in Grid_UserInfos.Rows)
                {
                    if (!(oRow.Cells[0].Value == null))
                    {
                        CS_RecordUserInfo sInfo = new CS_RecordUserInfo();
                        sInfo.Title = oRow.Cells[0].Value.ToString();

                        if (!(oRow.Cells[1].Value == null))
                        {
                            sInfo.Value = oRow.Cells[1].Value.ToString();
                        }

                        oInfoCollection.Informations.Add(sInfo);
                    }
                }

                oInfoCollection.Write_UserInfoCollection(Dlg_SaveFile.FileName);
            }
        }
示例#3
0
        /// <summary>
        /// Return a clone of the current object
        /// </summary>
        /// <returns>Clone of the current object</returns>
        public CS_RecordSession Clone()
        {
            CS_RecordSession oClone = new CS_RecordSession();

            oClone.Name        = Name;
            oClone.SessionDate = SessionDate;
            oClone.Comment     = Comment;

            foreach (CS_RecordUserInfo sInfo in UserInfos.Informations)
            {
                CS_RecordUserInfo rui = new CS_RecordUserInfo();
                rui.Title = sInfo.Title;
                rui.Value = sInfo.Value;

                oClone.UserInfos.Informations.Add(rui);
            }

            return(oClone);
        }
示例#4
0
        private void AddEvent(CS_RecordEvent Evt)
        {
            CS_RecordEvent oEvent = new CS_RecordEvent();

            oEvent.Sessions.Clear();

            oEvent.Name         = Evt.Name;
            oEvent.StartingDate = Evt.StartingDate;
            oEvent.Comment      = Evt.Comment;

            foreach (CS_RecordUserInfo sInfo in Evt.UserInfos.Informations)
            {
                CS_RecordUserInfo rui = new CS_RecordUserInfo();
                rui.Title = sInfo.Title;
                rui.Value = sInfo.Value;

                oEvent.UserInfos.Informations.Add(rui);
            }

            RecordEvents.Add(oEvent);
        }
示例#5
0
        /// <summary>
        /// Return the user inforamtions collection hosted by the control
        /// </summary>
        /// <returns>User inforamtions collection hosted by the control</returns>
        public CS_RecordUserInfoCollection Get_UserInformations()
        {
            UserInformations = new CS_RecordUserInfoCollection();

            foreach (DataGridViewRow oRow in Grid_UserInfos.Rows)
            {
                if (!(oRow.Cells[0].Value == null))
                {
                    CS_RecordUserInfo sInfo = new CS_RecordUserInfo();
                    sInfo.Title = oRow.Cells[0].Value.ToString();

                    if (!(oRow.Cells[1].Value == null))
                    {
                        sInfo.Value = oRow.Cells[1].Value.ToString();
                    }

                    UserInformations.Informations.Add(sInfo);
                }
            }

            return(UserInformations);
        }
示例#6
0
        private void Copy_UserInfo()
        {
            if (!(Grid_UserInfos.SelectedCells == null))
            {
                oUserInfoClipBoard = new CS_RecordUserInfoCollection();

                foreach (DataGridViewRow oRow in Grid_UserInfos.SelectedRows)
                {
                    if (!(oRow.Cells[0].Value == null))
                    {
                        CS_RecordUserInfo sInfo = new CS_RecordUserInfo();
                        sInfo.Title = oRow.Cells[0].Value.ToString();

                        if (!(oRow.Cells[1].Value == null))
                        {
                            sInfo.Value = oRow.Cells[1].Value.ToString();
                        }

                        oUserInfoClipBoard.Informations.Add(sInfo);
                    }
                }
            }
        }