protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); AppTheme.SetThemeFullScreen(this); AppTheme.SetThemeNeedMenuKey(this); filter = this.Intent.GetStringExtra("filter"); Window.SetSoftInputMode(SoftInput.StateAlwaysHidden); pdfViewCtrl = new PDFViewCtrl(this); System.IO.Stream stream = Assets.Open("uiextensions_config.json"); Config config = new Config(stream); uiExtensionsManager = new UIExtensionsManager(this, pdfViewCtrl, config); uiExtensionsManager.AttachedActivity = this; uiExtensionsManager.RegisterModule(App.Instance().GetLocalModule(filter)); uiExtensionsManager.OnCreate(this, pdfViewCtrl, savedInstanceState); pdfViewCtrl.UIExtensionsManager = uiExtensionsManager; pdfViewCtrl.AttachedActivity = this; filePath = AppFileUtil.GetFilePath(this, this.Intent, HomeModule.FileExtra); uiExtensionsManager.OpenDocument(filePath, null); SetContentView(uiExtensionsManager.ContentView); }
public override void ViewDidLoad() { base.ViewDidLoad(); this.View.BackgroundColor = UIColor.White; this.View.AutoresizingMask = UIViewAutoresizing.FlexibleLeftMargin | UIViewAutoresizing.FlexibleTopMargin | UIViewAutoresizing.FlexibleRightMargin | UIViewAutoresizing.FlexibleBottomMargin | UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth; this.pdfViewControl = new FSPDFViewCtrl(new CoreGraphics.CGRect( 0, 0, this.View.Frame.Size.Width, this.View.Frame.Size.Height)); pdfViewControl.SetRMSAppClientId(appClientId: "972b6681-fa03-4b6b-817b-c8c10d38bd20", redirectURI: "com.foxitsoftware.com.mobilepdf-for-ios://authorize"); pdfViewControl.RegisterDocEventListener(this); string configPath = NSBundle.MainBundle.PathForResource("uiextensions_config", "json"); this.extensionsMgr = new UIExtensionsManager(pdfViewControl, NSData.FromFile(configPath)); if (null == this.extensionsMgr) { // UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"" message:@"Extensions manager could not be loaded." delegate:self cancelButtonTitle:@"cancel" otherButtonTitles:nil, nil]; // [alert show]; return; } FSFileListViewController fileListViewController = new FSFileListViewController(); fileListViewController.WeakDelegate = this; this.pdfViewControl.RegisterDocEventListener(fileListViewController); this.rootViewController = new UINavigationController(fileListViewController); this.rootViewController.NavigationBarHidden = true; this.rootViewController.View.Frame = new CoreGraphics.CGRect( 0, 0, this.View.Frame.Size.Width, this.View.Frame.Size.Height); this.rootViewController.InteractivePopGestureRecognizer.Enabled = false; this.AddChildViewController(this.rootViewController); this.View.AddSubview(this.rootViewController.View); var weakSelf = new WeakReference(this); this.extensionsMgr.GoBack = () => { if (weakSelf.IsAlive) { this.rootViewController.PopViewController(true); } }; this.pdfViewControl.ExtensionsManager = extensionsMgr; PDFScanManager.InitializeScanner(0, 0); PDFScanManager.InitializeCompression(0, 0); UIButton button = new UIButton(); button.TouchUpInside += openScan; button.SetImage(UIImage.FromBundle("UIExtensionsResource/scan/scan"), UIControlState.Normal); fileListViewController.View.AddSubview(button); button.TranslatesAutoresizingMaskIntoConstraints = false; button.WidthAnchor.ConstraintEqualTo(60).Active = true; button.HeightAnchor.ConstraintEqualTo(60).Active = true; button.BottomAnchor.ConstraintEqualTo(fileListViewController.View.SafeAreaLayoutGuide.BottomAnchor, -15).Active = true; button.RightAnchor.ConstraintEqualTo(fileListViewController.View.RightAnchor, -15).Active = true; }