예제 #1
0
        /// <summary>
        /// Creates a userdocument for the invited user.
        /// </summary>
        /// <param name="sender">The sender of the event</param>
        /// <param name="args">The email of the user</param>
        private void proxy_GetUserByEmailCompleted(Object sender, ServiceReference.GetUserByEmailCompletedEventArgs args)
        {
            ServiceReference.ServiceUser shareUser = args.Result;

            if (shareUser != null)
            {
                ServiceReference.Service1Client proxy = new ServiceReference.Service1Client();
                proxy.AddUserDocumentInRootAsync(shareUser.id, session.CurrentDocumentID);
                proxy.ShareDocumentWebAsync(session.CurrentDocumentID, session.UserID, shareUser.id);
                MessageBox.Show("Document shared with " + shareUser.email);
            }
            else
            {
                MessageBox.Show("User does not exist");
            }
        }
예제 #2
0
        /// <summary>
        /// Sets gui view and session data. Calls additional asynchronous calls to set update view and data.
        /// </summary>
        /// <param name="sender">The sender of the event</param>
        /// <param name="args">The user credentials</param>
        private void proxy_GetUserByEmailAndPassCompleted(Object sender, ServiceReference.GetUserByEmailAndPassCompletedEventArgs args)
        {
            ServiceReference.ServiceUser user = args.Result;
            if (user != null) //login successful
            {
                //User logged in
                session.UserID       = user.id;
                session.RootFolderID = user.rootFolderId;

                gui.SetLoginView(true);

                ServiceReference.Service1Client proxy = new ServiceReference.Service1Client();
                proxy.GetAllFilesAndFoldersByUserIdAsync(user.id);
                proxy.GetAllFilesAndFoldersByUserIdCompleted += new EventHandler <ServiceReference.GetAllFilesAndFoldersByUserIdCompletedEventArgs>(proxy_GetAllFilesAndFoldersByUserIdCompleted);
            }
            else
            {
                session.Email            = "";
                gui.textBlockOnline.Text = "Offline";
                MessageBox.Show("Wrong email or password");
            }
        }