Last active
April 6, 2016 04:31
-
-
Save NVentimiglia/6a7fa8597f61b6b142fe53b78b665906 to your computer and use it in GitHub Desktop.
Tok.Xamarin Custom Render
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ContentPage.Content> | |
<Grid x:Name="MainGrid" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand"> | |
<Grid x:Name="videoContainer" /> | |
<!-- Video controll added into the video container. Bunch of Forms buttons and stuf below...--> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<View | |
xmlns="http://xamarin.com/schemas/2014/forms" | |
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | |
x:Class="Tok.OpenTokView"> | |
</View> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[assembly: Xamarin.Forms.ExportRenderer(typeof(Tok.OpenTokView), typeof(Tok.iOS.OpenTokViewRenderer))] | |
namespace Tok.iOS | |
{ | |
public class OpenTokViewRenderer : Xamarin.Forms.Platform.iOS.ViewRenderer, IOpenTok | |
{ | |
SessionDelegate _sessionDelegate; | |
PublisherDelegate _publisherDelegate; | |
SubscriberDelegate _subscriberDelegate; | |
OTSession _session; | |
OTPublisher _publisher; | |
OTSubscriber _subscriber; | |
protected OpenTokView _openTokView; | |
protected override void OnElementChanged(Xamarin.Forms.Platform.iOS.ElementChangedEventArgs<Xamarin.Forms.View> e) | |
{ | |
base.OnElementChanged(e); | |
if (e.NewElement == null) | |
return; | |
_openTokView = e.NewElement as OpenTokView; | |
var width = (float)UIScreen.MainScreen.Bounds.Size.Width; | |
var height = (float)UIScreen.MainScreen.Bounds.Size.Height - 20; | |
var view = new UIView(new RectangleF(0, 0, width, height)); | |
this.SetNativeControl(view); | |
config = _openTokView.Init(this); | |
_role = config.Role; | |
DoConnect(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void NavigateToDash() | |
{ | |
Device.BeginInvokeOnMainThread(() => | |
{ | |
try | |
{ | |
App.Logger.WriteLine("Call NavigateToDash"); | |
myMaster.Instance.PopToRoot(); | |
} | |
catch (Exception ex) | |
{ | |
App.LogIt("agChat:Failed to navigate - " + ex.Message); | |
} | |
}); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public async void PopToRoot() | |
{ | |
IsDashboard = true; | |
IsPresented = false; | |
try | |
{ | |
//Navigation View. =( | |
await Nav.PopToRootAsync(false); | |
} | |
catch (Exception ex) | |
{ | |
Nav.PopAsync(false); | |
App.LogIt("ERROR: PopToRoot()", ex.Message); | |
} | |
PaintBar(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Parent Page is where we call navigate.Pop(). Works in most other cases.