📄 toolbar.cs
字号:
namespace FreeTextBoxControls
{
using FreeTextBoxControls.Support;
using System;
using System.Collections;
using System.ComponentModel;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
[PersistChildren(true), DefaultProperty("Items"), ParseChildren(true, "Items")]
public class Toolbar : IStateManager
{
public Toolbar()
{
this.viewState = new StateBag();
}
internal void SetDirty()
{
HttpContext.Current.Trace.Write("Toolbar:Dirty", "setting");
if (this.viewState != null)
{
ICollection collection1 = this.viewState.Keys;
foreach (string text1 in collection1)
{
this.viewState.SetItemDirty(text1, true);
}
HttpContext.Current.Trace.Write("Toolbar:Dirty", "dirty");
}
}
void IStateManager.LoadViewState(object savedState)
{
HttpContext.Current.Trace.Write("Toolbar", "Loading ViewState");
object[] objArray1 = null;
object obj1 = null;
object obj2 = null;
if (savedState != null)
{
objArray1 = (object[]) savedState;
if (objArray1.Length != 2)
{
throw new ArgumentException("Invalid view state");
}
obj1 = objArray1[0];
obj2 = objArray1[1];
}
if (obj1 != null)
{
((IStateManager) this.viewState).LoadViewState(obj1);
}
if (obj2 != null)
{
((IStateManager) this.Items).LoadViewState(obj2);
}
HttpContext.Current.Trace.Write("Toolbar items?", (obj2 == null) ? "null" : "got something");
}
object IStateManager.SaveViewState()
{
HttpContext.Current.Trace.Write("Toolbar", "Saving ViewState");
object obj1 = ((IStateManager) this.viewState).SaveViewState();
object obj2 = null;
if (this.items != null)
{
obj2 = ((IStateManager) this.items).SaveViewState();
}
HttpContext.Current.Trace.Write("Toolbar:SavingItems", (obj2 == null) ? "null" : "got something");
if ((obj1 != null) || (obj2 != null))
{
return new object[] { obj1, obj2 };
}
return null;
}
void IStateManager.TrackViewState()
{
((IStateManager) this.ViewState).TrackViewState();
if (this.items != null)
{
((IStateManager) this.items).TrackViewState();
}
}
[NotifyParentProperty(true), PersistenceMode(PersistenceMode.InnerProperty), Category("Appearance"), DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public virtual ToolbarButtonStyle ButtonStyle
{
get
{
if (this.buttonStyle == null)
{
this.buttonStyle = new ToolbarButtonStyle();
if (this.isTrackingViewState)
{
((IStateManager) this.buttonStyle).TrackViewState();
}
}
return this.buttonStyle;
}
}
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content), NotifyParentProperty(true), PersistenceMode(PersistenceMode.InnerDefaultProperty)]
public ToolbarItemCollection Items
{
get
{
if (this.items == null)
{
this.items = new ToolbarItemCollection();
if (this.isTrackingViewState)
{
((IStateManager) this.items).TrackViewState();
}
}
return this.items;
}
}
[Description("The direction the Toolbar will draw the ToolbarItems"), Category("Behavior"), NotifyParentProperty(true)]
public System.Web.UI.WebControls.RepeatDirection RepeatDirection
{
get
{
return ((this.ViewState["RepeatDirection"] == null) ? System.Web.UI.WebControls.RepeatDirection.Horizontal : ((System.Web.UI.WebControls.RepeatDirection) this.ViewState["RepeatDirection"]));
}
set
{
this.ViewState["RepeatDirection"] = value;
}
}
bool IStateManager.IsTrackingViewState
{
get
{
return this.isTrackingViewState;
}
}
[Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
protected StateBag ViewState
{
get
{
if (this.viewState == null)
{
this.viewState = new StateBag(false);
if (this.isTrackingViewState)
{
((IStateManager) this.viewState).TrackViewState();
}
}
return this.viewState;
}
}
private ToolbarButtonStyle buttonStyle;
private bool isTrackingViewState;
private ToolbarItemCollection items;
private StateBag viewState;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -