Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create MainView and set address quickly fails to load. #305

Closed
brock8503 opened this issue Apr 1, 2014 · 9 comments
Closed

Create MainView and set address quickly fails to load. #305

brock8503 opened this issue Apr 1, 2014 · 9 comments
Milestone

Comments

@brock8503
Copy link
Contributor

I am noticing a stability issue when setting the address after creating our mainview control. If an address is set directly after creating a new mainview and browser the browser fails to load the address.

Example:

list.Add(new MainView
{
      DataContext = new MainViewModel("about:blank")
});
list[0].Address = "http://www.kylemcfarland.com";
list.Add(new MainView
{
      DataContext = new MainViewModel("about:blank")
});
list[1].Address = "http://www.google.com";

@Sertelegger
Copy link

I had something similar where it occasionally failed, and then figured out
that you should make sure the IsBrowserInitialized property is set to true
and/or wait for a PropertyChanged event to happen setting the property to
true. The code looks something like this:

if (myWebView.IsBrowserInitialized) myWebView.Load(someUrl);
else myWebView.PropertyChanged += (sender, eventArgs) =>
{
if (eventArgs.PropertyName == "IsBrowserInitialized" &&
myWebView.IsBrowserInitialized)
myWebView.Load(someUrl);
}

Since it doesn't happen all the time most of the time the property will be
true on first try already, and for the times where it's not the property
changed event handler will take care of it. Hasn't failed ever since!

// Sascha

On Tue, Apr 1, 2014 at 3:46 PM, Kyle McFarland notifications@gh.neting.ccwrote:

I am noticing a stability issue when setting the address after creating
our mainview control. If an address is set directly after creating a new
mainview and browser the browser fails to load the address.

Example:

list.Add(new MainView
{
DataContext = new MainViewModel("about:blank")
});
list[0].Address = "http://www.kylemcfarland.com";
list.Add(new MainView
{
DataContext = new MainViewModel("about:blank")
});
list[1].Address = "http://www.google.com";

Reply to this email directly or view it on GitHubhttps://github.com//issues/305
.

@perlun
Copy link
Member

perlun commented Apr 2, 2014

Sascha, that is the CefSharp1 approach but with the latest master things have changed a bit (to better support MVVM).

@Sertelegger
Copy link

Glad to hear that, can't wait to try it out as soon as jornh finishes
RegisterJsObject support :-)

// Sascha

On Tue, Apr 1, 2014 at 6:13 PM, Per Lundberg notifications@gh.neting.ccwrote:

Sascha, that is the CefSharp1 approach but with the latest master things
have changed a bit (to better support MVVM).

Reply to this email directly or view it on GitHubhttps://github.com//issues/305#issuecomment-39279543
.

@perlun
Copy link
Member

perlun commented Apr 2, 2014

@jornh, you see here that the expectations for you on #159 are high... 😉

@jornh
Copy link
Contributor

jornh commented Apr 2, 2014

@perlun I can easily live with high expectations for #159 as long as you and @JanEggers are the ones putting in the labor on it chop, chop guys! 📆 Clock's ticking towards 3.31.0! 😆

And always motivating to know what you are working on is what (some) people want the most!

Still, (back to on-topic) @perlun I guess @brock8503 ison master so if he has issues we can not close this #305 thing just yet (unless we wan't to live with the work around for now).

@JanEggers
Copy link
Contributor

@perlun: there is still a issue in cefsharp3 i didnt create a pr for that one yet but we break binding.

we have to use setCurrentValue for all dependency properties otherwise we overwrite the binding with a local value. ie: if load finished and cef calls SetAdress

@JanEggers
Copy link
Contributor

i added a pr #308

@brock8503
Copy link
Contributor Author

@perlun and @jornh, The simple workaround for this is to initialize with the desired URL. Setting the address some time after the browser is created seems to work fine.

list.Add(new MainView
{
      DataContext = new MainViewModel("http://www.google.com")
});

@brock8503 brock8503 mentioned this issue Apr 2, 2014
@jornh jornh added bug labels Apr 3, 2014
@jornh jornh modified the milestones: 31.0.0, 31.1.0 Apr 3, 2014
@perlun perlun modified the milestones: 31.0.0, 31.0.0-pre1 Apr 15, 2014
@perlun perlun closed this as completed Apr 20, 2014
@perlun
Copy link
Member

perlun commented Apr 20, 2014

(Fixed as of #308 merge)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants