private void InviteItem_Click(object sender, RoutedEventArgs e)
        {
            MenuItem menu = sender as MenuItem;
            CollaborationsViewModel.Collaboration item = menu.DataContext as CollaborationsViewModel.Collaboration;

            var service = CahootsPackage.Instance.CommunicationRelay.Services["op"] as OpService;

            var users = CahootsPackage.Instance.CommunicationRelay.Service<UsersService>();
            var window = new SelectCollaborators(users.GetCollaborators());

            if (window.ShowDialog() == true)
            {
                var collaborators = window.Selected.Select(c => c.UserName);
                foreach (var c in collaborators)
                {
                    service.InviteUser(c, item.OpId);
                }
            }
        }
Example #2
0
        /// <summary>
        /// Opens the share starter.
        /// </summary>
        /// <param name="control">The control.</param>
        /// <param name="handled">if set to <c>true</c> [handled].</param>
        /// <param name="cancelDefault">
        ///   if set to <c>true</c> [cancel default].
        /// </param>
        protected void OpenShareStarter(
                object control,
                ref bool handled,
                ref bool cancelDefault)
        {
            var users = this.CommunicationRelay.Service<UsersService>();
            var window = new SelectCollaborators(users.GetCollaborators());

            if (window.ShowDialog() == true)
            {
                var collaborators = window.Selected.Select(c => c.UserName);

                var solution = this.ApplicationObject.Solution.FullName;
                var solutionPath = solution.Substring(
                        0,
                        solution.LastIndexOf('\\'));

                var documentPath =
                        this.ApplicationObject.ActiveDocument.FullName;
                var documentId =
                    documentPath.Replace(solutionPath, "").Replace('\\', '/');

                this.CommunicationRelay.Service<OpService>()
                        .StartCollaboration(
                                this.UserName,
                                documentId,
                                collaborators.ToList());
            }
        }