private void PickUpAllHandler(object sender, MouseButtonEventArgs e) { try { MessageBoxItem[] stackPanels = new MessageBoxItem[this.lbMessageBox.Items.Count]; this.lbMessageBox.Items.CopyTo(stackPanels, 0); MessageBoxItem[] array = stackPanels; for (int i = 0; i < array.Length; i++) { MessageBoxItem mbi = array[i]; mbi.PickUpMessage(); } array = stackPanels; for (int i = 0; i < array.Length; i++) { MessageBoxItem mbi = array[i]; BaseTab baseTab = this.FindChatTab(mbi.MessageType, mbi.Id, mbi.Projectid); if (baseTab != null) { baseTab.SetFlashingStyle(); } } INWindow inWindow = this.dataService.INWindow as INWindow; BaseTab selectedTab = inWindow.ContentTab.SelectedItem as BaseTab; if (selectedTab != null) { selectedTab.SetDefaultStyle(); } this.ActiveInWindow(); } catch (System.Exception ex) { this.logger.Error(ex.ToString()); } }
private void StackPanel_MouseDown(object sender, MouseButtonEventArgs e) { try { MessageBoxItem stackPanel = sender as MessageBoxItem; if (stackPanel != null) { string typeID = stackPanel.DataContext as string; char[] reg = new char[] { ';' }; string[] s = typeID.Split(reg); if (s.Length == 2) { string type = s[0]; long id = long.Parse(s[1]); this.PickUpMessage(type, id); } } } catch (System.Exception ex) { this.logger.Error(ex.ToString()); } }
public IEnumerable <KeyValuePair <string, MessageBoxItem> > GetMessagesSorted(EmailClient.MessageType type, string filter) { if (messageWorker == null) { return(null); } SortedList <string, MessageBoxItem> list = new SortedList <string, MessageBoxItem>(); ConcurrentDictionary <string, MailMessage> store; switch (type) { case EmailClient.MessageType.Seen: store = messageWorker.SeenMessages; break; case EmailClient.MessageType.Unseen: store = messageWorker.UnseenMessages; break; case EmailClient.MessageType.Draft: store = messageWorker.DraftMessages; break; case EmailClient.MessageType.Sending: store = messageWorker.PendingMessages; break; default: return(null); } if (store != null) { foreach (var x in store) { if (x.Value != null && (x.Value.Subject.ToLower().Contains(filter.ToLower()) || x.Value.From.ToString().ToLower().Contains(filter.ToLower()))) { if (String.IsNullOrEmpty(x.Value.Subject)) { x.Value.Subject = "(No Subject)"; } var temp = new MessageBoxItem(x.Value.Subject, x.Key); temp.attachments = x.Value.Attachments; list.Add(temp.id, temp); } } } var res = list.Reverse(); return(res); }
private async void deleteButton_Click(object sender, EventArgs e) { if (messages.SelectedItem != null) { MessageBoxItem selected = messages.SelectedItem as MessageBoxItem; await Task.Run(() => EmailClient.Instance.DeleteMessage(selected.id, currentView)); CleanView(); UpdateCurrentView(); } }
private async void ComposeMessage(object sender, EventArgs e) { if (messages.SelectedItem != null && currentView == EmailClient.MessageType.Draft) { MessageBoxItem selected = messages.SelectedItem as MessageBoxItem; var data = await Task.Run(() => EmailClient.Instance.GetMessage(selected.id, currentView)); SendForm f = new SendForm(data.Body, data.Subject, data.Attachments); f.Show(); } }
private async void MessageClick(object sender, EventArgs e) { CleanView(); if (messages.SelectedItem != null) { MessageBoxItem selected = messages.SelectedItem as MessageBoxItem; messageLoading.Visible = true; deleteButton.Enabled = true; var view = currentView; var data = await Task.Run(() => EmailClient.Instance.GetMessage(selected.id, currentView)); messageLoading.Visible = false; if (data == null || view != currentView) { return; } browserView.DocumentText = data.Body; if (data.Headers["Date"] != null) { messageDate.Text = data?.Headers["Date"].Split('-')[0].Split('+')[0]; } int index = -1; attachmentsBox.Items.Clear(); foreach (var a in data.Attachments) { a.ContentId = a.ContentId; attachmentsBox.Items.Add(new AttachmentsBoxItem(++index, a.Name, selected.id)); } if (currentView == EmailClient.MessageType.Sending) { topLabel.Text = "To: " + data.To?.ToString(); } else { topLabel.Text = "From: " + data.From?.ToString(); } } }
private static void CurrentPagePreRender(object sender, EventArgs e) { Page currentPage = (Page)HttpContext.Current.Handler; Include(currentPage); Queue queue = ((Queue)(handlerPages[HttpContext.Current.Handler])); if (queue != null) { String script = ""; while (queue.Count > 0) { MessageBoxItem iMsg = (MessageBoxItem)queue.Dequeue(); script += "MessageBox.queue.push(function(){"; script += "Ext.Msg.show({ title: '', msg: '" + EncodeJsString(iMsg.Message) + "', width: 400, buttons: Ext.MessageBox.OK, icon: '" + iMsg.Type.ToString().ToLower() + "', fn: MessageBox.showNext })"; script += "});"; } script += "Ext.onReady(function(){ MessageBox.showNext(); });"; ScriptManager.RegisterStartupScript(currentPage, currentPage.GetType(), "messageScript", script, true); } }
/// <summary> /// retrieves the handle to a control in the specified dialog box. /// </summary> /// <param name="hWnd">Handle to the dialog box that contains the control.</param> /// <param name="dlgItem">Specifies the identifier of the control to be retrieved.</param> /// <returns>The window handle of the specified control indicates success. NULL indicates /// failure due to an invalid dialog box handle or a nonexistent control.</returns> public static WindowHandle GetDlgItem(WindowHandle hWnd, MessageBoxItem dlgItem) { return GetDlgItem(hWnd, (int)dlgItem); }
public void Refresh() { try { this.lbMessageBox.Items.Clear(); if (!this.dataModel.HasMessage()) { NotifyIconUtil.Instance.SetFlashIcon(FlashIconType.Default); base.Close(); } foreach (string key in this.dataModel.MessageBoxSort) { if (!string.IsNullOrEmpty(key)) { System.Collections.Generic.List <Message> list = this.dataModel.GetMessage(key); if (list != null && list.Count > 0) { Message message = list[0]; if (message != null) { if (message.MessageObjectType == MessageActorType.EntStaff) { Staff staff = this.dataService.GetStaff((long)((ulong)Jid.GetUid(message.FromJid))); if (staff != null) { MessageBoxItem mbi = new MessageBoxItem(MessageActorType.EntStaff, staff.Uid, staff.Name, list.Count.ToString(), staff.HeaderImage); this.lbMessageBox.Items.Add(mbi); } } if (message.MessageObjectType == MessageActorType.EntGroup) { EntGroup group = this.dataService.GetEntGroup(message.Gid); if (group != null) { MessageBoxItem mbi = new MessageBoxItem(MessageActorType.EntGroup, group.Gid, group.Name, list.Count.ToString(), this.imageService.GetIcon(ImageTypeIcon.Group)); this.lbMessageBox.Items.Add(mbi); } } if (message.MessageObjectType == MessageActorType.Roster) { Roster roster = this.dataService.GetRoster((long)((ulong)Jid.GetUid(message.FromJid))); if (roster != null) { MessageBoxItem mbi = new MessageBoxItem(MessageActorType.Roster, roster.Uid, roster.Name, list.Count.ToString(), roster.HeaderImage); this.lbMessageBox.Items.Add(mbi); } } if (message.MessageObjectType == MessageActorType.AddRoster) { RosterAddRequest request = message.MessageObject as RosterAddRequest; if (request != null && request.user != null) { MessageBoxItem mbi = new MessageBoxItem(MessageActorType.AddRoster, request.uid, "验证消息", list.Count.ToString(), null); this.lbMessageBox.Items.Add(mbi); } } if (message.MessageObjectType == MessageActorType.AddRosterAsk) { RosterAddResponse response = message.MessageObject as RosterAddResponse; if (response != null && response.user != null) { MessageBoxItem mbi = new MessageBoxItem(MessageActorType.AddRosterAsk, response.uid, "验证消息", list.Count.ToString(), null); this.lbMessageBox.Items.Add(mbi); } } if (message.MessageObjectType == MessageActorType.CooperationStaff) { CooperationStaff staff2 = this.dataService.GetCooperationStaff((long)((ulong)Jid.GetUid(message.FromJid)), message.ProjectId); if (staff2 != null) { MessageBoxItem mbi = new MessageBoxItem(MessageActorType.CooperationStaff, staff2.Uid, staff2.UnitedProjectid, staff2.Name, list.Count.ToString(), staff2.HeaderImage); this.lbMessageBox.Items.Add(mbi); } } } } } } base.Top = SystemParameters.WorkArea.Height - 47.0 - (double)(this.lbMessageBox.Items.Count * 30); } catch (System.Exception e) { this.logger.Error(e.ToString()); } }