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

📄 installerdialog.cs

📁 以前做NOKIA手机与PC通信时所参考的源代码,里面包括两个程序,一个是手机文件夹浏览源码,另一个手机SIS安装程序.
💻 CS
📖 第 1 页 / 共 4 页
字号:
            this.LabelSis.ForeColor = System.Drawing.SystemColors.ControlText;
            this.LabelSis.Location = new System.Drawing.Point(8, 148);
            this.LabelSis.Name = "LabelSis";
            this.LabelSis.RightToLeft = System.Windows.Forms.RightToLeft.No;
            this.LabelSis.Size = new System.Drawing.Size(81, 17);
            this.LabelSis.TabIndex = 14;
            this.LabelSis.Text = "SIS File:";
            this.LabelSis.TextAlign = System.Drawing.ContentAlignment.TopRight;
            // 
            // LabelJad
            // 
            this.LabelJad.BackColor = System.Drawing.SystemColors.Control;
            this.LabelJad.Cursor = System.Windows.Forms.Cursors.Default;
            this.LabelJad.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.LabelJad.ForeColor = System.Drawing.SystemColors.ControlText;
            this.LabelJad.Location = new System.Drawing.Point(8, 116);
            this.LabelJad.Name = "LabelJad";
            this.LabelJad.RightToLeft = System.Windows.Forms.RightToLeft.No;
            this.LabelJad.Size = new System.Drawing.Size(81, 17);
            this.LabelJad.TabIndex = 12;
            this.LabelJad.Text = "JAD File:";
            this.LabelJad.TextAlign = System.Drawing.ContentAlignment.TopRight;
            // 
            // LabelJar
            // 
            this.LabelJar.BackColor = System.Drawing.SystemColors.Control;
            this.LabelJar.Cursor = System.Windows.Forms.Cursors.Default;
            this.LabelJar.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.LabelJar.ForeColor = System.Drawing.SystemColors.ControlText;
            this.LabelJar.Location = new System.Drawing.Point(8, 84);
            this.LabelJar.Name = "LabelJar";
            this.LabelJar.RightToLeft = System.Windows.Forms.RightToLeft.No;
            this.LabelJar.Size = new System.Drawing.Size(81, 17);
            this.LabelJar.TabIndex = 10;
            this.LabelJar.Text = "JAR File:";
            this.LabelJar.TextAlign = System.Drawing.ContentAlignment.TopRight;
            // 
            // LabelType
            // 
            this.LabelType.BackColor = System.Drawing.SystemColors.Control;
            this.LabelType.Cursor = System.Windows.Forms.Cursors.Default;
            this.LabelType.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.LabelType.ForeColor = System.Drawing.SystemColors.ControlText;
            this.LabelType.Location = new System.Drawing.Point(1, 44);
            this.LabelType.Name = "LabelType";
            this.LabelType.RightToLeft = System.Windows.Forms.RightToLeft.No;
            this.LabelType.Size = new System.Drawing.Size(88, 17);
            this.LabelType.TabIndex = 3;
            this.LabelType.Text = "Installation type:";
            this.LabelType.TextAlign = System.Drawing.ContentAlignment.TopRight;
            // 
            // LabelPhone
            // 
            this.LabelPhone.BackColor = System.Drawing.SystemColors.Control;
            this.LabelPhone.Cursor = System.Windows.Forms.Cursors.Default;
            this.LabelPhone.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.LabelPhone.ForeColor = System.Drawing.SystemColors.ControlText;
            this.LabelPhone.Location = new System.Drawing.Point(48, 12);
            this.LabelPhone.Name = "LabelPhone";
            this.LabelPhone.RightToLeft = System.Windows.Forms.RightToLeft.No;
            this.LabelPhone.Size = new System.Drawing.Size(41, 17);
            this.LabelPhone.TabIndex = 1;
            this.LabelPhone.Text = "Phone:";
            this.LabelPhone.TextAlign = System.Drawing.ContentAlignment.TopRight;
            // 
            // ProgressBar1
            // 
            this.ProgressBar1.Location = new System.Drawing.Point(9, 245);
            this.ProgressBar1.Name = "ProgressBar1";
            this.ProgressBar1.Size = new System.Drawing.Size(488, 19);
            this.ProgressBar1.TabIndex = 16;
            this.ProgressBar1.Visible = false;
            // 
            // labelWait
            // 
            this.labelWait.Location = new System.Drawing.Point(11, 239);
            this.labelWait.Name = "labelWait";
            this.labelWait.Size = new System.Drawing.Size(486, 22);
            this.labelWait.TabIndex = 17;
            this.labelWait.Text = "Waiting for user actions on the device side";
            this.labelWait.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
            this.labelWait.Visible = false;
            // 
            // TextNth
            // 
            this.TextNth.AcceptsReturn = true;
            this.TextNth.BackColor = System.Drawing.SystemColors.Window;
            this.TextNth.Cursor = System.Windows.Forms.Cursors.IBeam;
            this.TextNth.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.TextNth.ForeColor = System.Drawing.SystemColors.WindowText;
            this.TextNth.Location = new System.Drawing.Point(96, 176);
            this.TextNth.MaxLength = 0;
            this.TextNth.Name = "TextNth";
            this.TextNth.RightToLeft = System.Windows.Forms.RightToLeft.No;
            this.TextNth.Size = new System.Drawing.Size(313, 20);
            this.TextNth.TabIndex = 19;
            // 
            // CommandNth
            // 
            this.CommandNth.BackColor = System.Drawing.SystemColors.Control;
            this.CommandNth.Cursor = System.Windows.Forms.Cursors.Default;
            this.CommandNth.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.CommandNth.ForeColor = System.Drawing.SystemColors.ControlText;
            this.CommandNth.Location = new System.Drawing.Point(424, 176);
            this.CommandNth.Name = "CommandNth";
            this.CommandNth.RightToLeft = System.Windows.Forms.RightToLeft.No;
            this.CommandNth.Size = new System.Drawing.Size(73, 25);
            this.CommandNth.TabIndex = 18;
            this.CommandNth.Text = "Browse...";
            this.CommandNth.UseVisualStyleBackColor = false;
            this.CommandNth.Click += new System.EventHandler(this.CommandNth_Click);
            // 
            // LabelNth
            // 
            this.LabelNth.BackColor = System.Drawing.SystemColors.Control;
            this.LabelNth.Cursor = System.Windows.Forms.Cursors.Default;
            this.LabelNth.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.LabelNth.ForeColor = System.Drawing.SystemColors.ControlText;
            this.LabelNth.Location = new System.Drawing.Point(8, 180);
            this.LabelNth.Name = "LabelNth";
            this.LabelNth.RightToLeft = System.Windows.Forms.RightToLeft.No;
            this.LabelNth.Size = new System.Drawing.Size(81, 17);
            this.LabelNth.TabIndex = 20;
            this.LabelNth.Text = "NTH File:";
            this.LabelNth.TextAlign = System.Drawing.ContentAlignment.TopRight;
            // 
            // TextNGage
            // 
            this.TextNGage.AcceptsReturn = true;
            this.TextNGage.BackColor = System.Drawing.SystemColors.Window;
            this.TextNGage.Cursor = System.Windows.Forms.Cursors.IBeam;
            this.TextNGage.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.TextNGage.ForeColor = System.Drawing.SystemColors.WindowText;
            this.TextNGage.Location = new System.Drawing.Point(96, 206);
            this.TextNGage.MaxLength = 0;
            this.TextNGage.Name = "TextNGage";
            this.TextNGage.RightToLeft = System.Windows.Forms.RightToLeft.No;
            this.TextNGage.Size = new System.Drawing.Size(313, 20);
            this.TextNGage.TabIndex = 26;
            // 
            // CommandNGage
            // 
            this.CommandNGage.BackColor = System.Drawing.SystemColors.Control;
            this.CommandNGage.Cursor = System.Windows.Forms.Cursors.Default;
            this.CommandNGage.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.CommandNGage.ForeColor = System.Drawing.SystemColors.ControlText;
            this.CommandNGage.Location = new System.Drawing.Point(424, 206);
            this.CommandNGage.Name = "CommandNGage";
            this.CommandNGage.RightToLeft = System.Windows.Forms.RightToLeft.No;
            this.CommandNGage.Size = new System.Drawing.Size(73, 25);
            this.CommandNGage.TabIndex = 25;
            this.CommandNGage.Text = "Browse...";
            this.CommandNGage.UseVisualStyleBackColor = false;
            this.CommandNGage.Click += new System.EventHandler(this.CommandNGage_Click);
            // 
            // NGageLabel
            // 
            this.NGageLabel.BackColor = System.Drawing.SystemColors.Control;
            this.NGageLabel.Cursor = System.Windows.Forms.Cursors.Default;
            this.NGageLabel.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.NGageLabel.ForeColor = System.Drawing.SystemColors.ControlText;
            this.NGageLabel.Location = new System.Drawing.Point(8, 210);
            this.NGageLabel.Name = "NGageLabel";
            this.NGageLabel.RightToLeft = System.Windows.Forms.RightToLeft.No;
            this.NGageLabel.Size = new System.Drawing.Size(81, 17);
            this.NGageLabel.TabIndex = 27;
            this.NGageLabel.Text = "N-Gage File:";
            this.NGageLabel.TextAlign = System.Drawing.ContentAlignment.TopRight;
            // 
            // Timer1
            // 
            this.Timer1.Tick += new System.EventHandler(this.Timer1_Tick);
            // 
            // InstallerDialog
            // 
            this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
            this.BackColor = System.Drawing.SystemColors.Control;
            this.CancelButton = this.CommandCancel;
            this.ClientSize = new System.Drawing.Size(506, 272);
            this.Controls.Add(this.TextNGage);
            this.Controls.Add(this.CommandNGage);
            this.Controls.Add(this.NGageLabel);
            this.Controls.Add(this.CommandList);
            this.Controls.Add(this.TextNth);
            this.Controls.Add(this.CommandNth);
            this.Controls.Add(this.LabelNth);
            this.Controls.Add(this.labelWait);
            this.Controls.Add(this.ProgressBar1);
            this.Controls.Add(this.TextSis);
            this.Controls.Add(this.TextJad);
            this.Controls.Add(this.TextJar);
            this.Controls.Add(this.CommandJad);
            this.Controls.Add(this.CommandSis);
            this.Controls.Add(this.CommandJar);
            this.Controls.Add(this.CommandCancel);
            this.Controls.Add(this.CommandInstall);
            this.Controls.Add(this.ComboType);
            this.Controls.Add(this.ComboPhone);
            this.Controls.Add(this.LabelSis);
            this.Controls.Add(this.LabelJad);
            this.Controls.Add(this.LabelJar);
            this.Controls.Add(this.LabelType);
            this.Controls.Add(this.LabelPhone);
            this.Cursor = System.Windows.Forms.Cursors.Default;
            this.Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
            this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
            this.Location = new System.Drawing.Point(4, 30);
            this.MaximizeBox = false;
            this.MinimizeBox = false;
            this.Name = "InstallerDialog";
            this.RightToLeft = System.Windows.Forms.RightToLeft.No;
            this.Text = "Application Installer";
            this.Load += new System.EventHandler(this.InstallerDialog_Load);
            this.ResumeLayout(false);
            this.PerformLayout();

        }
        #endregion

        // Definitions for installation types, NOTE order is significant
        const int INSTALL_TYPE_JAVA = 0;
        const int INSTALL_TYPE_NGAGE = 1;
        const int INSTALL_TYPE_SYMBIAN = 2;
        const int INSTALL_TYPE_THEMES = 3;

        const string strJavaItem = "Java";
        const string strSymbianItem = "Symbian";
        const string strThemesItem = "Themes";
        const string strNGageItem = "N-Gage";

        bool bPhoneSupportsSisX = false;
        public bool bRefreshPhonecombo = false;

        public bool bCancelled;
        int iInstallationType;
        string[] strSerialNumbers;
        CONADefinitions.DeviceNotifyCallbackDelegate pDeviceCallBack;
        CONADefinitions.FSNotifyCallbackDelegate pFSCallBack;

        [System.STAThread()]
        public static void Main()
        {
            // Starts the application.
            Application.Run(new InstallerDialog());
        }

        //===================================================================
        // RefreshPhoneList
        //
        // Refresh phone list to combo
        //
        //===================================================================
        public void RefreshPhoneList()
        {
            try
            {
                short i = 0;
                int iResult = 0;
                int iCount = 0;
                IntPtr buffer = IntPtr.Zero;
                string strCombo = "";
                CONADefinitions.CONAPI_DEVICE[] pDevices;
                MSComctlLib.ListItem itmX;
                Timer1.Enabled = false;

                this.ComboPhone.Items.Clear();
                iResult = CONADeviceManagement.CONAGetDeviceCount(Common.hDMHandle, ref iCount);
                if (iResult != PCCSErrors.CONA_OK) PCCAPIUtils.ShowErrorMessage("CONAGetDeviceCount", iResult);
                if (iResult == PCCSErrors.CONA_OK & iCount > 0)
                {
                    pDevices = null;
                    pDevices = new CONADefinitions.CONAPI_DEVICE[iCount];
                    strSerialNumbers = null;
                    strSerialNumbers = new string[iCount];

                    // Allocate memory for buffer
                    buffer = Marshal.AllocHGlobal(iCount * Marshal.SizeOf(typeof(CONADefinitions.CONAPI_DEVICE)));
                    // Get list of currently connected devices
                    iResult = CONADeviceManagement.CONAGetDevices(Common.hDMHandle, ref iCount, buffer);
                    if (iResult != PCCSErrors.CONA_OK)
                    {
                        PCCAPIUtils.ShowErrorMessage("CONAGetDevices", iResult);
                    }
                    else
                    {
                        // Add each device to the phone list box
                        for (i = 0; i < iCount; i++)
                        {
                            // Calculate beginning of CONAPI_DEVICE structure of item 'i'
                            int iPtr = buffer.ToInt32() + i * Marshal.SizeOf(typeof(CONADefinitions.CONAPI_DEVICE));
                            // Convert integer to pointer
                            IntPtr ptr = new IntPtr(iPtr);
                            // Copy data from buffer

⌨️ 快捷键说明

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