Ejemplo n.º 1
0
        public MainForm()
        {
            InitializeComponent();

            var binding = new BasicHttpBinding();
            var address = new EndpointAddress("http://rentit.itu.dk/rentit01/RentItService.svc");
            rentItProxy = new RentItClient(binding, address);

            // Call a method on the web service to check for connectivity.
            // A potential EndpointNotFoundException is caught in Program.cs.
            rentItProxy.GetAllGenres(MediaType.Book);

            TopBar.RentItProxy = rentItProxy;
            TopBar.Credentials = credentials;
            TopBar.ContentChangeEvent += ChangeContent;
            TopBar.CredentialsChangeEvent += ChangeCredentials;
            TopBar.CreditsChangeEvent += ChangeCredits;

            Content = new MainScreen { RentItProxy = rentItProxy };
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Handles change requests to the current global credentials of the application.
        /// </summary>
        /// <param name="sender">The sender of the request.</param>
        /// <param name="args">The arguments specifying the new credentials.</param>
        private void ChangeCredentials(object sender, CredentialsChangeArgs args)
        {
            credentials = args.Credentials;

            Cursor.Current = Cursors.WaitCursor;
            RentItUserControl nextScreen = new MainScreen {
                                                              RentItProxy = this.rentItProxy,
                                                              Credentials = this.credentials
                                                          };
            ChangeContent(sender, new ContentChangeArgs(nextScreen, "RentIt"));
            Cursor.Current = Cursors.Default;

            TopBar.Credentials = this.credentials;
        }