示例#1
0
        private void ReNameContols(string ControlType)
        {
            bool     IsReNameAll = GlobalMethods.Misc.IsEmptyString(ControlType);
            IControl control     = null;

            if (ControlType == "XCheckBox" || IsReNameAll)
            {
                control = new XCheckBox();
                this.RefreshContols(control, "XCheckBox");
            }
            if (ControlType == "XDateTime" || IsReNameAll)
            {
                control = new XDateTime();
                this.RefreshContols(control, "XDateTime");
            }
            if (ControlType == "XRadioButton" || IsReNameAll)
            {
                control = new XRadioButton();
                this.RefreshContols(control, "XRadioButton");
            }
            if (ControlType == "XTextBox" || IsReNameAll)
            {
                control = new XTextBox();
                this.RefreshContols(control, "XTextBox");
            }
            if (ControlType == "XComboBox" || IsReNameAll)
            {
                control = new XComboBox();
                this.RefreshContols(control, "XComboBox");
            }
        }
        /// <summary>
        /// 当前日期范围单选按钮选中状态改变时调用的方法
        /// </summary>
        /// <param name="sender">事件对象</param>
        /// <param name="e">事件参数</param>
        private void OnDateFilterCheckedChanged(object sender, EventArgs e)
        {
            XRadioButton myControl = sender as XRadioButton;

            if (myControl == null)
            {
                return;
            }
            if (myControl.IsChecked == false)
            {
                return;
            }

            string type = string.Empty;

            switch (myControl.Name)
            {
            case "t_rdo_Today":
                type = "Today";
                break;

            case "t_rdo_Week":
                type = "Week";
                break;

            case "t_rdo_Month":
                type = "Month";
                break;

            case "t_rdo_All":
                type = "All";
                break;

            case "t_rdo_Custom":
                type = "Custom";
                break;
            }

            DateFilterTypes myType = (DateFilterTypes)Enum.Parse(typeof(DateFilterTypes), type, true);

            if (myType == DateFilterTypes.Custom)
            {
                t_dtp_StartDate.IsEnabled = true;
                t_dtp_EndDate.IsEnabled   = true;
            }
            else
            {
                t_dtp_StartDate.IsEnabled = false;
                t_dtp_EndDate.IsEnabled   = false;
            }

            m_CurrentParam.DateFilterType = myType;

            if (ValueChanged != null)
            {
                ValueChanged(m_CurrentParam);
            }
        }
        /// <summary>
        /// 当前日期范围单选按钮选中状态改变时调用的方法
        /// </summary>
        /// <param name="sender">事件对象</param>
        /// <param name="e">事件参数</param>
        private void OnDateFilterCheckedChanged(object sender, RoutedEventArgs e)
        {
            XRadioButton myControl = sender as XRadioButton;

            if (myControl == null)
            {
                return;
            }
            if (myControl.IsChecked == false)
            {
                return;
            }

            string type = string.Empty;

            switch (myControl.Name)
            {
            case "t_rdo_Today":
                type = "Today";
                break;

            case "t_rdo_Week":
                type = "Week";
                break;

            case "t_rdo_Month":
                type = "Month";
                break;

            case "t_rdo_All":
                type = "All";
                break;

            case "t_rdo_Custom":
                type = "Custom";
                break;
            }

            m_CurrentTypes = (DateFilterTypes)Enum.Parse(typeof(DateFilterTypes), type, true);
            if (m_CurrentTypes == DateFilterTypes.Custom)
            {
                t_dtp_StartDate.IsEnabled = true;
                t_dtp_EndDate.IsEnabled   = true;
            }
            else
            {
                t_dtp_StartDate.IsEnabled = false;
                t_dtp_EndDate.IsEnabled   = false;
            }
            XTreeNode myItem    = t_tvw_Module.SelectedItem as XTreeNode;
            string    myTag     = string.Empty;
            string    parentTag = string.Empty;

            BindTreeNode();
            if (myItem == null && m_MQuery != null)
            {
                myTag = m_MQuery.BillType;
                SetSelected(t_tvw_Module.Nodes, myTag, parentTag);
            }
            else if (myItem != null)
            {
                myTag = myItem.Tag.ToString();
                if (myItem.Parent != null)
                {
                    parentTag = myItem.Parent.Tag.ToString();
                }
                SetSelected(t_tvw_Module.Nodes, myTag, parentTag);
            }
        }