📄 contactchooserdialog.cs
字号:
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// Use of this source code is subject to the terms of the Microsoft end-user
// license agreement (EULA) under which you licensed this SOFTWARE PRODUCT.
// If you did not accept the terms of the EULA, you are not authorized to use
// this source code. For a copy of the EULA, please see the LICENSE.RTF on your
// install media.
//
using System;
using System.Drawing;
using System.Collections;
using System.Windows.Forms;
using System.Data;
using Microsoft.WindowsMobile.PocketOutlook;
using Microsoft.WindowsMobile.Samples.ControlLibrary;
namespace AppointmentOverSms
{
/// <summary>
/// ContactChooserDialog lets the user select a contact.
/// </summary>
public partial class ContactChooserDialog : System.Windows.Forms.Form
{
private System.Windows.Forms.MainMenu mainMenu1;
#region Private Variables
private AppointmentDetails parent;
#endregion
/// <summary>
/// Set the parent for sending the contact picked
/// </summary>
/// <param name="parent"> The form that called this constructor</param>
public ContactChooserDialog(AppointmentDetails parent)
{
InitializeComponent();
this.parent = parent;
// Initialize PimItemListView.
this.contactListView.PimItemProperty1 = ContactProperty.FileAs;
this.contactListView.PimItemProperty2 = ContactProperty.MobileTelephoneNumber;
this.contactListView.ShowPicture = true;
contactListView.PimItemSelected += new PimItemListView.ClickEventHandler(Clicked);
OutlookSession mySession = new OutlookSession();
// Only display the contacts that have a mobile telephone number.
contactListView.Contacts = mySession.Contacts.Items.Restrict("[MobileTelephoneNumber] <> \"\"");
}
/// <summary>
/// Sends the contact selected by the user to the parent.
/// </summary>
/// <param name="sender">Sender</param>
/// <param name="pimItemEventArgs">The event arguments that contain the contact selected</param>
private void Clicked(object sender, PimItemListView.PimItemListViewEventArgs pimItemEventArgs)
{
parent.ContactPhone = ((Contact)pimItemEventArgs.PimItem).MobileTelephoneNumber;
contactListView.Dispose();
this.Close();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -