コード例 #1
0
ファイル: Filetype.cs プロジェクト: killbug2004/WSProf
        public ActionFiletype(ActionFiletype rhs, bool readOnly, bool createNewId) 
            : base(rhs, readOnly, createNewId)
        {
            if (rhs == null)
            {
                Utilities.ErrorMessage errorMessage = new Utilities.ErrorMessage(
                    "INPUT_FILETYPE_NULL",
                    "Workshare.Policy.Properties.Resources", 
                    Assembly.GetExecutingAssembly());
				Logger.LogError(errorMessage.LogString);
				throw new Workshare.Policy.Exceptions.ArgumentNullException("rhs", errorMessage.DisplayString);
            }
            m_fileType  = rhs.m_fileType;
            m_apply = rhs.m_apply;
        }
コード例 #2
0
        private void buttonOK_Click(object sender, EventArgs e)
        {
            ActionUIItem auii = comboBoxActions.SelectedItem as ActionUIItem;
            if (auii == null)
                return;

            m_baseAction = auii.ActionName;
            m_myName = textBoxMyName.Text;

            ActionObjectDefinition aoDef = m_actions[((ActionUIItem)comboBoxActions.SelectedItem).ActionName];
            m_assemblyName = aoDef.AssemblyName;
            m_className = aoDef.ClassName;
			m_baseAction = aoDef.Type;
			m_basePrecedence = GetSequenceFromResourceActionForType(m_baseAction);
            m_precedence = aoDef.Precedence;			

            m_runAt = ConvertRunAt(comboBoxRunAt.SelectedItem.ToString());

            m_listItems = new Dictionary<string, ActionDataElement>();            
            foreach (ListViewItem lvi in actionOptionsListView.Items)
            {
                if (lvi.Tag.ToString().CompareTo("Select All") == 0 ||
                    lvi.Tag.ToString().CompareTo("Separator") == 0)
                    continue;

                Guid id = (Guid) lvi.Tag;

                ActionDataElement ade = m_displayedActionDataElements[id];
                Control embeddedControl = actionOptionsListView.GetEmbeddedControl(1, lvi.Index);
                if (embeddedControl != null && embeddedControl.GetType().Name == "TextBox")
                {
                    ade.Value = embeddedControl.Text;
                }
                else if (embeddedControl != null && embeddedControl.GetType().Name == "CheckBox")
                {
                    ade.Value = ((CheckBox)embeddedControl).Checked;
                }
                else if (embeddedControl != null && embeddedControl.GetType().Name == "DateTimePicker")
                {
                    ade.Value = ((DateTimePicker)embeddedControl).Value;
                }
                else if (embeddedControl != null && embeddedControl.GetType().Name == "CheckedListBox")
                {
                    ade.Value = GetStringsFromCheckedListBox((CheckedListBox)embeddedControl);
                }
                else if (embeddedControl != null && embeddedControl.GetType().Name == "ButtonWithValue")
                {
                    ade.Value = (embeddedControl as ButtonWithValue).Value;
                }
                else
                {
                    ade.IsDataSource = (aoDef.ActionProperties[id].Value is IDataSource);
                    ade.IsSystemProperty = (aoDef.ActionProperties[id].Value is ISystemProperty);
                    ade.Value = aoDef.ActionProperties[id].Value;
                }

                if (actionOptionsListView.Columns.Count > 2)
                {
                    CheckBox checkBox = actionOptionsListView.GetEmbeddedControl(2, lvi.Index) as CheckBox;
                    ade.Override = checkBox.Checked;
                    checkBox = actionOptionsListView.GetEmbeddedControl(3, lvi.Index) as CheckBox;
                    ade.Visible = checkBox.Checked;
                }

                ade.Name = aoDef.ActionProperties[id].Name;
                ade.DisplayName = aoDef.ActionProperties[id].DisplayName;
                ade.Identifier = id;

                m_listItems[lvi.Text] = ade;
            }

            //now, get the ActionDataElements that we chose not to display. These won't have changed.
            foreach (Guid key in m_nonDisplayedActionDataElements.Keys)
            {
                ActionDataElement ade = m_nonDisplayedActionDataElements[key]; 
                //ade.IsDataSource = (ade.Value is IDataSource);
                //ade.IsSystemProperty = (ade.Value is ISystemProperty);

                m_listItems[ade.DisplayName] = ade;
            }

            m_fileItems = new Dictionary<string, ActionFiletype>();
            foreach (ListViewItem item in fileTypesListView.Items)
            {
                Guid guid = (Guid)item.Tag;
                //TODO: shouldn't have our own file type enumeration in the policy designer!
				Workshare.Policy.FileType designerFileType = FileTypeBridge.GetFileType(item.Text.ToString());
                FileType fileType = (FileType)Enum.Parse(typeof(FileType), designerFileType.ToString());
                ActionFiletype fType = new ActionFiletype(guid, fileType, true);
                m_fileItems[fileType.ToString()] = fType;
            }

            GetSupportedPoliciesForActionForType(m_baseAction);

            Transparent = cbProcessTransparently.Checked;
            //AutoExpand = cbAutoExpand.Checked;
            ExecutionOption = ((ExecutionOptionItem)cmbExecutionOption.SelectedItem).ExecutionOption;
        }