⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 listdialog.cs

📁 以前做NOKIA手机与PC通信时所参考的源代码,里面包括两个程序,一个是手机文件夹浏览源码,另一个手机SIS安装程序.
💻 CS
字号:
//Filename    : ListDialog.cs
//Part of     : Application installer C# example
//Description : Main dialog of CSInstaller.NET example application
//Version     : 3.2
//
//This example is only to be used with PC Connectivity API version 3.2.
//Compability ("as is") with future versions is not quaranteed.
//
//Copyright (c) 2007 Nokia Corporation.
//
//This material, including but not limited to documentation and any related
//computer programs, is protected by intellectual property rights of Nokia
//Corporation and/or its licensors.
//All rights are reserved. Reproducing, modifying, translating, or
//distributing any or all of this material requires the prior written consent
//of Nokia Corporation. Nokia Corporation retains the right to make changes
//to this material at any time without notice. A copyright license is hereby
//granted to download and print a copy of this material for personal use only.
//No other license to any other intellectual property rights is granted. The
//material is provided "as is" without warranty of any kind, either express or
//implied, including without limitation, any warranty of non-infringement,
//merchantability and fitness for a particular purpose. In no event shall
//Nokia Corporation be liable for any direct, indirect, special, incidental,
//or consequential loss or damages, including but not limited to, lost profits
//or revenue,loss of use, cost of substitute program, or loss of data or
//equipment arising out of the use or inability to use the material, even if
//Nokia Corporation has been advised of the likelihood of such damages occurring.

using System.Runtime.InteropServices;
using System.Windows.Forms;
namespace CSInstaller
{
    using CONADefinitions;
    using PCCSErrors;
    using CONAFileSystem;
    using PCCAPIUtils;

    public partial class ListDialog
    {
        public string strSerialNumber = "";
        public string[] strAppUID = new string[5];

        public ListDialog()
        {
            InitializeComponent();
        }

        private void OK_Button_Click(object sender, System.EventArgs e)
        {
            this.DialogResult = System.Windows.Forms.DialogResult.OK;
            this.Close();
        }

        private void CommandUninstall_Click(object sender, System.EventArgs e)
        {
            int iSelIndex = 0;
            string strSAppName = "";
            string strSAppUID = "";
            int iResult = 0;
            CONADefinitions.FSNotifyCallbackDelegate pFSCallBack = null;
            iSelIndex = ApplicationList.SelectedIndex;
            if (iSelIndex >= 0)
            {
                int iDeviceID = 0;
                int iMedia = 0;
                iMedia = CONADefinitions.API_MEDIA_ALL;
                // Create FS connection
                iResult = CONAFileSystem.CONAOpenFS(strSerialNumber, ref iMedia, ref Common.hFSHandle, ref iDeviceID);
                if (iResult != PCCSErrors.CONA_OK)
                {
                    PCCAPIUtils.ShowErrorMessage("CONAOpenFS", iResult);
                }
                else
                {
                    CommandUninstall.Enabled = false;
                    OK_Button.Enabled = false;
                    // Register file system notification callback function
                    pFSCallBack = Common.FSNotifyCallback;
                    iResult = CONAFileSystem.CONARegisterFSNotifyCallback(Common.hFSHandle, CONADefinitions.API_REGISTER, pFSCallBack);
                    if (iResult != PCCSErrors.CONA_OK)
                    {
                        PCCAPIUtils.ShowErrorMessage("CONARegisterFSNotifyCallback", iResult);
                    }
                    // Use main window progress bar
                    Common.MainForm.labelWait.Visible = false;
                    Common.MainForm.ProgressBar1.Visible = true;
                    Cursor = Cursors.WaitCursor;
                    // Uninstall selected item
                    strSAppName = ApplicationList.Items[iSelIndex].ToString();
                    strSAppUID = strAppUID[iSelIndex];
                    iResult = Common.UnInstallApplication(strSAppName, strSAppUID);
                    if (iResult == PCCSErrors.CONA_OK)
                    {
                        ApplicationList.Items.RemoveAt(iSelIndex);
                    }
                    OK_Button.Enabled = true;
                    CommandUninstall.Enabled = true;
                    // Clean up
                    Cursor = Cursors.Default;
                    Common.MainForm.labelWait.Visible = false;
                    Common.MainForm.ProgressBar1.Value = 0;
                    Common.MainForm.ProgressBar1.Visible = false;
                    // Unregister file system notification callback function
                    iResult = CONAFileSystem.CONARegisterFSNotifyCallback(Common.hFSHandle, CONADefinitions.API_UNREGISTER, pFSCallBack);
                    if (iResult != PCCSErrors.CONA_OK)
                    {
                        PCCAPIUtils.ShowErrorMessage("CONARegisterFSNotifyCallback", iResult);
                    }
                    // Close file system 
                    iResult = CONAFileSystem.CONACloseFS(Common.hFSHandle);
                    if (iResult != PCCSErrors.CONA_OK)
                    {
                        PCCAPIUtils.ShowErrorMessage("CONACloseFS", iResult);
                    }
                }
            }
        }

        private void ListDialog_Shown(object sender, System.EventArgs e)
        {
            if (Common.bAppUninstallSupported)
            {
                CommandUninstall.Enabled = true;
            }
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -