• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IInputContext类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IInputContext的典型用法代码示例。如果您正苦于以下问题:C# IInputContext类的具体用法?C# IInputContext怎么用?C# IInputContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IInputContext类属于命名空间,在下文中一共展示了IInputContext类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
            
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:66,代码来源:SkinSelector.cs


示例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>();
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:26,代码来源:SkinSelectorTests.cs


示例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 "";
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:33,代码来源:IPAddressRequester.cs


示例4: InputHandler

        public InputHandler(IInputContext inputContext = null)
        {
            activeContext = inputContext;

            Device.RegisterDevice(UsagePage.Generic, UsageId.GenericKeyboard, DeviceFlags.None);

            Device.KeyboardInput += onKeyboardInput;
        }
开发者ID:sch-gamedev,项目名称:trong,代码行数:8,代码来源:InputHandler.cs


示例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);
     }
 }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:12,代码来源:ArticleSubscriptionList.cs


示例6: User

        /// <summary>
        /// Default constructor
        /// </summary>
        public User(IInputContext context)
            : base(context)
        {
            _userData.Clear();
            _userGroupsData.Clear();

            //_viewingUserElementNode = CreateElementNode("VIEWING-USER");
            //RootElement.AppendChild(_viewingUserElementNode);
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:12,代码来源:User.cs


示例7: WelcomePageBuilder

 /// <summary>
 /// 
 /// </summary>
 /// <param name="context"></param>
 public WelcomePageBuilder(IInputContext context)
     : base(context)
 {
     IsNativeRenderRequest = true;
     UserLoggedIn = false;
     UserLoginName = "";
     DNAUserDisplayName = "";
     DNAUserID = 0;
     EditorOfSitesList = null;
 }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:14,代码来源:WelcomePageBuilder.cs


示例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);
        }
开发者ID:gitter-badger,项目名称:Grasshopper,代码行数:11,代码来源:WindowDrawingContext.cs


示例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);
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:16,代码来源:PostToForumBuilder.cs


示例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;
 }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:18,代码来源:SkinSelector.cs


示例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;
 }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:17,代码来源:SkinSelector.cs


示例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;
        }
开发者ID:gitter-badger,项目名称:Grasshopper,代码行数:14,代码来源:AppWindow.cs


示例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;
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:21,代码来源:UserGroupsHelper.cs


示例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;
 }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:19,代码来源:DnaMockery.cs


示例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);
        }
开发者ID:gitter-badger,项目名称:Grasshopper,代码行数:16,代码来源:GraphicsContext.cs


示例16: SetDefaultAllowedURLs

        /// <summary>
        /// Helper method for creating the mocked AllowedURLs object
        /// </summary>
        /// <param name="mockedInput">The context that you want to add the AllowedURLs mocked object to</param>
        /// <returns>The new mocked AllowedURLs object</returns>
        public static IAllowedURLs SetDefaultAllowedURLs(IInputContext mockedInput)
        {
            //IAllowedURLs mockedAllowedURLs = _mockery.NewMock<IAllowedURLs>();
            //Stub.On(mockedAllowedURLs).Method("DoesAllowedURLListContain").Will(Return.Value(true));

            //Stub.On(mockedAllowedURLs).Method("WriteWarningToLog").Will(Return.Value(null));
            //Stub.On(mockedAllowedURLs).Method("WriteToLog").Will(Return.Value(null));
            //Stub.On(mockedInput).GetProperty("AllowedURLs").Will(Return.Value(mockedAllowedURLs));
            //return mockedAllowedURLs;


            AllowedURLs urls = new AllowedURLs();
            urls.LoadAllowedURLLists(mockedInput);

            Stub.On(mockedInput).GetProperty("AllowedURLs").Will(Return.Value(urls));
            return urls;
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:22,代码来源:DnaMockery.cs


示例17: WillLowerCaseTheDefaultSkin

        public void WillLowerCaseTheDefaultSkin()
        {
            ISite siteWithMixedCaseDefaultSkin = _mock.NewMock<ISite>();
            Stub.On(siteWithMixedCaseDefaultSkin).GetProperty("DefaultSkin").Will(Return.Value("deFAulT-SKIN"));
            Stub.On(siteWithMixedCaseDefaultSkin).Method("DoesSkinExist").With("deFAulT-SKIN").Will(Return.Value(true));
            Stub.On(_inputContext).GetProperty("CurrentSite").Will(Return.Value(siteWithMixedCaseDefaultSkin));
            Stub.On(siteWithMixedCaseDefaultSkin).GetProperty("SkinSet").Will(Return.Value("vanilla"));

            _inputContext = _mock.NewMock<IInputContext>();
            Stub.On(_inputContext).GetProperty("CurrentSite").Will(Return.Value(siteWithMixedCaseDefaultSkin));

            setupRequestToHaveNoSkinSpecifiedOnUrl();
            setupUserAsNotLoggedIn();
           

            _skinSelector.Initialise(_inputContext, _outputContext);
            Assert.AreEqual("default-skin", _skinSelector.SkinName);
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:18,代码来源:SkinSelectorTests.cs


示例18: GetUserGroupsElement

        /// <summary>
        /// Get the xml element 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 XmlElement GetUserGroupsElement(int userID, int siteID, IInputContext context)
        {
            string result = String.Empty;

            XmlDocument groupsdoc = new XmlDocument();
			XmlElement groups = groupsdoc.CreateElement("GROUPS");

			var usersGroups = UserGroups.GetObject().GetUsersGroupsForSite(userID, siteID);
            foreach (var groupObj in usersGroups)
			{
				XmlElement group = groupsdoc.CreateElement("GROUP");
				XmlElement name = groupsdoc.CreateElement("NAME");
                name.AppendChild(groupsdoc.CreateTextNode(groupObj.Name));
				group.AppendChild(name);
				groups.AppendChild(group);
			}

			return groups;
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:26,代码来源:UserGroupsHelper.cs


示例19: SetupArticles

        void SetupArticles(IInputContext context)
        {
            int entryID = 0;
            int h2g2ID = 0;
            //create a dummy article

            using (IDnaDataReader reader = context.CreateDnaDataReader("createguideentry"))
            {
                reader.AddParameter("subject", "TEST ARTICLE");
                reader.AddParameter("bodytext", "TEST ARTICLE");
                reader.AddParameter("extrainfo", "<EXTRAINFO>TEST ARTICLE</EXTRAINFO>");
                reader.AddParameter("editor", 6);
                reader.AddParameter("typeid", 3001);
                reader.AddParameter("status", 3);

                reader.Execute();
                Assert.IsTrue(reader.Read(), "Article not created");
                entryID = reader.GetInt32NullAsZero("entryid");
                h2g2ID = reader.GetInt32NullAsZero("h2g2id");

                Assert.IsTrue(entryID != 0, "Article not created");
            }

            int recommendationID = 0;
            //recommnend article...
            using (IDnaDataReader reader = context.CreateDnaDataReader("storescoutrecommendation"))
            {
                reader.AddParameter("entryid", entryID);
                reader.AddParameter("@comments", "scout comment");
                reader.AddParameter("scoutid", 6);
                reader.Execute();
                Assert.IsTrue(reader.Read(), "Recommendation not created");
                recommendationID = reader.GetInt32NullAsZero("RecommendationID");
                Assert.IsTrue(recommendationID != 0, "Recommendation not created");
            }
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:36,代码来源:ArticleListTests.cs


示例20: TestInputContextComponent

 /// <summary>
 /// Default constructor for the Forum component
 /// </summary>
 /// <param name="context">The Context of the DnaPage the component is created in.</param>
 public TestInputContextComponent(IInputContext context)
     : base(context)
 {
 }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:8,代码来源:TestInputContextComponent.cs



注:本文中的IInputContext类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IInputElement类代码示例发布时间:2022-05-24
下一篇:
C# IInputArray类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap