本文整理汇总了C#中IInputContext类的典型用法代码示例。如果您正苦于以下问题:C# IInputContext类的具体用法?C# IInputContext怎么用?C# IInputContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IInputContext类属于命名空间,在下文中一共展示了IInputContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Initialise
/// <summary>
///
/// </summary>
///<param name="inputContext"></param>
/// <param name="outputContext"></param>
/// <returns></returns>
public bool Initialise(IInputContext inputContext, IOutputContext outputContext)
{
_skinSet = inputContext.CurrentSite.SkinSet;
List<string> skinNames = GetOrderedSkinNames(inputContext);
foreach (string skinName in skinNames)
{
_skinName = skinName.ToLower();
if (_skinName.EndsWith("-xml", true, null))
{
// Legacy support -xml indicates xml skin.
_skinName = "xml";
}
if (VerifySkin(_skinName, inputContext.CurrentSite))
{
return true;
}
}
//Fallback to specified Skin in Vanilla SkinSet.
if ( _skinName != null && _skinName != string.Empty )
{
if ( outputContext.VerifySkinFileExists( _skinName, "vanilla") )
{
_skinSet = "vanilla";
return true;
}
}
//Fallback to users preferred skin
if ( inputContext.ViewingUser != null && inputContext.ViewingUser.UserLoggedIn)
{
if (inputContext.ViewingUser.PreferredSkin.Length != 0 && VerifySkin(inputContext.ViewingUser.PreferredSkin, inputContext.CurrentSite))
{
_skinName = inputContext.ViewingUser.PreferredSkin.ToLower();
return true;
}
}
// Fallback to default skin for site.
if (VerifySkin(inputContext.CurrentSite.DefaultSkin, inputContext.CurrentSite))
{
_skinName = inputContext.CurrentSite.DefaultSkin.ToLower();
return true;
}
// Try to return vanilla default skin.
if (outputContext.VerifySkinFileExists("html", "vanilla"))
{
_skinName = "html";
_skinSet = "vanilla";
return true;
}
//Error - no skin.
return false;
}
示例2: SetUp
public void SetUp()
{
_mock = new Mockery();
_site = _mock.NewMock<ISite>();
Stub.On(_site).GetProperty("DefaultSkin").Will(Return.Value(SITE_DEFAULT_SKIN));
Stub.On(_site).Method("DoesSkinExist").With(SITE_DEFAULT_SKIN).Will(Return.Value(true));
Stub.On(_site).Method("DoesSkinExist").With(INVALID_SKIN).Will(Return.Value(false));
Stub.On(_site).Method("DoesSkinExist").With(USER_PREFERRED_SKIN).Will(Return.Value(true));
Stub.On(_site).Method("DoesSkinExist").With(Is.Null).Will(Return.Value(false));
Stub.On(_site).Method("DoesSkinExist").With(REQUESTED_SKIN).Will(Return.Value(true));
Stub.On(_site).Method("DoesSkinExist").With(FILTER_DERIVED_SKIN).Will(Return.Value(true));
Stub.On(_site).Method("DoesSkinExist").With("xml").Will(Return.Value(true));
Stub.On(_site).GetProperty("SkinSet").Will(Return.Value("vanilla"));
_user = _mock.NewMock<IUser>();
_inputContext = _mock.NewMock<IInputContext>();
Stub.On(_inputContext).GetProperty("CurrentSite").Will(Return.Value(_site));
_outputContext = _mock.NewMock<IOutputContext>();
Stub.On(_outputContext).Method("VerifySkinFileExists").Will(Return.Value(true));
_skinSelector = new SkinSelector();
_request = _mock.NewMock<IRequest>();
}
示例3: RequestIPAddress
/// <summary>
/// Request the IP Address of a post.
/// </summary>
/// <param name="entryId"></param>
/// <param name="reason"></param>
/// <param name="context"></param>
/// <param name="modId"></param>
/// <returns></returns>
public string RequestIPAddress(int entryId, string reason, int modId, IInputContext context)
{
using (IDnaDataReader reader = context.CreateDnaDataReader("getipaddressforthreadentry"))
{
reader.AddParameter("entryid", entryId);
reader.AddParameter("userid", context.ViewingUser.UserID);
reader.AddParameter("reason", reason);
reader.AddParameter("modid", modId);
reader.Execute();
if (reader.HasRows)
{
reader.Read();
if (reader.DoesFieldExist("DatePosted") && !reader.IsDBNull("DatePosted"))
{
return string.Format("{0}\r\nPosted: {1}", reader[0].ToString(), reader["DatePosted"]);
}
else
{
return reader[0].ToString();
}
}
}
return "";
}
示例4: InputHandler
public InputHandler(IInputContext inputContext = null)
{
activeContext = inputContext;
Device.RegisterDevice(UsagePage.Generic, UsageId.GenericKeyboard, DeviceFlags.None);
Device.KeyboardInput += onKeyboardInput;
}
示例5: ArticleSubscriptionsList
/// <summary>
/// Default Constructor for the UserSubscriptionsList object
/// </summary>
public ArticleSubscriptionsList(IInputContext context)
: base(context)
{
string delimiter = NamespacePhrases.GetSiteDelimiterToken(context);
if (delimiter.Length > 0)
{
_token = delimiter.Substring(0, 1);
}
}
示例6: User
/// <summary>
/// Default constructor
/// </summary>
public User(IInputContext context)
: base(context)
{
_userData.Clear();
_userGroupsData.Clear();
//_viewingUserElementNode = CreateElementNode("VIEWING-USER");
//RootElement.AppendChild(_viewingUserElementNode);
}
示例7: WelcomePageBuilder
/// <summary>
///
/// </summary>
/// <param name="context"></param>
public WelcomePageBuilder(IInputContext context)
: base(context)
{
IsNativeRenderRequest = true;
UserLoggedIn = false;
UserLoginName = "";
DNAUserDisplayName = "";
DNAUserID = 0;
EditorOfSitesList = null;
}
示例8: WindowDrawingContext
public WindowDrawingContext(GraphicsContext graphics, IInputContext input)
: base(graphics.DeviceManager)
{
Graphics = graphics;
_window = new AppWindow(input);
_window.SizeChanged += win => Initialize();
_depthBuffer = new DepthBuffer(DeviceManager, _window.ClientWidth, _window.ClientHeight);
_windowTextureBuffer = new WindowTextureBuffer(DeviceManager, _window.Form.Handle, _window.ClientWidth, _window.ClientHeight);
}
示例9: PostToForumBuilder
/// <summary>
/// The default constructor
/// </summary>
/// <param name="context">An object that supports the IInputContext interface. basePage</param>
public PostToForumBuilder(IInputContext context)
: base(context)
{
_creator = new DnaDataReaderCreator(AppContext.TheAppContext.Config.ConnectionString,
AppContext.TheAppContext.Diagnostics);
_cache = CacheFactory.GetCacheManager();
//this is a clutch until we unify user objects
_viewingUser = InputContext.ViewingUser.ConvertUser();
_forumHelper = new ForumHelper(_creator, _viewingUser, InputContext.TheSiteList);
}
示例10: IsXmlSkin
/// <summary>
///
/// </summary>
/// <param name="inputContext"></param>
/// <returns></returns>
public bool IsXmlSkin(IInputContext inputContext)
{
List<string> skinNames = GetOrderedSkinNames(inputContext);
foreach (string skinName in skinNames)
{
string skin = skinName;
if ( skin.Equals("xml") || skin.EndsWith("-xml", true, null))
{
return true;
}
}
return false;
}
示例11: IsPureXml
/// <summary>
///
/// </summary>
/// <returns></returns>
public bool IsPureXml(IInputContext inputContext)
{
List<string> skinNames = GetOrderedSkinNames(inputContext);
foreach (string skinName in skinNames)
{
string skin = skinName;
if (skin.Equals("purexml") )
{
return true;
}
}
return false;
}
示例12: AppWindow
public AppWindow(IInputContext input)
{
_input = input;
_form = new RenderForm();
_renderLoop = new RenderLoop(Form);
_form.Resize += OnFormResize;
_form.Closed += OnFormClosed;
_form.LostFocus += OnLostFocus;
_form.MouseMove += OnMouseMove;
_form.MouseDown += OnMouseDown;
_form.MouseUp += OnMouseUp;
_form.MouseWheel += OnMouseWheel;
}
示例13: GetUserGroupsAsXml
/// <summary>
/// Get the xml representation of the groups a user is in for a specific site.
/// </summary>
/// <param name="userID">users id</param>
/// <param name="siteID">site id</param>
/// <param name="context">input context</param>
/// <returns></returns>
public static string GetUserGroupsAsXml(int userID, int siteID, IInputContext context)
{
string result = String.Empty;
var usersGroups = UserGroups.GetObject().GetUsersGroupsForSite(userID, siteID);
result = "<GROUPS>";
foreach (var group in usersGroups)
{
result += "<GROUP><NAME>";
result += group.Name.ToUpper();
result += "</NAME></GROUP>";
}
result += "</GROUPS>";
return result;
}
示例14: SetDefaultDiagnostics
/// <summary>
/// Helper method for creating a mocked default diagnostics object
/// </summary>
/// <param name="mockedInput">The context that you want to add the diagnostics mocked object to</param>
/// <returns>The new mocked Diagnostics object</returns>
public static IDnaDiagnostics SetDefaultDiagnostics(IInputContext mockedInput)
{
IDnaTracer mockedTracer = _mockery.NewMock<IDnaTracer>();
Stub.On(mockedTracer).Method("Write").Will(Return.Value(null));
Stub.On(mockedTracer).Method("Dispose").Will(Return.Value(null));
IDnaDiagnostics mockedDiag = _mockery.NewMock<IDnaDiagnostics>();
Stub.On(mockedDiag).Method("CreateTracer").Will(Return.Value(mockedTracer));
Stub.On(mockedDiag).Method("WriteTimedSignInEventToLog").Will(Return.Value(null));
Stub.On(mockedDiag).Method("WriteTimedEventToLog").Will(Return.Value(null));
Stub.On(mockedDiag).Method("WriteWarningToLog").Will(Return.Value(null));
Stub.On(mockedDiag).Method("WriteToLog").Will(Return.Value(null));
Stub.On(mockedInput).GetProperty("Diagnostics").Will(Return.Value(mockedDiag));
return mockedDiag;
}
示例15: GraphicsContext
public GraphicsContext(Lazy<IFileStore> files, IInputContext input)
{
var deviceManager = new DeviceManager();
DeviceManager = deviceManager;
TextureResourceManager = new TextureResourceManager(deviceManager, files);
TextureSamplerManager = new TextureSamplerManager(deviceManager);
MaterialManager = new MaterialManager(this);
BlendStateManager = new BlendStateManager(deviceManager);
RasterizerStateManager = new RasterizerStateManager(deviceManager);
RenderTargetFactory = new RenderTargetFactory(this, input);
VertexBufferManagerFactory = new VertexBufferManagerFactory(deviceManager);
IndexBufferManagerFactory = new IndexBufferManagerFactory(deviceManager);
ConstantBufferManagerFactory = new ConstantBufferManagerFactory(deviceManager);
}