示例#1
0
        public override void AwakeFromNib()
        {
            base.AwakeFromNib();

            Window.Appearance      = NSAppearance.GetAppearance(NSAppearance.NameVibrantDark);
            Window.TitleVisibility = NSWindowTitleVisibility.Hidden;

            SetupStatusDisplayTextField();

            _ = NotificationCenter.AddObserver(ToggleCollapsed.Name, notification =>
            {
                NSNumber?collapsed    = (NSNumber)notification.UserInfo.ObjectForKey(IsCollapsed.NSString());
                NSNumber?segmentIndex = (NSNumber)notification.UserInfo.ObjectForKey(SegmentIndex.NSString());
                ToggleSidebarSegmentedControl.SetSelected(!collapsed.BoolValue, segmentIndex.NIntValue);
            });
        }
        protected override void Render(HtmlTextWriter output)
        {
            //Render the main div
            output.AddAttribute(HtmlTextWriterAttribute.Id, this.ClientID);
            output.AddAttribute(HtmlTextWriterAttribute.Class, this.CssClass + " panelContainer");
            output.RenderBeginTag(HtmlTextWriterTag.Div);

            output.AddAttribute(HtmlTextWriterAttribute.Class, "panelHeaderText");
            output.AddAttribute(HtmlTextWriterAttribute.Id, this.ClientID + "-header-text");
            output.RenderBeginTag(HtmlTextWriterTag.H3);
            output.Write(Title);
            output.RenderEndTag();

            //Render div for contents
            output.AddAttribute(HtmlTextWriterAttribute.Class, "panelBody");
            output.AddAttribute(HtmlTextWriterAttribute.Id, this.ClientID + "-body");
            output.RenderBeginTag(HtmlTextWriterTag.Div);

            foreach (Control c in this.Controls)
            {
                c.RenderControl(output);
            }

            output.RenderEndTag();
            output.RenderEndTag();

            //Hidden var for keeping status
            if (AllowCollapsing)
            {
                output.AddAttribute(HtmlTextWriterAttribute.Type, "hidden");
                output.AddAttribute(HtmlTextWriterAttribute.Name, this.ClientID + "-collapsedStatus");
                output.AddAttribute(HtmlTextWriterAttribute.Id, this.ClientID + "-collapsedStatus");
                output.AddAttribute(HtmlTextWriterAttribute.Value, IsCollapsed.ToString());
                output.RenderBeginTag(HtmlTextWriterTag.Input);
                output.RenderEndTag();

                //Script to init the box.
                output.AddAttribute("type", "text/javascript");
                output.RenderBeginTag(HtmlTextWriterTag.Script);
                output.Write(GetJSObjCreationString());
                output.RenderEndTag();
            }
        }
示例#3
0
 public override int GetHashCode()
 {
     return(Tag.GetHashCode() ^ Extent.GetHashCode() ^ IsCollapsed.GetHashCode());
 }
        /// <summary>
        /// Generates Xml representation of this gadget
        /// </summary>
        /// <param name="doc">The Xml docment</param>
        /// <returns>XmlNode</returns>
        public override XmlNode Serialize(XmlDocument doc)
        {
            CombinedFrequencyParameters combFreqParameters = (CombinedFrequencyParameters)Parameters;

            System.Xml.XmlElement element = doc.CreateElement("combinedFrequencyGadget");
            //element.InnerXml = xmlString;
            element.AppendChild(SerializeFilters(doc));

            System.Xml.XmlAttribute id           = doc.CreateAttribute("id");
            System.Xml.XmlAttribute locationY    = doc.CreateAttribute("top");
            System.Xml.XmlAttribute locationX    = doc.CreateAttribute("left");
            System.Xml.XmlAttribute collapsed    = doc.CreateAttribute("collapsed");
            System.Xml.XmlAttribute type         = doc.CreateAttribute("gadgetType");
            System.Xml.XmlAttribute actualHeight = doc.CreateAttribute("actualHeight");

            id.Value           = this.UniqueIdentifier.ToString();
            locationY.Value    = Canvas.GetTop(this).ToString("F0");
            locationX.Value    = Canvas.GetLeft(this).ToString("F0");
            collapsed.Value    = IsCollapsed.ToString();
            type.Value         = "EpiDashboard.CombinedFrequencyControl";
            actualHeight.Value = this.ActualHeight.ToString();

            element.Attributes.Append(locationY);
            element.Attributes.Append(locationX);
            element.Attributes.Append(collapsed);
            element.Attributes.Append(type);
            element.Attributes.Append(id);
            if (IsCollapsed == false)
            {
                element.Attributes.Append(actualHeight);
            }

            XmlElement combineModeElement = doc.CreateElement("combineMode");

            combineModeElement.InnerText = combFreqParameters.CombineMode.ToString();
            element.AppendChild(combineModeElement);

            XmlElement trueValueElement = doc.CreateElement("trueValue");

            trueValueElement.InnerText = combFreqParameters.TrueValue.ToString();
            element.AppendChild(trueValueElement);

            XmlElement sortElement = doc.CreateElement("sort");

            if (combFreqParameters.SortHighToLow)
            {
                sortElement.InnerText = "hightolow";
            }
            element.AppendChild(sortElement);

            XmlElement showDenominatorElement = doc.CreateElement("showDenominator");

            showDenominatorElement.InnerText = combFreqParameters.ShowDenominator.ToString();
            element.AppendChild(showDenominatorElement);

            XmlElement customHeadingElement = doc.CreateElement("customHeading");

            customHeadingElement.InnerText = combFreqParameters.GadgetTitle.Replace("<", "&lt;");
            element.AppendChild(customHeadingElement);

            XmlElement customDescElement = doc.CreateElement("customDescription");

            customDescElement.InnerText = combFreqParameters.GadgetDescription.Replace("<", "&lt;");
            element.AppendChild(customDescElement);

            SerializeAnchors(element);

            XmlElement groupItemElement = doc.CreateElement("groupFields");

            string xmlGroupItemString = string.Empty;

            foreach (string columnName in combFreqParameters.ColumnNames)
            {
                xmlGroupItemString = xmlGroupItemString + "<groupField>" + columnName.Replace("<", "&lt;") + "</groupField>";
            }

            groupItemElement.InnerXml = xmlGroupItemString;

            if (!String.IsNullOrEmpty(xmlGroupItemString))
            {
                element.AppendChild(groupItemElement);
            }

            return(element);
        }