contactchooserdialog.cs

来自「通过手机短消息来协调会议等」· CS 代码 · 共 67 行

CS
67
字号
//
// 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 + =
减小字号Ctrl + -
显示快捷键?