本文整理汇总了C#中IFrame类的典型用法代码示例。如果您正苦于以下问题:C# IFrame类的具体用法?C# IFrame怎么用?C# IFrame使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IFrame类属于命名空间,在下文中一共展示了IFrame类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetCurrentMovableTileLabels
/// <summary>
/// Override method GetCurrentMovableTileLabels in classic game.
/// </summary>
/// <param name="frame">Frame of type IFrame.</param>
/// <returns>List of strings.</returns>
protected override List<string> GetCurrentMovableTileLabels(IFrame frame)
{
var result = new List<string>();
var nullTilePosition = this.FindTilePosition(string.Empty, frame);
if (this.NotFoundPosition == nullTilePosition)
{
return result;
}
if (0 <= nullTilePosition.Row - 1)
{
result.Add(frame.Tiles[nullTilePosition.Row - 1, nullTilePosition.Col].Label);
}
if (nullTilePosition.Row + 1 < frame.Rows)
{
result.Add(frame.Tiles[nullTilePosition.Row + 1, nullTilePosition.Col].Label);
}
if (0 <= nullTilePosition.Col - 1)
{
result.Add(frame.Tiles[nullTilePosition.Row, nullTilePosition.Col - 1].Label);
}
if (nullTilePosition.Col + 1 < frame.Cols)
{
result.Add(frame.Tiles[nullTilePosition.Row, nullTilePosition.Col + 1].Label);
}
return result;
}
示例2: using
CefReturnValue IRequestHandler.OnBeforeResourceLoad(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request, IRequestCallback callback)
{
using (callback)
{
if (request.Method == "POST")
{
using (var postData = request.PostData)
{
var elements = postData.Elements;
var charSet = request.GetCharSet();
foreach (var element in elements)
{
if (element.Type == PostDataElementType.Bytes)
{
var body = element.GetBody(charSet);
}
}
}
}
//Note to Redirect simply set the request Url
//if (request.Url.StartsWith("https://www.google.com", StringComparison.OrdinalIgnoreCase))
//{
// request.Url = "https://github.com/";
//}
//Callback in async fashion
//callback.Continue(true);
//return CefReturnValue.ContinueAsync;
}
return CefReturnValue.Continue;
}
示例3: Uri
CefReturnValue IRequestHandler.OnBeforeResourceLoad(IWebBrowser browserControl, IBrowser browser, IFrame frame,
IRequest request, IRequestCallback callback) {
if (CommonUrls.IsWithSixUrl(request.Url)) {
var headers = request.Headers;
headers[Common.ClientHeader] = DomainEvilGlobal.SecretData.UserInfo.ClientId.ToString();
headers[Common.ClientHeaderV] = Common.App.ProductVersion;
request.Headers = headers;
}
return CefReturnValue.Continue;
//Example of how to set Referer
// Same should work when setting any header
// For this example only set Referer when using our custom scheme
var url = new Uri(request.Url);
if (url.Scheme == "customscheme") // CefSharpSchemeHandlerFactory.SchemeName
{
var headers = request.Headers;
headers["Referer"] = "http://google.com";
request.Headers = headers;
}
//NOTE: If you do not wish to implement this method returning false is the default behaviour
// We also suggest you explicitly Dispose of the callback as it wraps an unmanaged resource.
//callback.Dispose();
//return false;
//NOTE: When executing the callback in an async fashion need to check to see if it's disposed
if (!callback.IsDisposed) {
using (callback) {
if (request.Method == "POST") {
using (var postData = request.PostData) {
if (postData != null) {
var elements = postData.Elements;
var charSet = request.GetCharSet();
foreach (var element in elements) {
if (element.Type == PostDataElementType.Bytes) {
var body = element.GetBody(charSet);
}
}
}
}
}
//Note to Redirect simply set the request Url
//if (request.Url.StartsWith("https://www.google.com", StringComparison.OrdinalIgnoreCase))
//{
// request.Url = "https://github.com/";
//}
//Callback in async fashion
//callback.Continue(true);
//return CefReturnValue.ContinueAsync;
}
}
return CefReturnValue.Continue;
}
示例4: GetCurrentMovableTileLabels
/// <summary>
/// Override method GetCurrentMovableTileLabels in RowCol game.
/// </summary>
/// <param name="frame">The Frame.</param>
/// <returns>Result by selection of tile.</returns>
protected override List<string> GetCurrentMovableTileLabels(IFrame frame)
{
var result = new List<string>();
var nullTilePosition = this.FindTilePosition(string.Empty, frame);
if (this.NotFoundPosition == nullTilePosition)
{
return result;
}
for (int row = 0; row < frame.Rows; row++)
{
if (row == nullTilePosition.Row)
{
continue;
}
result.Add(frame.Tiles[row, nullTilePosition.Col].Label);
}
for (int col = 0; col < frame.Cols; col++)
{
if (col == nullTilePosition.Col)
{
continue;
}
result.Add(frame.Tiles[nullTilePosition.Row, col].Label);
}
return result;
}
示例5: GetResourceHandler
public IResourceHandler GetResourceHandler(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request)
{
// Every time we request the main GPM page allow another JS injection
if (Regex.Match(request.Url, @"^http[s]?://play\.google\.com/music/listen", RegexOptions.IgnoreCase).Success)
{
firstJSOnly = true;
}
if (Regex.Match(request.Url, @"\.js", RegexOptions.IgnoreCase).Success && Regex.Match(request.Url, @"http", RegexOptions.IgnoreCase).Success && firstJSOnly)
{
firstJSOnly = false;
using (WebClient webClient = new WebClient())
{
// These are the JS files to inject into GPM
string custom_interface = Properties.Resources.custom_interface;
return ResourceHandler.FromStream(new MemoryStream(Encoding.UTF8.GetBytes(
webClient.DownloadString(request.Url) + ";window.onload=function(){csharpinterface.showApp();};document.addEventListener('DOMContentLoaded', function () {" +
"window.OBSERVER = setInterval(function() { if (document.getElementById('material-vslider')) { clearInterval(window.OBSERVER); " +
Properties.Resources.gmusic_min + Properties.Resources.gmusic_theme_min + Properties.Resources.gmusic_mini_player_min +
this.getInitCode() +
custom_interface +
"}}, 10);});")), webClient.ResponseHeaders["Content-Type"]);
}
}
return null;
}
开发者ID:ananthonline,项目名称:Google-Play-Music-Desktop-Player-UNOFFICIAL-,代码行数:26,代码来源:ResourceHandlerFactory.cs
示例6: Prepare
/// <summary>
/// Are about to send a new message
/// </summary>
/// <param name="message">Message to send</param>
/// <remarks>
/// Can be used to prepare the next message. for instance serialize it etc.
/// </remarks>
/// <exception cref="NotSupportedException">Message is of a type that the encoder cannot handle.</exception>
public void Prepare(object message)
{
if (!(message is IFrame))
throw new NotSupportedException("Only supports IFrame derived classes");
_frame = (IFrame) message;
}
示例7: NewTabEventArgs
bool ILifeSpanHandler.OnBeforePopup(IWebBrowser browserControl, IBrowser browser, IFrame frame, string targetUrl, string targetFrameName, WindowOpenDisposition targetDisposition, bool userGesture, IPopupFeatures popupFeatures, IWindowInfo windowInfo, IBrowserSettings browserSettings, ref bool noJavascriptAccess, out IWebBrowser newBrowser)
{
newBrowser = null;
//browserControl.Load(targetUrl);
OpenInNewTab?.Invoke(this, new NewTabEventArgs(targetUrl)); //this breaks when there are multiple window.open calls from JS.
return true;
}
示例8: Send
public void Send(IFrame frame)
{
if (frame == null) throw new ArgumentNullException("frame");
if (frame.Name != "MESSAGE")
throw new InvalidOperationException("Only MESSAGE frames may be sent through a subscription.");
_messagesSentThisSecond++;
if (IsPending)
throw new InvalidOperationException("Is either waiting on an ACK/NACK for the current message, or you've tried to send too many messages per second without acking them.");
if (IsThrottled)
throw new InvalidOperationException("You've tried to send too many messages per second. Adjust the MaxMessagesPerSecond property.");
if (_pendingFrames.Count >= 20)
throw new InvalidOperationException("Client already have more then 20 pending messages. Start ACK them.");
// not 100% accurate, but should keep the throttling reasonable stable.
if (DateTime.Now.Subtract(_startThrottle).TotalMilliseconds > 1000)
{
_messagesSentThisSecond = 0;
_startThrottle = DateTime.Now;
}
if (AckType != "auto")
_pendingFrames.Add(frame);
Client.Send(frame);
}
示例9: OnBeforeContextMenu
public bool OnBeforeContextMenu(IWebBrowser browser, IFrame frame, IContextMenuParams parameters)
{
Console.WriteLine("Context menu opened");
Console.WriteLine(parameters.MisspelledWord);
return true;
}
示例10: EnqueueFrame
protected void EnqueueFrame(NetContext context, IFrame frame)
{
lock(this)
{
AddFrame(context, ref singleFrameOrList, frame);
}
}
示例11: LoadErrorEventArgs
public LoadErrorEventArgs(IFrame frame, CefErrorCode errorCode, string errorText, string failedUrl)
{
Frame = frame;
ErrorCode = errorCode;
ErrorText = errorText;
FailedUrl = failedUrl;
}
示例12: ValidateUserDefinedLink
private static bool ValidateUserDefinedLink(IFrame frame)
{
var urlLinkFrame = FrameUtils.ConvertToUserDefinedURLLinkFrame(frame);
var ok = ValidateTextEncoding(urlLinkFrame.TextEncoding);
return ok;
}
示例13: ValidatePictureFrame
private static bool ValidatePictureFrame(IFrame frame)
{
var pictureFrame = FrameUtils.ConvertToPictureFrame(frame);
var ok = ValidateTextEncoding(pictureFrame.TextEncoding);
return ok;
}
示例14: Handle
public override int Handle(IFrame frame, IList<IFrame> frames)
{
return frame.Rolls
.Where(r => r.Pins.HasValue)
.Select(r => r.Pins.Value)
.Sum();
}
示例15: FrameLoadStartEventArgs
public FrameLoadStartEventArgs(IBrowser browser, IFrame frame)
{
Browser = browser;
Frame = frame;
Url = frame.Url;
IsMainFrame = frame.IsMain;
}