Ejemplo n.º 1
0
        public PayPage(IDijnetBrowser browser, Bill bill)
        {
            this.browser = browser ?? throw new ArgumentNullException(nameof(browser));

            InitializeComponent();
            ViewModel.Bill = bill;
        }
        // use to register runtime dependencies, and hold an instance (thread-safe)
        public void Register(CookieWebView webView, string mainUrlPath, bool disposeExisting = true)
        {
            if (webView == null)
            {
                throw new ArgumentNullException(nameof(webView));
            }
            if (mainUrlPath == null)
            {
                throw new ArgumentNullException(nameof(mainUrlPath));
            }

            rwLock.EnterWriteLock();
            try
            {
                // existing instance must be disposed, if disposable
                if (disposeExisting && instance is IDisposable disposable)
                {
                    disposable.Dispose();
                }

                instance = Container.Resolve <IDijnetBrowser>(nameof(DijnetBrowserFactory),
                                                              new ParameterOverride(typeof(WebView), webView),
                                                              new ParameterOverride(typeof(string), mainUrlPath));

                registered = true;
            }
            finally
            {
                rwLock.ExitWriteLock();
            }
        }
Ejemplo n.º 3
0
        public BillPage(IDijnetBrowser browser, PayPageFactory payPageFactory)
        {
            this.browser        = browser ?? throw new ArgumentNullException(nameof(browser));
            this.payPageFactory = payPageFactory ?? throw new ArgumentNullException(nameof(payPageFactory));

            InitializeComponent();

            ViewModel.BillRefreshCommand = new Command(async() => { await RefreshBillsAsync(); });
            ViewModel.LogoutCommand      = new Command(async() => { await LogoutAsync(); }, () => ViewModel.IsEnabled);
            ViewModel.IsEnabled          = true;
        }