本文整理汇总了C#中System.Web.UI.Pair类的典型用法代码示例。如果您正苦于以下问题:C# Pair类的具体用法?C# Pair怎么用?C# Pair使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Pair类属于System.Web.UI命名空间,在下文中一共展示了Pair类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SaveToRepository
/// <summary>
/// Page의 ViewState 정보를 특정 저장소에 저장하고, 저장 토큰 값을 <see cref="AbstractServerPageStatePersister.StateValue"/>에 저장합니다.
/// </summary>
protected override void SaveToRepository() {
if(IsDebugEnabled)
log.Debug("Page 상태정보를 저장합니다...");
RemoveExpires(Expiration);
var pageState = new Pair(ViewState, ControlState);
if(StateValue.IsWhiteSpace())
StateValue = Guid.NewGuid().ToString();
var stateEntity = (PageStateEntity)PageStateTool.CreateStateEntity(StateValue, pageState, Compressor, CompressThreshold);
using(var repository = CreateRepository()) {
var query = Query.EQ(MongoTool.IdString, stateEntity.Id);
var updated = Update.Set("Value", stateEntity.Value).Set("IsCompressed", stateEntity.IsCompressed).Set("CreatedDate",
stateEntity.
CreatedDate);
// UPSERT
var result = repository.FindAndModify(query, SortBy.Null, updated, true, true);
if(IsDebugEnabled)
log.Debug("캐시에 Page 상태정보를 저장했습니다!!! StateValue=[{0}], Expiration=[{1}] (min), Result=[{2}]", StateValue, Expiration,
result.Ok);
}
}
示例2: XmlDocumentViewSchema
public XmlDocumentViewSchema(string name, Pair data, bool includeSpecialSchema)
{
this._includeSpecialSchema = includeSpecialSchema;
this._children = (OrderedDictionary) data.First;
this._attrs = (ArrayList) data.Second;
this._name = name;
}
示例3: SaveViewState
protected override object SaveViewState ()
{
if (tabData != null) {
Pair p = new Pair (tabData, titles);
return new Pair (base.SaveViewState (), p);
}
return null;
}
示例4: SaveViewState
/// <summary>
/// Saves the current view state of the <see cref="Composition" /> object.
/// </summary>
/// <param name="saveAll"><c>true</c> if all values should be saved regardless
/// of whether they are dirty; otherwise <c>false</c>.</param>
/// <returns>An object that represents the saved state. The default is <c>null</c>.</returns>
protected override object SaveViewState(bool saveAll)
{
Pair pair = new Pair();
pair.First = base.SaveViewState(saveAll);
if (_points != null)
pair.Second = ((IStateManagedObject)_points).SaveViewState(saveAll);
return (pair.First == null && pair.Second == null) ? null : pair;
}
示例5: Save
public override void Save()
{
Pair pair = new Pair();
if (base.ViewState != null)
{ pair.First = base.ViewState; }
if (base.ControlState != null)
{ pair.Second = base.ControlState; }
this.Page.Session["__Houfeng_AjaxEngine_"+this.GetUniqueKey()] =pair;
}
示例6: SaveViewState
protected override object SaveViewState() {
var myState = new Pair();
myState.First = base.SaveViewState();
if (_dataServiceContext != null) {
myState.Second = _dataServiceContext.Entities.Where(ed => !String.IsNullOrEmpty(ed.ETag)).ToDictionary(
ed => DataServiceUtilities.BuildCompositeKey(ed.Entity), ed => ed.ETag);
}
return myState;
}
示例7: ExecuteContextLoader
/// <summary>
/// IContextLoaderStep.ExecuteContextLoader() implementation
/// </summary>
/// <param name="data">The data which the values are read from.</param>
/// <param name="contextConfig">The configuration for the context loader test step.</param>
/// <param name="context">The context object into which the values will be written.</param>
public void ExecuteContextLoader(Stream data, XmlNode contextConfig, Context context)
{
var contextNodes = contextConfig.SelectNodes("XPath");
foreach (XmlNode contextNode in contextNodes)
{
var xPathPair = new Pair(contextNode.SelectSingleNode("@contextKey").Value, contextNode.SelectSingleNode(".").InnerText);
_xPathExpressions.Add(xPathPair);
}
ExecuteContextLoader(data, context);
}
示例8: Save
/// <summary>
/// 保存视图状态
/// </summary>
public override void Save()
{
Pair pair = new Pair();
if (base.ViewState != null)
pair.First = base.ViewState;
if (base.ControlState != null)
pair.Second = base.ControlState;
//
//TheCache.Insert("__Houfeng_AjaxEngine_" + this.GetUniqueKey(), pair);
TheCache.Insert("__Houfeng_AjaxEngine_" + this.GetUniqueKey(), pair, null,
DateTime.Now.AddMinutes(this.Timeout), Cache.NoSlidingExpiration, CacheItemPriority.Default, null);
}
示例9: SaveToRepository
protected override void SaveToRepository() {
if(IsDebugEnabled)
log.Debug("Page 상태정보를 압축하여 Hidden Field에 저장합니다...");
var pair = new Pair(ViewState, ControlState);
var stateEntity = PageStateTool.CreateStateEntity(string.Empty, pair, Compressor, CompressThreshold);
StateValue = Serializer.Serialize(stateEntity).Base64Encode();
if(IsDebugEnabled)
log.Debug("Page 상태정보를 압축하여 Hidden Field에 저장했습니다!!!");
}
示例10: Save
public override void Save()
{
if (base.Page.Form != null && (base.ControlState != null || base.ViewState != null))
{
var fileName = string.Concat(DateTime.Now.Ticks, 16, "-", HttpContext.Current.Session.SessionID, ".vs");
var filePath = Path.Combine(HttpContext.Current.Server.MapPath(_stateFileFolderPath), fileName);
var pair = new Pair(base.ViewState, base.ControlState);
File.WriteAllText(filePath, base.StateFormatter.Serialize(pair));
var stateField = string.Format(@"{0}<input type=""hidden"" name=""{1}"" value=""{2}"" />{0}{0}", System.Environment.NewLine, _viewstateFormFieldId, fileName);
base.Page.Form.Controls.AddAt(0, new LiteralControl(stateField));
}
}
示例11: Load
internal /*public*/ void Load(MobilePage page, Pair id)
{
_state = null;
SessionViewStateHistory history = (SessionViewStateHistory)page.Session[ViewStateKey];
if (history != null)
{
SessionViewStateHistoryItem historyItem = history.Find(id);
if (historyItem != null)
{
LoadFrom(historyItem);
}
}
}
示例12: Save
public override void Save()
{
Pair pair = new Pair();
if (base.ViewState != null)
pair.First = base.ViewState;
if (base.ControlState != null)
pair.Second = base.ControlState;
//
LosFormatter los = new LosFormatter();
StringWriter writer = new StringWriter();
los.Serialize(writer, pair);
StreamWriter sw = File.CreateText(ViewStateFilePath);
sw.Write(writer.ToString());
sw.Close();
}
示例13: Process
private void Process(DrawContainer draw, int i, Pair item, int total)
{
int value = (int)item.Second;
double angleplus = 360 * value * 1.0 / total;
double popangle = this.angle + (angleplus / 2);
System.Drawing.Color color = this.ColorFromHSL(this.start, 0.5, 0.5);
int delta = 30;
System.Drawing.Color bcolor = this.ColorFromHSL(this.start, 1, 0.5);
int r = 200;
double rad = Math.PI / 180;
draw.Gradients.Add(new LinearGradient
{
Degrees = 90,
GradientID = "Grd" + i,
Stops = {
new GradientStop{Offset = 0, Color = System.Drawing.ColorTranslator.ToHtml(bcolor)},
new GradientStop{Offset = 100, Color = System.Drawing.ColorTranslator.ToHtml(color)}
}
});
AbstractSprite sector = this.Sector(250, 250, r, this.angle, this.angle + angleplus);
sector.FillStyle = "url(#Grd" + i + ")";
sector.StrokeStyle = "#fff";
sector.LineWidth = 3;
draw.Items.Add(sector);
TextSprite text = new TextSprite
{
SpriteID = "text" + i,
X = Convert.ToInt32(350 + (r + delta + 55) * Math.Cos(-popangle * rad)),
Y = Convert.ToInt32(350 + (r + delta + 25) * Math.Sin(-popangle * rad)),
Text = item.First.ToString(),
FillStyle = System.Drawing.ColorTranslator.ToHtml(bcolor),
StrokeStyle = "none",
GlobalAlpha = 0,
FontSize = "20"
};
draw.Items.Add(text);
//sector.Listeners.MouseOver.Handler = string.Format("onMouseOver(this, {0});", i);
//sector.Listeners.MouseOut.Handler = string.Format("onMouseOut(this, {0});", i);
this.angle += angleplus;
this.start += 0.1;
}
示例14: Save
/// <summary>
/// Save page state.
/// </summary>
public override void Save()
{
//No processing needed if no state available
if (ViewState == null & ControlState == null)
{
return;
}
//Save view state and control state separately
Pair state = new Pair(ViewState, ControlState);
//Add view state and control state to session
HttpContext.Current.Session[base.StateKey] = state;
base.Save();
}
示例15: Save
public override void Save()
{
if (ViewState == null && ControlState == null)
{
return;
}
StringBuilder key = new StringBuilder();
{
key.Append("VS_");
key.Append(Page.Session == null ? Guid.NewGuid().ToString() : Page.Session.SessionID);
key.Append("_");
key.Append(DateTime.Now.Ticks.ToString());
}
Pair state = new Pair(ViewState, ControlState);
//DataCache.SetCache(key.ToString(), state, objDependency, DateTime.Now.AddMinutes(Page.Session.Timeout), System.Web.Caching.Cache.NoSlidingExpiration, System.Web.Caching.CacheItemPriority.NotRemovable, null);
Page.ClientScript.RegisterHiddenField(VIEW_STATE_CACHEKEY, key.ToString());
}