private bool checkConversation(ConversationDetails proposedDetails) { if (DataContext == null) return false;//There is no current conversation proposedDetails.Title = proposedDetails.Title.Trim(); var currentDetails = (ConversationDetails)DataContext; var iAmTheAuthor = me == (((ConversationDetails)DataContext).Author); var thisIsAValidTitle = !String.IsNullOrEmpty(proposedDetails.Title.Trim()); var thisTitleIsNotTaken = (extantConversations.Where(c=> (c.Title != currentDetails.Title) && c.Title.ToLower().Equals(proposedDetails.Title.ToLower())).Count() == 0); return iAmTheAuthor && thisIsAValidTitle && thisTitleIsNotTaken; }
private bool doesConversationAlreadyExist(ConversationDetails details) { if (details == null) return true; if (details.Title.Length == 0) return true; var currentConversations = (List<ConversationDetails>)this.conversations.ItemsSource; var relevantConversations = currentConversations.Where(c => c.Title == details.Title); bool conversationExists = relevantConversations.Count() > 0; return !conversationExists; }
private void ConversationList_ShowConversationDetails(object sender, EventArgs e) { _parent.Darkened = true; ConversationDetails details = new ConversationDetails(ConversationList.SelectedConversation); details.CloseButtonClicked += (s, ea) => { _parent.mainCanvas.Children.Remove(details); _parent.Darkened = false; }; _parent.mainCanvas.Children.Add(details); }
public ConversationDetails Update(ConversationDetails details) { try { return (ConversationDetails)server.GetDatabase("conversation").SaveDocument(details); } catch (CouchException e) { ProviderMonitor.HealthCheck(() => { /*Everything is AOk*/}); return details; } }
/// <summary> /// Opens the conversation details view. /// </summary> private void OpenConversationDetailsView() { //this.ViewModel.MessageVM.RefreshMessagesSource(); // this.ConversationDetails.Height = this.ActualHeight; IntializationAppIntegrationArea.ShellView.UxMessagesTab.Content = this.ConversationDetails; //To expand certain message in case of coming from Add-On through double click on certain message eNegMessanger.LoadCompleted.Send(eNegMessanger.OperationType.SeeCertainMessage.ToString()); ConversationDetails.RaiseCanExecuteCommands(); }
public ConversationDetails DetailsOf(string conversationTitle) { var details = new ConversationDetails{Title = conversationTitle, Author="anAuthor"}; switch (conversationTitle) { case "Sample": details.Slides = Enumerable.Range(1, 20).Select(i=>new Slide{id=i}).ToList(); break; case "First": details.Slides = Enumerable.Range(21, 40).Select(i=>new Slide{id=i}).ToList(); break; case "Second": details.Slides = Enumerable.Range(41, 60).Select(i=>new Slide{id=i}).ToList(); break; case "Third": details.Slides = Enumerable.Range(61, 80).Select(i=>new Slide{id=i}).ToList(); break; default: details.Slides = new[] { 0 }.Select(i=>new Slide{id=i}).ToList(); details.Title = "Not found"; break; } return details; }
private void UpdateConversationDetails(ConversationDetails details) { extantConversations = null; extantConversations = ConversationDetailsProviderFactory.Provider.ListConversations(); }
public void Display(ConversationDetails details) {//We only display the details of our current conversation (or the one we're entering) var doDisplay = (Action)delegate { if (Globals.me == details.Author) isAuthor = true; else isAuthor = false; var thumbs = new ObservableCollection<ThumbnailInformation>(); foreach (var slide in details.Slides) { if (slide.type == Slide.TYPE.SLIDE) { thumbs.Add( new ThumbnailInformation { slideId = slide.id, slideNumber = details.Slides.Where(s => s.type == Slide.TYPE.SLIDE).ToList().IndexOf(slide) + 1, }); } } slides.ItemsSource = thumbs; if(moveTo) { currentSlideIndex++; moveTo = false; } slides.SelectedIndex = currentSlideIndex; if (slides.SelectedIndex == -1) slides.SelectedIndex = 0; thumbnailList = thumbs; foreach (var thumb in thumbnailList) loadThumbnail(thumb.slideId); }; if (Thread.CurrentThread != Dispatcher.Thread) Dispatcher.BeginInvoke(doDisplay); else doDisplay(); Commands.RequerySuggested(Commands.MoveTo); }
private bool canCreate(ConversationDetails details) { return details.Title.Length > 0; }
public ConversationDetails Create(ConversationDetails details) { return details; }
private bool checkConversationCommand(ConversationDetails details) { return checkConversation(details); }
//Loads the selected conversation from the friends list into chatListView (TASK METHOD INSURES ALL VARIABLES LOAD) public async Task parseSelectedConversation(string urlOfConversation) { using (HttpClient client = new HttpClient()) //using block makes the object disposable (one time use) { using (HttpResponseMessage response = await client.GetAsync(urlOfConversation)) { using (HttpContent content = response.Content) { string content_string = await content.ReadAsStringAsync(); System.Net.Http.Headers.HttpContentHeaders content_headers = content.Headers; currentConversation = JsonConvert.DeserializeObject<ConversationDetails>(content_string); //Load data into the otherUser variable (person you're speaking with) by matching the currentUser's url tag with participants //If they match, set the otherUser variable to the other participant in the conversation if (currentConversation.participant_1 == currentUser.user_url) { HttpClient subClient = new HttpClient(); HttpResponseMessage subResponse = await subClient.GetAsync(this.currentConversation.participant_2); HttpContent subContent = subResponse.Content; string content_string2 = await subContent.ReadAsStringAsync(); //System.Net.Http.Headers.HttpContentHeaders content_headers2 = subContent.Headers; otherUser = JsonConvert.DeserializeObject<UserDetails>(content_string2); } else if (currentConversation.participant_2 == currentUser.user_url) { HttpClient subClient = new HttpClient(); HttpResponseMessage subResponse = await subClient.GetAsync(this.currentConversation.participant_1); HttpContent subContent = subResponse.Content; string content_string2 = await subContent.ReadAsStringAsync(); //System.Net.Http.Headers.HttpContentHeaders content_headers2 = subContent.Headers; otherUser = JsonConvert.DeserializeObject<UserDetails>(content_string2); } //Loads the otherUser's public key into memory { HttpClient subClient = new HttpClient(); HttpResponseMessage subResponse = await subClient.GetAsync(otherUser.public_key); HttpContent subContent = subResponse.Content; string content_string2 = await subContent.ReadAsStringAsync(); dynamic incomingJSON = JsonConvert.DeserializeObject(content_string2); otherUser.public_key_ACTUAL = incomingJSON.key; Debug.WriteLine("PUB KEY ACTUAL: " + otherUser.public_key_ACTUAL); } if (App.DEBUG_MODE == true) { Debug.WriteLine("CONVO URL: "+this.currentConversation.conversation_url); Debug.WriteLine("PART 1: "+this.currentConversation.participant_1); Debug.WriteLine("PART 2: "+this.currentConversation.participant_2); for (int x = 0; x < this.currentConversation.conversation_Messages.Count; x++) { Debug.WriteLine("MESSAGES: "+this.currentConversation.conversation_Messages[x]); } } } } } App.secrets.loadOtherUserPublicKey(otherUser.public_key_ACTUAL); }
public ConversationDetails Create(string name) { try { var conversationDetails = new ConversationDetails { Title = name }; return Create(conversationDetails); } catch (CouchException e) { ProviderMonitor.HealthCheck(() => { /*Everything is AOk*/}); return new ConversationDetails(); } }
public ConversationDetails Create(ConversationDetails details) { var info = GetApplicationLevelInformation(); try { var slideId = info.currentId; if (details.Tag == null) details.Tag = "unTagged"; info.currentId = info.currentId + slideIncrementer; details.Created = DateTime.Now; details.Slides = new List<Slide> { new Slide { id = slideId, index = 0 } }; var newConversation = (ConversationDetails)server.GetDatabase("conversation").SaveDocument(details); UpdateApplicationLevelInformation(info); return newConversation; } catch (CouchException e) { ProviderMonitor.HealthCheck(() => { /*Everything is AOk*/}); return details; } }
//Loads the selected conversation from the friends list into chatListView (TASK METHOD INSURES ALL VARIABLES LOAD) public async Task parseSelectedConversation(string urlOfConversation) { using (HttpClient client = new HttpClient()) //using block makes the object disposable (one time use) { using (HttpResponseMessage response = await client.GetAsync(urlOfConversation)) { using (HttpContent content = response.Content) { string content_string = await content.ReadAsStringAsync(); System.Net.Http.Headers.HttpContentHeaders content_headers = content.Headers; currentConversation = JsonConvert.DeserializeObject <ConversationDetails>(content_string); //Load data into the otherUser variable (person you're speaking with) by matching the currentUser's url tag with participants //If they match, set the otherUser variable to the other participant in the conversation if (currentConversation.participant_1 == currentUser.user_url) { HttpClient subClient = new HttpClient(); HttpResponseMessage subResponse = await subClient.GetAsync(this.currentConversation.participant_2); HttpContent subContent = subResponse.Content; string content_string2 = await subContent.ReadAsStringAsync(); //System.Net.Http.Headers.HttpContentHeaders content_headers2 = subContent.Headers; otherUser = JsonConvert.DeserializeObject <UserDetails>(content_string2); } else if (currentConversation.participant_2 == currentUser.user_url) { HttpClient subClient = new HttpClient(); HttpResponseMessage subResponse = await subClient.GetAsync(this.currentConversation.participant_1); HttpContent subContent = subResponse.Content; string content_string2 = await subContent.ReadAsStringAsync(); //System.Net.Http.Headers.HttpContentHeaders content_headers2 = subContent.Headers; otherUser = JsonConvert.DeserializeObject <UserDetails>(content_string2); } //Loads the otherUser's public key into memory { HttpClient subClient = new HttpClient(); HttpResponseMessage subResponse = await subClient.GetAsync(otherUser.public_key); HttpContent subContent = subResponse.Content; string content_string2 = await subContent.ReadAsStringAsync(); dynamic incomingJSON = JsonConvert.DeserializeObject(content_string2); otherUser.public_key_ACTUAL = incomingJSON.key; Debug.WriteLine("PUB KEY ACTUAL: " + otherUser.public_key_ACTUAL); } if (App.DEBUG_MODE == true) { Debug.WriteLine("CONVO URL: " + this.currentConversation.conversation_url); Debug.WriteLine("PART 1: " + this.currentConversation.participant_1); Debug.WriteLine("PART 2: " + this.currentConversation.participant_2); for (int x = 0; x < this.currentConversation.conversation_Messages.Count; x++) { Debug.WriteLine("MESSAGES: " + this.currentConversation.conversation_Messages[x]); } } } } } App.secrets.loadOtherUserPublicKey(otherUser.public_key_ACTUAL); }
private bool checkConversation(ConversationDetails proposedDetails) { if (proposedDetails == null) return false; if (extantConversations == null) return false; proposedDetails.Title = proposedDetails.Title.Trim(); var currentDetails = details; var thisIsAValidTitle = !String.IsNullOrEmpty(proposedDetails.Title.Trim()); var thisTitleIsNotTaken = (extantConversations.Where(c => c.Title.ToLower().Equals(proposedDetails.Title.ToLower())).Count() == 0); var IAmTheAuthor = (details.Author == Globals.me); return thisIsAValidTitle && thisTitleIsNotTaken && IAmTheAuthor; }
private void UpdateDialogBoxAppearance() { switch (DialogMode) { case ConversationConfigurationMode.Create: createGroup.Visibility = Visibility.Visible; importGroup.Visibility = Visibility.Collapsed; CommitButton.Content = "Create Conversation"; Height = 400; Width = 800; action = "create"; if (details == null) details = new ConversationDetails { Author = Globals.me, Created = DateTime.Now, Subject = "Unrestricted", Title = "Please enter title here", Permissions = Permissions.LECTURE_PERMISSIONS }; break; case ConversationConfigurationMode.Edit: createGroup.Visibility = Visibility.Collapsed; importGroup.Visibility = Visibility.Collapsed; CommitButton.Content = "Update Conversation"; action = "edit"; Height = 400; Width = 380; if (details == null) { MessageBox.Show("No valid conversation currently selected. Please ensure you are in a conversation you own when editing a conversation."); this.Close(); } break; case ConversationConfigurationMode.Import: createGroup.Visibility = Visibility.Visible; importGroup.Visibility = Visibility.Visible; CommitButton.Content = "Import powerpoint into Conversation"; importSelector.SelectedItem = importSelector.Items[0]; action = "import"; Height = 400; Width = 800; if (details == null) details = new ConversationDetails { Author = Globals.me, Created = DateTime.Now, Subject = "Unrestricted", Title = "Please enter title here", Permissions = Permissions.LECTURE_PERMISSIONS }; break; case ConversationConfigurationMode.Delete: createGroup.Visibility = Visibility.Collapsed; importGroup.Visibility = Visibility.Collapsed; CommitButton.Content = "Delete Conversation"; action = "delete"; Height = 400; Width = 380; if (details == null) { MessageBox.Show("No valid conversation currently selected. Please ensure you are in a conversation you own when deleting a conversation."); this.Close(); } break; } }
public void Display(ConversationDetails details) { Dispatcher.Invoke((Action) delegate { conversationDetails = details; if (me == details.Author) isAuthor = true; else isAuthor = false; var thumbs = new ObservableCollection<ThumbnailInformation>(); foreach (var slide in details.Slides) { if (slide.type == Slide.TYPE.SLIDE) { thumbs.Add( new ThumbnailInformation { slideId = slide.id, slideNumber = details.Slides.Where(s=>s.type==Slide.TYPE.SLIDE).ToList().IndexOf(slide) + 1, }); } } slides.ItemsSource = thumbs; slides.SelectedIndex = currentSlideIndex; if (slides.SelectedIndex == -1) slides.SelectedIndex = 0; thumbnailList = thumbs; foreach(var thumb in thumbnailList) loadThumbnail(thumb.slideId); }); Commands.RequerySuggested(Commands.MoveTo); }