Ejemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the class. Call the Initialize() static method.
 /// </summary>
 /// <param name="worksetCollectionType">The type of workset collection.</param>
 /// <param name="entryCountMax">The maximum number of entries that each workset can support.</param>
 /// <param name="columnCountMax">The maximum number of display columns that each workset can support.</param>
 public WorksetCollection(WorksetCollectionType worksetCollectionType, short entryCountMax, short columnCountMax)
 {
     Initialize(worksetCollectionType, entryCountMax, columnCountMax);
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the class.
        /// <list type="number">
        /// <item><description>Clear the existing list of worksets.</description></item>
        /// <item><description>Create a baseline workset and add this to the list of worksets.</description></item>
        /// <item><description>Set the newly created baseline workset to be the default workset.</description></item>
        /// <item><description>Copy the project information specified in the data dictionary to the project information field.</description></item>
        /// </list>
        /// </summary>
        /// <param name="worksetCollectionType">The type of workset collection.</param>
        /// <param name="entryCountMax">The maximum number of entries that each workset can support.</param>
        /// <param name="columnCountMax">The maximum number of display columns that each workset can support.</param>
        public void Initialize(WorksetCollectionType worksetCollectionType, short entryCountMax, short columnCountMax)
        {
            m_WorksetCollectionFile_t = new WorksetCollectionFile_t();
            m_WorksetCollectionFile_t.ProjectInformation = Parameter.ProjectInformation;
            m_WorksetCollectionFile_t.WorksetCollectionType = worksetCollectionType;
            m_WorksetCollectionFile_t.EntryCountMax = entryCountMax;
            m_WorksetCollectionFile_t.ColumnCountMax = columnCountMax;

            // Instantiate the list of workset structures.
            m_WorksetCollectionFile_t.WorksetList = new List<Workset_t>();

            // Create a new baseline workset i.e. one containing ALL watch variable references, ordered by watch identifier.
            Workset_t workset = new Workset_t();
            workset = CreateBaselineWorkset();

            // Add this baseline workset to the list.
            m_WorksetCollectionFile_t.WorksetList.Add(workset);

            // Set the active index to point at the baseline workset.
            m_WorksetCollectionFile_t.ActiveIndex = 0;

            // Set the default index to point at the baseline workset.
            m_WorksetCollectionFile_t.DefaultIndex = 0;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Report those worksets that contain one or more old identifier references that are not defined in the current data dictionary.
        /// </summary>
        /// <param name="invalidOldIdentifierWorksetList">A list of those worksets that contain one or more old identifier references that are not defined in the 
        /// current data dictionary.</param>
        /// <param name="invalidOldIdentifierList">A list of the old identifier references included in the workset file that are not defined in the data dictionary.</param>
        /// <param name="worksetCollectionType">The type of workset being processed.</param>
        private static void ReportIncompatibleWorksets(List<Workset_t> invalidOldIdentifierWorksetList, List<short> invalidOldIdentifierList, WorksetCollectionType worksetCollectionType)
        {
            // Build and format the list of worksets that are effected.
            StringBuilder stringBuilder = new StringBuilder(Environment.NewLine);
            stringBuilder.AppendLine();
            for (int index = 0; index < invalidOldIdentifierWorksetList.Count; index++)
            {
                string lineTerminator = (index == invalidOldIdentifierWorksetList.Count - 1) ? CommonConstants.Period : CommonConstants.Comma;
                stringBuilder.AppendLine(CommonConstants.SpaceX4 + (index + 1).ToString(CommonConstants.FormatStringListNumbering) + CommonConstants.FullStop + invalidOldIdentifierWorksetList[index].Name + lineTerminator);
            }
            stringBuilder.AppendLine();
            string invalidOldIdentifierWorksetListText = stringBuilder.ToString();

            // Build and format the list of invalid old identifiers.
            stringBuilder = new StringBuilder(string.Empty);
            for (int index = 0; index < invalidOldIdentifierList.Count; index++)
            {
                string lineTerminator = (index == invalidOldIdentifierList.Count - 1) ? CommonConstants.Period : CommonConstants.Comma;
                stringBuilder.Append(invalidOldIdentifierList[index].ToString() + lineTerminator);
            }
            string invalidOldIdentifierListText = stringBuilder.ToString(); 

            string worksetCollectionTypeText;
            switch (worksetCollectionType)
            {
                case WorksetCollectionType.RecordedWatch:
                    worksetCollectionTypeText = Resources.NameConfigureWorksetsWatchWindowMenuOption;
                    break;
                case WorksetCollectionType.FaultLog:
                    worksetCollectionTypeText = Resources.NameConfigureWorksetsFaultLogMenuOption;
                    break;
                case WorksetCollectionType.Chart:
                    worksetCollectionTypeText = Resources.NameConfigureWorksetsChartRecorderMenuOption;
                    break;
                default:
                    worksetCollectionTypeText = string.Empty;
                    Debug.Assert(false, "ReportIncompatibleWorksets - [invalid worksetCollectionType]");
                    break;
            }
            
            // Notify the user of the worksets that contain too many watch variables.
            System.Windows.Forms.MessageBox.Show(string.Format(Resources.MBTWorksetsOldIdentifiersInvalid, worksetCollectionTypeText) + invalidOldIdentifierWorksetListText +
                                                 string.Format(Resources.MBTInvalidOldIdentifierList, invalidOldIdentifierListText) + Environment.NewLine + Environment.NewLine +
                                                 Resources.MBTInstructionConfigureWorksets,
                                                 Resources.MBCaptionWarning, System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Warning);
        }