Posts

Post not yet marked as solved
0 Replies
465 Views
hello, so i have sample code for windows for c#: using CefSharp; using CefSharp.Handler; using CefSharp.WinForms; using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.IO; using System.Windows.Forms; namespace FlymerLite { public class frmFlymerLite : Form { private IContainer components = null; private ChromiumWebBrowser browser; public frmFlymerLite() { CefSharpSettings.set_WcfEnabled(true); CefSettings cefSetting = new CefSettings(); cefSetting.set_CachePath(Path.GetFullPath("cache")); Cef.Initialize(cefSetting); this.InitializeComponent(); } private void browser_LoadingStateChanged(object sender, LoadingStateChangedEventArgs e) { } protected override void Dispose(bool disposing) { if ((!disposing ? false : this.components != null)) { this.components.Dispose(); } base.Dispose(disposing); } private void frmFlymerLite_Load(object sender, EventArgs e) { frmFlymerLite.RedirectionRequestHandler handler = new frmFlymerLite.RedirectionRequestHandler(); handler.AddRedirection("http://www.flyordie.com/games/online/c/game5.html?664", "js\\online\\c\\game5[664].html"); handler.AddRedirection("http://www.flyordie.com/games/deploy/pool/180910/code.jz", "js\\deploy\\pool\\180910\\code.jz"); handler.AddRedirection("http://www.flyordie.com/games/deploy/snooker/180910/code.jz", "js\\deploy\\snooker\\180910\\code.jz"); this.browser.set_RequestHandler(handler); this.browser.Load("http://www.flyordie.com/games/online/games.html?game=8Ball"); } private void InitializeComponent() { this.browser = new ChromiumWebBrowser(); base.SuspendLayout(); this.browser.set_ActivateBrowserOnCreation(false); this.browser.Dock = DockStyle.Fill; this.browser.Location = new Point(0, 0); this.browser.Name = "browser"; this.browser.Size = new System.Drawing.Size(1140, 600); this.browser.TabIndex = 0; this.browser.add_LoadingStateChanged(new EventHandler<LoadingStateChangedEventArgs>(this.browser_LoadingStateChanged)); base.AutoScaleDimensions = new SizeF(6f, 13f); base.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; base.ClientSize = new System.Drawing.Size(1140, 600); base.Controls.Add(this.browser); base.Name = "frmFlymerLite"; this.Text = "Flymer Lite"; base.Load += new EventHandler(this.frmFlymerLite_Load); base.ResumeLayout(false); } private class FilePathResourceRequestHandler : ResourceRequestHandler { private string filePath; public FilePathResourceRequestHandler(string filePath) { this.filePath = filePath; } protected override IResourceHandler GetResourceHandler(IWebBrowser chromiumWebBrowser, IBrowser browser, IFrame frame, IRequest request) { return ResourceHandler.FromFilePath(this.filePath, null, false); } } public class MyCustomLifeSpanHandler : ILifeSpanHandler { public MyCustomLifeSpanHandler() { } public bool DoClose(IWebBrowser chromiumWebBrowser, IBrowser browser) { return true; } public void OnAfterCreated(IWebBrowser chromiumWebBrowser, IBrowser browser) { } public void OnBeforeClose(IWebBrowser chromiumWebBrowser, IBrowser browser) { } public bool OnBeforePopup(IWebBrowser chromiumWebBrowser, IBrowser browser, IFrame frame, string targetUrl, string targetFrameName, WindowOpenDisposition targetDisposition, bool userGesture, IPopupFeatures popupFeatures, IWindowInfo windowInfo, IBrowserSettings browserSettings, ref bool noJavascriptAccess, out IWebBrowser newBrowser) { browser.get_MainFrame().LoadUrl(targetUrl); newBrowser = null; return true; } } public class RedirectionRequestHandler : RequestHandler { private Dictionary<string, string> redirections; public RedirectionRequestHandler() { this.redirections = new Dictionary<string, string>(); } public void AddRedirection(string url, string filePath) { this.redirections.Add(url, filePath); } public void ClearRedirections() { this.redirections.Clear(); } public bool ContainsUrl(string url) { return this.redirections.ContainsKey(url); } public string GetFilePath(string url) { return this.redirections[url]; } protected override IResourceRequestHandler GetResourceRequestHandler(IWebBrowser chromiumWebBrowser, IBrowser browser, IFrame frame, IRequest request, bool isNavigation, bool isDownload, string requestInitiator, ref bool disableDefaultHandling) { IResourceRequestHandler filePathResourceRequestHandler; if (!this.redirections.ContainsKey(request.get_Url())) { filePathResourceRequestHandler = null; } else { filePathResourceRequestHandler = new frmFlymerLite.FilePathResourceRequestHandler(this.redirections[request.get_Url()]); } return filePathResourceRequestHandler; } public bool RemoveUrl(string url) { return this.redirections.Remove(url); } } } } my question is how would i make this for mac os via xcode or visual studio? keep getting errors im trying to simply make a web site load my editied modified file instead of there own file on the server?
Posted
by keogal.
Last updated
.
Post not yet marked as solved
1 Replies
298 Views
hello, ok so im using story boards and swift. basically i hold CONTROL and drag from a button to my second view controller i made and click "present modally" option so now my second view controller shows once the button is clicked. so my main question is.. i would like to close the second view controller that i opened through code so once my function has executed at the end i would like the close the second view controller screen and go back to the main view controller screen. how is this done? i am currently using this line of code on my logout function self.present( UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "mainPAGE") as UIViewController, animated: true, completion: nil) so is there a way to close the opened view controller that was opened?
Posted
by keogal.
Last updated
.
Post marked as solved
2 Replies
270 Views
hello im making an app on xcode. and on the story board gui view ive got the layout of my view controllers and views and textboxs n that right for say the iphone 11 even emulator is perfect positions. my question is when i change the view or emulator to another iphone or screen size my view is all over the place can anyone post a link or help to have my view work on all iphone devices? or do i need to individually work on each iphone model design seperatly?
Posted
by keogal.
Last updated
.