/// <summary> /// Allows a designer to change or remove items from the set /// of properties that it exposes through a <see cref="T:System.ComponentModel.TypeDescriptor"/>. /// </summary> /// <param name="properties">The properties for the class of the component.</param> protected override void PostFilterProperties(IDictionary properties) { properties.Remove("CategoryName"); properties.Remove("CounterName"); base.PostFilterProperties(properties); }
/// <summary> /// Allows a designer to change or remove items from the set /// of events that it exposes through a <see cref="T:System.ComponentModel.TypeDescriptor"/>. /// </summary> /// <param name="events">The events for the class of the component.</param> protected override void PostFilterEvents(IDictionary events) { events.Remove("CategoryNameChanged"); events.Remove("CounterNameChanged"); base.PostFilterEvents(events); }
/// <summary> /// Adjusts the set of properties the component will expose through a <see cref="T:System.ComponentModel.TypeDescriptor" />. /// </summary> /// <param name="properties">An <see cref="T:System.Collections.IDictionary" /> that contains the properties for the class of the component.</param> protected override void PreFilterProperties(IDictionary properties) { properties.Remove("ImeMode"); properties.Remove("Padding"); properties.Remove("FlatAppearance"); properties.Remove("FlatStyle"); properties.Remove("AutoEllipsis"); properties.Remove("UseCompatibleTextRendering"); properties.Remove("Image"); properties.Remove("ImageAlign"); properties.Remove("ImageIndex"); properties.Remove("ImageKey"); properties.Remove("ImageList"); properties.Remove("TextImageRelation"); properties.Remove("BackgroundImage"); properties.Remove("BackgroundImageLayout"); properties.Remove("UseVisualStyleBackColor"); //properties.Remove("Font"); properties.Remove("RightToLeft"); base.PreFilterProperties(properties); }
protected override void PreFilterProperties(IDictionary properties) { base.PreFilterProperties(properties); #if NOTDEF // We add a design-time property called TrackSelection that is used to track // the active selection. If the user sets this to true (the default), then // we will listen to selection change events and update the control's active // control to point to the current primary selection. GA ga = (GA) Component; if ( ga.EncodingType == EncodingType.Custom ) { properties.Remove("ChromosomeLength"); } if ( ga.EncodingType != EncodingType.Integer ) { properties.Remove("MaxIntValue"); properties.Remove("MinIntValue"); } if ( ga.EncodingType != EncodingType.Real ) { properties.Remove("MaxDoubleValue"); properties.Remove("MinDoubleValue"); } // properties["TrackSelection"] = TypeDescriptor.CreateProperty( // this.GetType(), // the type this property is defined on // "TrackSelection", // the name of the property // typeof(bool), // the type of the property // new Attribute[] {CategoryAttribute.Design}); // attributes #endif }
public override void Init (TemplateParser parser, ControlBuilder parentBuilder, Type type, string tagName, string id, IDictionary attribs) { if (attribs == null) throw new ParseException (parser.Location, "Error in ObjectTag."); attribs.Remove ("runat"); this.id = attribs ["id"] as string; attribs.Remove ("id"); if (this.id == null || this.id.Trim () == "") throw new ParseException (parser.Location, "Object tag must have a valid ID."); scope = attribs ["scope"] as string; string className = attribs ["class"] as string; attribs.Remove ("scope"); attribs.Remove ("class"); if (className == null || className.Trim () == "") throw new ParseException (parser.Location, "Object tag must have 'class' attribute."); this.type = parser.LoadType (className); if (this.type == null) throw new ParseException (parser.Location, "Type " + className + " not found."); if (attribs ["progid"] != null || attribs ["classid"] != null) throw new ParseException (parser.Location, "ClassID and ProgID are not supported."); if (attribs.Count > 0) throw new ParseException (parser.Location, "Unknown attribute"); }
protected override void PreFilterProperties(IDictionary properties) { properties.Remove((object) "Dock"); properties.Remove((object) "AutoSize"); properties.Remove((object) "AutoSizeMode"); base.PreFilterProperties(properties); }
/// <summary> /// Allows a designer to change or remove items from the set of events that it exposes through a <see cref="T:System.ComponentModel.TypeDescriptor"></see>. /// </summary> /// <param name="events">The events for the class of the component.</param> protected override void PostFilterEvents(IDictionary events) { events.Remove("FontChanged"); events.Remove("ForeColorChanged"); events.Remove("TextChanged"); base.PostFilterEvents(events); }
/// <summary> /// Drops the BackgroundImage property /// </summary> /// <param name="properties">properties to remove BackGroundImage from</param> protected override void PreFilterProperties(IDictionary properties) { base.PreFilterProperties(properties); if (properties.Contains("BackgroundImage")) properties.Remove("BackgroundImage"); if (properties.Contains("DrawGrid")) properties.Remove("DrawGrid"); }
protected override void PostFilterProperties(IDictionary properties) { properties.Remove("BackColor"); properties.Remove("BackgroundImage"); properties.Remove("BackgroundImageLayout"); properties.Remove("BorderStyle"); base.PostFilterProperties(properties); }
/// <summary> /// Allows a designer to change or remove items from the set /// of properties that it exposes through a <see cref="T:System.ComponentModel.TypeDescriptor"/>. /// </summary> /// <param name="properties">The properties for the class of the component.</param> protected override void PostFilterProperties(IDictionary properties) { properties.Remove("BackColor"); properties.Remove("Font"); properties.Remove("ForeColor"); properties.Remove("RightToLeft"); base.PostFilterProperties(properties); }
/// <summary> /// Allows a designer to change or remove items from the set of events that it exposes through a <see cref="T:System.ComponentModel.TypeDescriptor"></see>. /// </summary> /// <param name="events">The events for the class of the component.</param> protected override void PostFilterEvents(IDictionary events) { events.Remove("AutoSizeChanged"); events.Remove("Load"); events.Remove("Scroll"); base.PostFilterEvents(events); }
/// <summary> /// Allows a designer to change or remove items from the set of properties that it exposes through a <see cref="T:System.ComponentModel.TypeDescriptor"></see>. /// </summary> /// <param name="properties">The properties for the class of the component.</param> protected override void PostFilterProperties(IDictionary properties) { properties.Remove("AutoSize"); properties.Remove("AutoSizeMode"); properties.Remove("CausesValidation"); base.PostFilterProperties(properties); }
/// <summary> 验证签名 </summary> /// <param name="parameters">所有接收到的参数</param> /// <param name="publicKey"></param> /// <param name="charset"></param> /// <returns></returns> public static bool RsaCheck(IDictionary<string, string> parameters, string publicKey, string charset) { var sign = parameters["sign"]; parameters.Remove("sign"); parameters.Remove("sign_type"); var signContent = parameters.ParamsUrl(true, false); return RsaCheckContent(signContent, sign, publicKey, charset); }
/// <summary> /// Update the attributes of the attributes map given the VariantContext to reflect the /// proper chromosome-based VCF tags /// </summary> /// <param name="vc"> the VariantContext </param> /// <param name="attributes"> the attributes map to populate; must not be null; may contain old values </param> /// <param name="removeStaleValues"> should we remove stale values from the mapping? </param> /// <param name="founderIds"> - Set of founders Ids to take into account. AF and FC will be calculated over the founders. /// If empty or null, counts are generated for all samples as unrelated individuals </param> /// <returns> the attributes map provided as input, returned for programming convenience </returns> public static IDictionary<string, object> CalculateChromosomeCounts (VariantContext vc, IDictionary<string, object> attributes, bool removeStaleValues, ISet<string> founderIds) { int AN = vc.CalledChrCount; // if everyone is a no-call, remove the old attributes if requested if (AN == 0 && removeStaleValues) { if (attributes.ContainsKey (VCFConstants.ALLELE_COUNT_KEY)) { attributes.Remove (VCFConstants.ALLELE_COUNT_KEY); } if (attributes.ContainsKey (VCFConstants.ALLELE_FREQUENCY_KEY)) { attributes.Remove (VCFConstants.ALLELE_FREQUENCY_KEY); } if (attributes.ContainsKey (VCFConstants.ALLELE_NUMBER_KEY)) { attributes.Remove (VCFConstants.ALLELE_NUMBER_KEY); } return attributes; } if (vc.HasGenotypes) { attributes [VCFConstants.ALLELE_NUMBER_KEY] = AN; // if there are alternate alleles, record the relevant tags if (vc.AlternateAlleles.Count > 0) { List<double> alleleFreqs = new List<double> (); List<int> alleleCounts = new List<int> (); List<int> foundersAlleleCounts = new List<int> (); double totalFoundersChromosomes = (double)vc.GetCalledChrCount (founderIds); int foundersAltChromosomes; foreach (Allele allele in vc.AlternateAlleles) { foundersAltChromosomes = vc.GetCalledChrCount (allele, founderIds); alleleCounts.Add (vc.GetCalledChrCount (allele)); foundersAlleleCounts.Add (foundersAltChromosomes); if (AN == 0) { alleleFreqs.Add (0.0); } else { double freq = (double)foundersAltChromosomes / totalFoundersChromosomes; alleleFreqs.Add (freq); } } if (alleleCounts.Count == 1) { attributes [VCFConstants.ALLELE_COUNT_KEY] = alleleCounts [0]; } else { attributes [VCFConstants.ALLELE_COUNT_KEY] = alleleCounts; } if (alleleFreqs.Count == 1) { attributes [VCFConstants.ALLELE_FREQUENCY_KEY] = alleleFreqs [0]; } else { attributes [VCFConstants.ALLELE_FREQUENCY_KEY] = alleleFreqs; } } else { // if there's no alt AC and AF shouldn't be present attributes.Remove (VCFConstants.ALLELE_COUNT_KEY); attributes.Remove (VCFConstants.ALLELE_FREQUENCY_KEY); } } return attributes; }
/// <summary> /// Allows a designer to change or remove items from the set of events that it exposes through a <see cref="T:System.ComponentModel.TypeDescriptor"></see>. /// </summary> /// <param name="events">The events for the class of the component.</param> protected override void PostFilterEvents(IDictionary events) { events.Remove("AutoSizeChanged"); events.Remove("CausesValidationChanged"); events.Remove("Validated"); events.Remove("Validating"); base.PostFilterEvents(events); }
//Overrides /// <summary> /// Remove Button and Control properties that are /// not supported by the <see cref="TrackBarEx"/>. /// </summary> protected override void PostFilterProperties(IDictionary Properties) { Properties.Remove("AllowDrop"); Properties.Remove("BackgroundImage"); Properties.Remove("ContextMenu"); Properties.Remove("Text"); Properties.Remove("TextAlign"); Properties.Remove("RightToLeft"); }
/// <summary> /// Allows a designer to change or remove items from the set of properties that it exposes through a <see cref="T:System.ComponentModel.TypeDescriptor"></see>. /// </summary> /// <param name="properties">The properties for the class of the component.</param> protected override void PostFilterProperties(IDictionary properties) { properties.Remove("AutoSize"); properties.Remove("AutoSizeMode"); properties.Remove("Dock"); properties.Remove("Location"); properties.Remove("Size"); base.PostFilterProperties(properties); }
/// <summary> /// Allows a designer to change or remove items from the set of properties that it exposes through a <see cref="T:System.ComponentModel.TypeDescriptor"></see>. /// </summary> /// <param name="properties">The properties for the class of the component.</param> protected override void PostFilterProperties(IDictionary properties) { properties.Remove("AutoScroll"); properties.Remove("AutoScrollMargin"); properties.Remove("AutoScrollMinSize"); properties.Remove("AutoSize"); properties.Remove("AutoSizeMode"); base.PostFilterProperties(properties); }
protected override void PreFilterProperties(IDictionary properties) { properties.Remove("BackgroundImage"); properties.Remove("ImeMode"); properties.Remove("Padding"); properties.Remove("BackgroundImageLayout"); properties.Remove("Font"); base.PreFilterProperties(properties); }
/// <summary> /// Gets a data response for the given base url and parameters, /// either using OAuth or not depending on which parameters were passed in. /// </summary> /// <param name="flickr">The current instance of the <see cref="Flickr"/> class.</param> /// <param name="baseUrl">The base url to be called.</param> /// <param name="parameters">A dictionary of parameters.</param> /// <returns></returns> public static string GetDataResponse(Flickr flickr, string baseUrl, IDictionary<string, string> parameters) { const string method = "POST"; // Remove api key if it exists. if (parameters.ContainsKey("api_key")) parameters.Remove("api_key"); if (parameters.ContainsKey("api_sig")) parameters.Remove("api_sig"); // If OAuth Access Token is set then add token and generate signature. if (!String.IsNullOrEmpty(flickr.OAuthAccessToken) && !parameters.ContainsKey("oauth_token")) { OAuthGetBasicParameters(parameters); parameters.Add("oauth_token", flickr.OAuthAccessToken); } if (!String.IsNullOrEmpty(flickr.OAuthAccessTokenSecret) && !parameters.ContainsKey("oauth_signature")) { var sig = flickr.OAuthCalculateSignature(method, baseUrl, parameters, flickr.OAuthAccessTokenSecret); parameters.Add("oauth_signature", sig); } // Calculate post data, content header and auth header string data = OAuthCalculatePostData(parameters); string authHeader = OAuthCalculateAuthHeader(parameters); flickr.LastRequest = baseUrl + "?" + data; // Download data. try { return DownloadData(method, baseUrl, data, PostContentType, authHeader); } catch (WebException ex) { if (ex.Status != WebExceptionStatus.ProtocolError) throw; var response = ex.Response as HttpWebResponse; if (response == null) throw; if (response.StatusCode != HttpStatusCode.BadRequest && response.StatusCode != HttpStatusCode.Unauthorized) throw; using (var responseReader = new StreamReader(response.GetResponseStream())) { string responseData = responseReader.ReadToEnd(); responseReader.Close(); Debug.WriteLine("OAuth response = " + responseData); throw new OAuthException(responseData, ex); } } }
// clean up some unnecessary properties protected override void PostFilterProperties(IDictionary Properties) { Properties.Remove("AllowDrop"); Properties.Remove("BackgroundImage"); Properties.Remove("ContextMenu"); Properties.Remove("FlatStyle"); Properties.Remove("Image"); Properties.Remove("ImageAlign"); Properties.Remove("ImageIndex"); Properties.Remove("ImageList"); Properties.Remove("Text"); Properties.Remove("TextAlign"); }
public static async Task<string> GetDataResponseAsync(Flickr flickr, string baseUrl, IDictionary<string, string> parameters) { const string method = "POST"; // Remove api key if it exists. if (parameters.ContainsKey("api_key")) parameters.Remove("api_key"); if (parameters.ContainsKey("api_sig")) parameters.Remove("api_sig"); if (!parameters.ContainsKey("oauth_consumer_key")) parameters.Add("oauth_consumer_key", flickr.ApiKey); // If OAuth Access Token is set then add token and generate signature. if (!String.IsNullOrEmpty(flickr.OAuthAccessToken) && !parameters.ContainsKey("oauth_token")) { OAuthGetBasicParameters(parameters); parameters.Add("oauth_token", flickr.OAuthAccessToken); } if (!String.IsNullOrEmpty(flickr.OAuthAccessTokenSecret) && !parameters.ContainsKey("oauth_signature")) { var sig = flickr.OAuthCalculateSignature(method, baseUrl, parameters, flickr.OAuthAccessTokenSecret); parameters.Add("oauth_signature", sig); } // Calculate post data, content header and auth header var data = OAuthCalculatePostData(parameters); var authHeader = OAuthCalculateAuthHeader(parameters); // Download data. try { return await DownloadDataAsync(method, baseUrl, data, PostContentType, authHeader); } catch (WebException ex) { var response = ex.Response as HttpWebResponse; if (response == null) throw; if (response.StatusCode != HttpStatusCode.BadRequest && response.StatusCode != HttpStatusCode.Unauthorized) throw; var stream = response.GetResponseStream(); if (stream == null) throw; using (var responseReader = new StreamReader(stream)) { var responseData = responseReader.ReadToEnd(); throw new OAuthException(responseData, ex); } } }
/// <summary> /// Allows a designer to change or remove items from the set of events that it exposes through a <see cref="T:System.ComponentModel.TypeDescriptor"></see>. /// </summary> /// <param name="events">The events for the class of the component.</param> protected override void PostFilterEvents(IDictionary events) { events.Remove("AutoSizeChanged"); events.Remove("AutoValidateChanged"); events.Remove("CausesValidationChanged"); events.Remove("ChangeUICues"); events.Remove("FontChanged"); events.Remove("ForeColorChanged"); events.Remove("Load"); events.Remove("Scroll"); events.Remove("TabIndexChanged"); events.Remove("TabStopChanged"); base.PostFilterEvents(events); }
/// <summary> /// Allows a designer to change or remove items from the set of properties that it exposes through a <see cref="T:System.ComponentModel.TypeDescriptor"></see>. /// </summary> /// <param name="properties">The properties for the class of the component.</param> protected override void PostFilterProperties(IDictionary properties) { properties.Remove("AutoValidate"); properties.Remove("AutoScrollMargin"); properties.Remove("AutoScrollMinSize"); properties.Remove("AutoSize"); properties.Remove("AutoSizeMode"); properties.Remove("CausesValidation"); properties.Remove("Font"); properties.Remove("ForeColor"); properties.Remove("TabIndex"); properties.Remove("TabStop"); base.PostFilterProperties(properties); }
public static string Validate(this IDataErrorInfo source, IDictionary<string, string> requiredFields, IDictionary<string, string> errors, string propertyName) { string result = string.Empty; if (errors.ContainsKey(propertyName)) { errors.Remove(propertyName); } if (requiredFields.ContainsKey(propertyName)) { object propertyValue = source.GetProperty(propertyName); if (propertyValue is String && string.IsNullOrEmpty(propertyValue.ToString()) || propertyValue == null) { result = string.Format("{0} can not be blank!", requiredFields[propertyName]); } else if (propertyValue is IDataErrorInfo) { result = (propertyValue as IDataErrorInfo)[string.Empty]; } } if (!string.IsNullOrEmpty(result)) { errors.Add(propertyName, result); } return result; }
static IDictionary<RegistrationEntryKey, RegistrationCatalogEntry> Apply( IDictionary<RegistrationEntryKey, RegistrationCatalogEntry> existing, IDictionary<RegistrationEntryKey, RegistrationCatalogEntry> delta) { IDictionary<RegistrationEntryKey, RegistrationCatalogEntry> resulting = new Dictionary<RegistrationEntryKey, RegistrationCatalogEntry>(); foreach (var item in existing) { if (delta.ContainsKey(item.Key)) { resulting.Add(item.Key, delta[item.Key]); delta.Remove(item.Key); } else { resulting.Add(item); } } foreach (var item in delta) { resulting.Add(item); } return resulting; }
/// <summary> /// Allows a designer to change or remove items from the set of properties that it /// exposes through a TypeDescriptor /// </summary> /// <param name="properties">The properties for the class of the component.</param> protected override void PostFilterProperties(IDictionary properties) { base.PostFilterProperties(properties); // Remove Button.FlatStyle attribute, because we have our own properties.Remove("FlatStyle"); }
protected override void PreFilterProperties(IDictionary properties) { base.PreFilterProperties (properties); properties["HasChanges"] = TypeDescriptor.CreateProperty( typeof(XmlConfigurationOptionDesigner), (PropertyDescriptor)properties["HasChanges"], new Attribute[0]); properties.Remove("Value"); // XmlConfigurationOption option = base.Component as XmlConfigurationOption; // if (option != null) // { // ValuePropertyDescriptor p = properties["Value"]; // (ValuePropertyDescriptor)TypeDescriptor.CreateProperty( // typeof(XmlConfigurationOption), // (PropertyDescriptor)properties["HasChanges"], // CategoryAttribute.Design, // DesignOnlyAttribute.Yes); // // p.Option = option; // // properties["Value"] = p; // } }
public async Task<HttpResponseMessage> Send(HttpMethod method, Uri uri, IDictionary<string, string> requestHeaders, object content) { requestHeaders = requestHeaders ?? new Dictionary<string, string>() { }; var httpRequestMessage = new HttpRequestMessage(method, uri) { Content = GetContent(content, requestHeaders), }; foreach (var header in DefaultRequestHeaders) { if (requestHeaders.Any(x => x.Key == header.Key)) requestHeaders.Remove(header.Key); requestHeaders.Add(header.Key, header.Value); } foreach (var header in requestHeaders) { if (httpRequestMessage.Headers.Contains(header.Key)) httpRequestMessage.Headers.Remove(header.Key); httpRequestMessage.Headers.Add(header.Key, header.Value); } return await _httpClient.SendAsync(httpRequestMessage); }
internal override void ProcessMainAttributes (IDictionary atts) { autoEventWireup = GetBool (atts, "AutoEventWireup", autoEventWireup); enableViewState = GetBool (atts, "EnableViewState", enableViewState); string value = GetString (atts, "CompilationMode", compilationMode.ToString ()); if (!String.IsNullOrEmpty (value)) { try { compilationMode = (CompilationMode) Enum.Parse (typeof (CompilationMode), value, true); } catch (Exception ex) { ThrowParseException ("Invalid value of the CompilationMode attribute.", ex); } } atts.Remove ("TargetSchema"); // Ignored #if NET_4_0 value = GetString (atts, "ClientIDMode", null); if (!String.IsNullOrEmpty (value)) { try { clientIDMode = (ClientIDMode) Enum.Parse (typeof (ClientIDMode), value, true); } catch (Exception ex) { ThrowParseException ("Invalid value of the ClientIDMode attribute.", ex); } } #endif base.ProcessMainAttributes (atts); }