예제 #1
0
파일: MainForm.cs 프로젝트: ltj/rentit
        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 };
        }
예제 #2
0
파일: MainForm.cs 프로젝트: ltj/rentit
        /// <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;
        }