Archives

Archives / 2006 / January
  • New Code Snippets for C#

     * Application Code Snippets
        * Collections and Arrays Code Snippets
        * Connectivity Code Snippets
        * Crystal Reports Code Snippets
        * Database Code Snippets
        * Datatypes Code Snippets
        * File System Code Snippets
        * Math Code Snippets
        * Operating System Code Snippets
        * Security Code Snippets
        * Smart Devices Code Snippets
        * Windows Forms Code Snippets
        * XML Code Snippets
    To download code snippets for all the categories and retain the directory install structure of these snippets, click here.
    Tool for write Snippets click here.

  • éåí ùéùé îùôçúé

    אני אחותו של אייל מנסה את כוחי בכתיבה ראשונה בבלוג רציתי לספר לכם שכול יום שישי אנחנו 
    
    נפגשים כל המשפחה לארוחת ערב חגיגית וכל אחד מהבאים מספר את שעבר אליו בשבוע החולף דבר
    שעוזר ושומר את כולנו בתמונה המשותפת של החיים ושל המשפחה אני חייבת להיות גלויה ולהגיד שלא
    קל לנו להבין את כל הרעיונות של איל אבל אנחנו מנסים המוח שלו עובד בקצב מאוד מהיר ואני מקווה
    שאום מבינים מה שהוא כותב בכול אופן כולנו מבינים שמדובר כאן ביצור מוזר מכוכב אחר
    יש לי עוד אח יותר קטן והוא סטודנט במרכז הבין תחומי בהרצליה ,לא היה לו מה לספר לנו חדש השבוע 
    ואני אחות שלהם לי יש זכיון של מיכל נגרין בכפר סבא ובמידה ובאמת משהוא קורא 
    את הבלוג הזה כמו שאיל אומר אתם מוזמנים לבוא ולהגיד לי שאתם  הקוראים 
    ואני מבטיחה לכם הנחה שמי הילה ורדי היה נחמד וסוף שבוע טוב לכולנו 
    ביי

  • Add Action List to Control

    ActionlistStep 1 : Build the control

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Text;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    
    namespace CustomDesignerActionsDemo
    {
    	[DefaultProperty( "Text" )]
    	[ToolboxData( "<{0}:UserInfo runat=server>" )]
    	[Designer( typeof( MyDesigner ) )]
    	public class UserInfo : WebControl
    	{
    		#region Fields
    		private int m_Age;
    		protected TextBox txbAge;
    		[CategoryAttribute( "Misc" )]
    		[DescriptionAttribute( "My Age" )]
    		public int Age
    		{
    			get
    			{
    				return m_Age;
    			}
    			set
    			{
    				m_Age = value;
    			}
    		}
    
    		private string m_Email;
    		protected TextBox txbEmail;
    		[CategoryAttribute( "Misc" )]
    		[DescriptionAttribute( "My Email" )]
    		public string Email
    		{
    			get
    			{
    				return m_Email;
    			}
    			set
    			{
    				m_Email = value;
    			}
    		}
    
    		private DateTime m_Date;
    		protected TextBox txbDate;
    		[CategoryAttribute( "Misc" )]
    		[DescriptionAttribute( "My Date" )]
    		public DateTime Date
    		{
    			get
    			{
    				return m_Date;
    			}
    			set
    			{
    				m_Date = value;
    			}
    		}
    
    		private CityList m_City;
    		protected TextBox txbCity;
    		[CategoryAttribute( "General" )]
    		[DescriptionAttribute( "My City" )]
    		public CityList City
    		{
    			get
    			{
    				return m_City;
    			}
    			set
    			{
    				m_City = value;
    			}
    		}
    
    		[Bindable( true )]
    		[Category( "Appearance" )]
    		[DefaultValue( "" )]
    		[Localizable( true )]
    		public string Text
    		{
    			get
    			{
    				String s = (String)ViewState[ "Text" ];
    				return ( ( s == null ) ? String.Empty : s );
    			}
    
    			set
    			{
    				ViewState[ "Text" ] = value;
    			}
    		}
    		#endregion	
    
    		bool IsCreateChildControls = false;
    
    		protected void SetValueInTextBox()
    		{
    			txbAge.Text = Age.ToString();
    			txbCity.Text = City.ToString();
    			txbDate.Text = Date.ToString();
    			txbEmail.Text = Email;
    		}
    		protected override void EnsureChildControls()
    		{
    			if ( !IsCreateChildControls )
    				CreateChildControls();
    
    			base.EnsureChildControls();
    		}
    		protected override void CreateChildControls()
    		{
    			txbAge	 = new TextBox();
    			txbCity  = new TextBox();
    			txbDate  = new TextBox();
    			txbEmail = new TextBox();
    			base.CreateChildControls();
    
    			IsCreateChildControls = true;
    		}
    		protected override void RenderContents( HtmlTextWriter output )
    		{
    			EnsureChildControls();
    			SetValueInTextBox();
    			output.Write( Text );
    
    			output.Write( "
    City: " ); txbCity.RenderControl( output ); output.Write( "
    Age: " ); txbAge.RenderControl( output ); output.Write( "
    Date: " ); txbDate.RenderControl( output ); output.Write( "
    Email: " ); txbEmail.RenderControl( output ); } } }
    Step 2 : Build the designer for the control
    using System;
    using System.Collections.Generic;
    using System.Web.UI.Design;
    using System.ComponentModel.Design;
    
    
    
    namespace CustomDesignerActionsDemo
    {
    	public class MyDesigner : ControlDesigner
    	{
    		private DesignerActionListCollection al = null;
    
    		public override DesignerActionListCollection ActionLists
    		{
    			get
    			{
    				if ( al == null )
    				{
    					al = new DesignerActionListCollection();
    					al.AddRange( base.ActionLists );
    
    					// Add a custom DesignerActionList
    					al.Add( new MyDesignerActionList( this ) );
    				}
    				return al;
    
    			}
    		}
    	}
    }
    
    
    Step 3 : Build the action list for the designer
    using System;
    using System.ComponentModel;
    using System.ComponentModel.Design;
    using System.Collections.Generic;
    using System.Diagnostics;
    using System.Text;
    using System.Windows.Forms;
    using System.Reflection;
    
    namespace CustomDesignerActionsDemo
    {
    	public class MyDesignerActionList : DesignerActionList
    	{
    		MyDesigner m_parent;
    
    		public MyDesignerActionList( MyDesigner parent )
    			: base(parent.Component)
    		{
    			m_parent = parent;
    		}
    
    		public override DesignerActionItemCollection GetSortedActionItems()
    		{
    			// Create list to store designer action items
    			DesignerActionItemCollection actionItems = new DesignerActionItemCollection();
    
    			// Add Appearance category header text
    			actionItems.Add(new DesignerActionHeaderItem("Misc"));
    
    			//// Add Appearance category descriptive label
    			actionItems.Add(
    			  new DesignerActionTextItem(
    				"Properties that affect how the User looks." ,
    				"Misc" ) );
    
    			//// Add Email designer action property item
    			actionItems.Add(
    			  new DesignerActionPropertyItem(
    				"Email" ,
    				"Email" ,
    				GetCategory( this.WebControl , "Email" ) ,
    				GetDescription( this.WebControl , "Email" ) ) );
    
    			actionItems.Add(
    			  new DesignerActionPropertyItem(
    				"Age" ,
    				"Age" ,
    				GetCategory( this.WebControl , "Age" ) ,
    				GetDescription( this.WebControl , "Age" ) ) );
    
    			actionItems.Add(
    			  new DesignerActionPropertyItem(
    				"Date" ,
    				"Date" ,
    				GetCategory( this.WebControl , "Date" ) ,
    				GetDescription( this.WebControl , "Date" ) ) );
    
    			actionItems.Add(
    			  new DesignerActionPropertyItem(
    				"City" ,
    				"City" ,
    				GetCategory( this.WebControl , "City" ) ,
    				GetDescription( this.WebControl , "City" ) ) );
    
    			actionItems.Add(
    				new DesignerActionMethodItem(
    				this ,
    				"ClearValues" ,
    				"Clear Values" ,
    				true ) ); // for the Propeties wondows
    
    			return actionItems;
    		}
    
    		#region Control Proxy Properties
    		public string Email
    		{
    			get	{ return WebControl.Email; }
    			set { SetProperty( "Email" , value ); }
    		}
    		public int Age
    		{
    			get{return WebControl.Age;}
    			set{SetProperty( "Age" , value );}
    		}
    		public DateTime Date
    		{
    			get{return WebControl.Date;	}
    			set{SetProperty( "Date" , value );	}
    		}
    		public CityList City
    		{
    			get{return WebControl.City;}
    			set{SetProperty( "City" , value );}
    		}
    		public void ClearValues()
    		{
    			SetProperty( "Email" , string.Empty );
    			SetProperty( "Age" , -1 );
    			SetProperty( "City" , CityList.Tel_Aviv );
    			SetProperty( "Date" , DateTime.Now );
    		}
    
    		#endregion
    
    
    		private UserInfo WebControl
    		{
    			get
    			{
    				return (UserInfo)this.Component;
    			}
    		}		
    
    		private string GetCategory( object source , string propertyName )
    		{
    			PropertyInfo property       = source.GetType().GetProperty( propertyName );
    			CategoryAttribute attribute = (CategoryAttribute)property.GetCustomAttributes( typeof( CategoryAttribute ) , false )[ 0 ];
    			if ( attribute == null )
    				return null;
    			return attribute.Category;
    		}		
    		private string GetDescription( object source , string propertyName )
    		{
    			PropertyInfo property = source.GetType().GetProperty( propertyName );
    			DescriptionAttribute attribute = (DescriptionAttribute)property.GetCustomAttributes( typeof( DescriptionAttribute ) , false )[ 0 ];
    			if ( attribute == null )
    				return null;
    			return attribute.Description;
    		}
    
    		// Helper method to safely set a component’s property
    		private void SetProperty( string propertyName , object value )
    		{
    			// Get property
    			PropertyDescriptor property = TypeDescriptor.GetProperties( this.WebControl )[ propertyName ];
    			// Set property value
    			property.SetValue( this.WebControl , value );
    		}
    	}
    
    	public enum CityList
    	{
    		Tel_Aviv, Ramat_Gan
    	}
    }
    User info with Action List !!!!
    Actionlist

  • SessionSaver .2 - Firefox Extension

    SessionSaver restores your browser -exactly- as you left it, every startup, every time. Not even a crash will phase it. Windows, tabs, even things you were typing -- they're all saved
    Click Here

  • New Automation Samples for Visual Studio .NET 2005

    http://www.microsoft.com/downloads/details.aspx?FamilyId=79C7E038-8768-4E1E-87AE-5BBBE3886DE8&displaylang=en
    These code samples show you how to build VSMacros projects, add–ins, and wizards to make your teams more productive and customize Visual Studio .NET 2005 to the ways you like to work. Look for more samples, as well as some white papers and overview documents, in the future.

    All of these samples use the Visual Studio automation model, which is free and publicly distributed with Visual Studio .NET 2005. With this automation model, you can do the following:


    • Intercept commands when they are invoked, and either provide preprocessing or implement the command yourself.

    • Control the solution, projects, and project items by adding or removing them.

    • Control the build configurations mechanisms and hook various build events.

    • Control a large portion of the text editor.

    • Implement commands that help you debug with the debugger objects.

    • Control the Windows Forms Designer.

    • Create tool windows that behave just like the built-in tool windows for docking and floating.

    • Provide content to the Property Browser when items are selected in tool windows.

    • Control several of the built-in tool windows (including Task List, Toolbox, Command Window, and Output Window).

    • And more...


  • מאיפו הידע?

    מדי פעם שואלים אותי מאיפו הידע הרב?
    התשובה שלי תמיד אותה תשובה:
    לקורא כל יום מאמר אחד, בסוף השנה תיהיו מקצוענים"