本文整理汇总了C#中System.Web.UI.WebControls.WebParts.WebPartManager类的典型用法代码示例。如果您正苦于以下问题:C# WebPartManager类的具体用法?C# WebPartManager怎么用?C# WebPartManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WebPartManager类属于System.Web.UI.WebControls.WebParts命名空间,在下文中一共展示了WebPartManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WebPartChrome
public WebPartChrome(WebPartZoneBase zone, WebPartManager manager) {
if (zone == null) {
throw new ArgumentNullException("zone");
}
_zone = zone;
_page = zone.Page;
_designMode = zone.DesignMode;
_manager = manager;
if (_designMode) {
// Consider personalization to be enabled at design-time
_personalizationEnabled = true;
}
else {
_personalizationEnabled = (manager != null && manager.Personalization.IsModifiable);
}
if (manager != null) {
_personalizationScope = manager.Personalization.Scope;
}
else {
// Consider scope to be shared at design-time
_personalizationScope = PersonalizationScope.Shared;
}
}
示例2: IsEnabled
public virtual new bool IsEnabled (WebPartManager webPartManager)
{
Contract.Requires (webPartManager != null);
Contract.Requires (webPartManager.Personalization != null);
return default(bool);
}
开发者ID:asvishnyakov,项目名称:CodeContracts,代码行数:7,代码来源:System.Web.UI.WebControls.WebParts.WebPartDisplayMode.cs
示例3: PersonalizationState
/// <devdoc>
/// </devdoc>
protected PersonalizationState(WebPartManager webPartManager) {
if (webPartManager == null) {
throw new ArgumentNullException("webPartManager");
}
_webPartManager = webPartManager;
}
示例4: LoadPersonalizationBlobs
protected override void LoadPersonalizationBlobs(WebPartManager webPartManager, string path, string userName,
ref byte[] sharedDataBlob, ref byte[] userDataBlob)
{
PageBase page = webPartManager.Page as PageBase;
if (page != null && page.CurrentUserSession != null)
{
userName = page.CurrentUserSession.Username;
User user = User.Load(userName);
PersonalizationInfo info = user.PersonalizationInfo;
if (info != null)
{
string key = String.Format("{0}_{1}_{2}", webPartManager.ID, path, userName);
byte[] data = null;
try
{
if (info.userPersonalizationData.ContainsKey(key))
data = info.userPersonalizationData[key];
}
catch (KeyNotFoundException)
{
//info is somehow corrupted
//user.ResetPersonalization();
}
if (data != null)
{
userDataBlob = data;
}
}
}
}
示例5: IsEnabled
public virtual bool IsEnabled(WebPartManager webPartManager)
{
if (this.RequiresPersonalization)
{
return webPartManager.Personalization.IsModifiable;
}
return true;
}
示例6: WebPartPersonalization
/// <devdoc>
/// </devdoc>
public WebPartPersonalization(WebPartManager owner) {
if (owner == null) {
throw new ArgumentNullException("owner");
}
_owner = owner;
_enabled = true;
}
示例7: OnInit
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
_wpm = WebPartManager.GetCurrentWebPartManager(this.Page);
if (this.Page is BasePage)
((BasePage)this.Page).ToolboxPanel = pnlToolboxMain;
ltlInfo.Text = String.Format("MonoX v{0} [{1}], DB v{2}", MonoSoftware.MonoX.Utilities.MonoXUtility.AssemblyVersion, MonoSoftware.MonoX.Utilities.MonoXUtility.AssemblyDate.ToString(CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern), MonoSoftware.MonoX.Utilities.MonoXUtility.DBVersion);
SetRefreshCacheUrl();
CheckCacheRefresh();
}
示例8: BuildCommand
private SqlCommand BuildCommand(IConfigurationElement commandElement, IBinder binder, WebPartManager manager)
{
SqlCommand command = new SqlCommand();
foreach (IConfigurationElementAttribute attribute in commandElement.Attributes.Values)
{
ReflectionServices.SetValue(command, attribute.ConfigKey, attribute.Value);
}
IBindingItemsCollection bindingParams = binder.NewBindingItemCollectionInstance();
binder.BindingSet.Add(commandElement.ConfigKey, bindingParams);
foreach (IConfigurationElement parameterElement in commandElement.Elements.Values)
{
SqlParameter parameter = new SqlParameter();
foreach (IConfigurationElementAttribute parameterAttribute in parameterElement.Attributes.Values)
{
if ("bind" == parameterAttribute.ConfigKey)
{
string bindstring = parameterAttribute.Value.ToString();
bool isOutput = parameterElement.Attributes.ContainsKey("Direction") &&
("Output" == parameterElement.GetAttributeReference("Direction").Value.ToString() ||
"InputOutput" == parameterElement.GetAttributeReference("Direction").Value.ToString());
if (bindstring.Contains("."))
{
string sourcestring = bindstring.Substring(0, bindstring.IndexOf("."));
IBindingItem bindingItem = binder.NewBindingItemInstance();
if (!isOutput)
{
bindingItem.Source = manager.FindControl(sourcestring);
bindingItem.SourceProperty = bindstring.Substring(sourcestring.Length + 1);
bindingItem.Target = parameter;
bindingItem.TargetProperty = "Value";
}
else
{
bindingItem.Target = manager.FindControl(sourcestring);
bindingItem.TargetProperty = bindstring.Substring(sourcestring.Length + 1);
bindingItem.Source = parameter;
bindingItem.SourceProperty = "Value";
}
bindingParams.Add(bindingItem);
}
}
else
{
ReflectionServices.SetValue(parameter, parameterAttribute.ConfigKey, parameterAttribute.Value);
}
}
if (null == parameter.Value)
{
parameter.Value = DBNull.Value;
}
command.Parameters.Add(parameter);
}
return command;
}
示例9: BlobPersonalizationState
/// <devdoc>
/// </devdoc>
public BlobPersonalizationState(WebPartManager webPartManager) : base(webPartManager) {
//
// Note that we don't use the IsPostBack property of Page because that
// is based on the presence of view state, which could be on the query string
// in a non-POST request as well. Instead we use the actual verb associated
// with the request.
// Note that there are other types of HttpVerb besides GET and POST. We only
// save personalization data for POST requests. (VSWhidbey 423433)
_isPostRequest = (webPartManager.Page.Request.HttpVerb == HttpVerb.POST);
}
示例10: LoadPersonalizationBlobs
/// <summary>
/// Loads the personalization data bytes.
/// </summary>
/// <param name="webPartManager"></param>
/// <param name="path"></param>
/// <param name="userName"></param>
/// <param name="sharedDataBlob"></param>
/// <param name="userDataBlob"></param>
protected override void LoadPersonalizationBlobs(WebPartManager webPartManager, string path, string userName, ref byte[] sharedDataBlob, ref byte[] userDataBlob)
{
userName = Workflow.CurrentUser.UserBase.LoginName;
OUserWebPartsPersonalization p = OUserWebPartsPersonalization.GetPersonalization("", path, userName);
if (p != null)
{
if (String.IsNullOrEmpty(userName))
sharedDataBlob = p.Bytes;
else
userDataBlob = p.Bytes;
}
}
示例11: Create
public override void Create(Control container, IConfigurationType config, ITemplatable templatable, IEnumerable registry, IBinder binder, WebPartManager manager)
{
if (null == container)
{
throw new ArgumentNullException("container");
}
if (null == config)
{
throw new ArgumentNullException("config");
}
if (!(config is IConfigurationSection))
{
throw new ArgumentException("config must be an IConfigurationSection");
}
if (!(registry is ITemplatingItemsCollection))
{
throw new ArgumentException("registry must be an ITemplatingItemsCollection");
}
ITemplatingItemsCollection filters = registry as ITemplatingItemsCollection;
IDictionary<string, IConfigurationElement> itemElements = (config as IConfigurationSection).Elements;
if (itemElements.ContainsKey("filter"))
{
Table table;
if (container is Table)
{
table = (container as Table);
}
else
{
table = new Table();
table.ID = container.ID + "filter";
}
table.ApplyStyle(templatable.FilterStyle);
for (int i = 0; i < filters.Count; i++)
{
foreach (IConfigurationElement element in itemElements["filter"].Elements.Values)
{
string prefix = "filter" + element.ConfigKey + i.ToString();
this.DisplayItem(table, element, prefix, binder, filters[i], templatable.FilterRowStyle, templatable.InvalidItemStyle, manager);
}
}
if (!(container is Table))
{
container.Controls.Add(table);
}
}
}
示例12: Create
public override void Create(Control container, IConfigurationType config, ITemplatable templatable, IEnumerable registry, WebPartManager manager)
{
if (null == container)
{
throw new ArgumentNullException("container");
}
if (null == config)
{
throw new ArgumentNullException("config");
}
if (!(config is IConfigurationSection))
{
throw new ArgumentException("config must be an IConfigurationSection");
}
if (!(registry is Dictionary<string, Control>))
{
throw new ArgumentException("registry must be a Dictionary<string,Control>");
}
Dictionary<string, Control> commanders = registry as Dictionary<string, Control>;
commanders.Clear();
IDictionary<string, IConfigurationElement> itemElements = (config as IConfigurationSection).Elements;
if (itemElements.ContainsKey("commanders"))
{
Table table;
if (container is Table)
{
table = (container as Table);
}
else
{
table = new Table();
}
if (string.IsNullOrEmpty(table.ID))
{
table.ID = container.ID + "commanders";
}
table.ApplyStyle(templatable.CommandersStyle);
foreach (IConfigurationElement element in itemElements["commanders"].Elements.Values)
{
this.DisplayItem(table, element, element.ConfigKey, null, null, templatable.CommandersRowStyle, templatable.InvalidItemStyle, commanders, manager);
}
if (!(container is Table))
{
container.Controls.Add(table);
}
}
}
示例13: SavePersonalizationBlob
/// <summary>
/// Saves the personalization data into the database.
/// </summary>
/// <param name="webPartManager"></param>
/// <param name="path"></param>
/// <param name="userName"></param>
/// <param name="dataBlob"></param>
protected override void SavePersonalizationBlob(WebPartManager webPartManager, string path, string userName, byte[] dataBlob)
{
using (Connection c = new Connection())
{
userName = Workflow.CurrentUser.UserBase.LoginName;
OUserWebPartsPersonalization p = OUserWebPartsPersonalization.GetPersonalization("", path, userName);
if (p == null)
p = TablesLogic.tUserWebPartsPersonalization.Create();
p.ApplicationName = "";
p.Path = path;
p.UserName = userName;
p.Bytes = dataBlob;
p.Save();
c.Commit();
}
}
示例14: LoadPersonalizationBlobs
public static void LoadPersonalizationBlobs(
SiteSettings siteSettings,
WebPartManager webPartManager,
string path,
string userName,
ref byte[] sharedDataBlob,
ref byte[] userDataBlob)
{
if (siteSettings != null)
{
if ((userName != null) && (userName.Length > 0))
{
SiteUser siteUser = new SiteUser(siteSettings, userName);
Guid userID = Guid.Empty;
if (siteUser.UserId > 0)
{
userID = siteUser.UserGuid;
}
if (userID != Guid.Empty)
{
userDataBlob = SitePersonalization.GetPersonalizationBlob(
siteSettings.SiteId,
path,
userID);
siteUser.UpdateLastActivityTime();
sharedDataBlob = SitePersonalization.GetPersonalizationBlobAllUsers(
siteSettings.SiteId,
path);
}
}
else
{
//TODO: tracking/personalization for unauthenticated users?
sharedDataBlob = SitePersonalization.GetPersonalizationBlobAllUsers(
siteSettings.SiteId,
path);
}
}
}
示例15: DetermineUserCapabilities
public override IDictionary DetermineUserCapabilities(WebPartManager webPartManager)
{
//return base.DetermineUserCapabilities(webPartManager);
ICollection supportedUserCapabilities = CreateSupportedUserCapabilities();
if ((supportedUserCapabilities != null) && (supportedUserCapabilities.Count != 0))
{
IDictionary capabilities = new HybridDictionary();
foreach (WebPartUserCapability capability in supportedUserCapabilities)
{
capabilities[capability] = capability;
}
return capabilities;
}
else return new HybridDictionary();
}