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

📄 frm_deviceinfo.cs

📁 以前做NOKIA手机与PC通信时所参考的源代码,里面包括两个程序,一个是手机文件夹浏览源码,另一个手机SIS安装程序.
💻 CS
📖 第 1 页 / 共 2 页
字号:
            // 
            this.labelS80.Enabled = false;
            this.labelS80.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
            this.labelS80.Location = new System.Drawing.Point(16, 92);
            this.labelS80.Name = "labelS80";
            this.labelS80.Size = new System.Drawing.Size(312, 16);
            this.labelS80.TabIndex = 4;
            this.labelS80.Text = "Series 80";
            // 
            // labelS603ed
            // 
            this.labelS603ed.Enabled = false;
            this.labelS603ed.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
            this.labelS603ed.Location = new System.Drawing.Point(16, 73);
            this.labelS603ed.Name = "labelS603ed";
            this.labelS603ed.Size = new System.Drawing.Size(312, 16);
            this.labelS603ed.TabIndex = 3;
            this.labelS603ed.Text = "Series 60 3rd edition";
            // 
            // labelS602ed
            // 
            this.labelS602ed.Enabled = false;
            this.labelS602ed.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
            this.labelS602ed.Location = new System.Drawing.Point(16, 54);
            this.labelS602ed.Name = "labelS602ed";
            this.labelS602ed.Size = new System.Drawing.Size(312, 16);
            this.labelS602ed.TabIndex = 2;
            this.labelS602ed.Text = "Series 60 2nd edition";
            // 
            // labelS40
            // 
            this.labelS40.Enabled = false;
            this.labelS40.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
            this.labelS40.Location = new System.Drawing.Point(16, 35);
            this.labelS40.Name = "labelS40";
            this.labelS40.Size = new System.Drawing.Size(312, 16);
            this.labelS40.TabIndex = 1;
            this.labelS40.Text = "Series 40";
            // 
            // labelUnknown
            // 
            this.labelUnknown.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
            this.labelUnknown.Location = new System.Drawing.Point(16, 16);
            this.labelUnknown.Name = "labelUnknown";
            this.labelUnknown.Size = new System.Drawing.Size(312, 16);
            this.labelUnknown.TabIndex = 0;
            this.labelUnknown.Text = "Unknown device";
            // 
            // groupBoxFS
            // 
            this.groupBoxFS.Controls.Add(this.labelConversion);
            this.groupBoxFS.Controls.Add(this.labelSIS);
            this.groupBoxFS.Controls.Add(this.labelJava);
            this.groupBoxFS.Controls.Add(this.labelFSSupport);
            this.groupBoxFS.Location = new System.Drawing.Point(8, 129);
            this.groupBoxFS.Name = "groupBoxFS";
            this.groupBoxFS.Size = new System.Drawing.Size(336, 117);
            this.groupBoxFS.TabIndex = 11;
            this.groupBoxFS.TabStop = false;
            this.groupBoxFS.Text = "File System Support";
            this.groupBoxFS.Enter += new System.EventHandler(this.groupBoxFS_Enter);
            // 
            // labelConversion
            // 
            this.labelConversion.Enabled = false;
            this.labelConversion.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
            this.labelConversion.Location = new System.Drawing.Point(16, 73);
            this.labelConversion.Name = "labelConversion";
            this.labelConversion.Size = new System.Drawing.Size(312, 16);
            this.labelConversion.TabIndex = 4;
            this.labelConversion.Text = "Device supports file conversion";
            // 
            // labelSIS
            // 
            this.labelSIS.Enabled = false;
            this.labelSIS.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
            this.labelSIS.Location = new System.Drawing.Point(16, 54);
            this.labelSIS.Name = "labelSIS";
            this.labelSIS.Size = new System.Drawing.Size(312, 16);
            this.labelSIS.TabIndex = 3;
            this.labelSIS.Text = "Device supports SIS applications\' installation";
            // 
            // labelJava
            // 
            this.labelJava.Enabled = false;
            this.labelJava.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
            this.labelJava.Location = new System.Drawing.Point(16, 35);
            this.labelJava.Name = "labelJava";
            this.labelJava.Size = new System.Drawing.Size(312, 16);
            this.labelJava.TabIndex = 2;
            this.labelJava.Text = "Device supports Java MIDlet installation";
            // 
            // labelFSSupport
            // 
            this.labelFSSupport.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
            this.labelFSSupport.Location = new System.Drawing.Point(16, 16);
            this.labelFSSupport.Name = "labelFSSupport";
            this.labelFSSupport.Size = new System.Drawing.Size(312, 16);
            this.labelFSSupport.TabIndex = 0;
            // 
            // FRM_DeviceInfo
            // 
            this.AcceptButton = this.buttonClose;
            this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
            this.CancelButton = this.buttonClose;
            this.ClientSize = new System.Drawing.Size(696, 281);
            this.Controls.Add(this.groupBoxSync);
            this.Controls.Add(this.buttonClose);
            this.Controls.Add(this.groupBoxGen);
            this.Controls.Add(this.groupBoxType);
            this.Controls.Add(this.groupBoxFS);
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
            this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
            this.MaximizeBox = false;
            this.MinimizeBox = false;
            this.Name = "FRM_DeviceInfo";
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
            this.Text = "Device Info";
            this.Load += new System.EventHandler(this.FRM_DeviceInfo_Load);
            this.groupBoxSync.ResumeLayout(false);
            this.groupBoxGen.ResumeLayout(false);
            this.groupBoxType.ResumeLayout(false);
            this.groupBoxFS.ResumeLayout(false);
            this.ResumeLayout(false);

        }

        #endregion

        //===================================================================
        // FRM_DeviceInfo_Load:
        // Gets the device specific information from PCSAPI and
        // sets the information on the dialog.
        //===================================================================
        private void FRM_DeviceInfo_Load(object sender, System.EventArgs e)
        {
            int iRet = 0;
            System.IntPtr pStructure = System.IntPtr.Zero;
            // Create a general device info struct
            CONADefinitions.CONAPI_DEVICE_GEN_INFO info = new CONADefinitions.CONAPI_DEVICE_GEN_INFO();

            m_hDMHandle = Common.MainForm.LBX_PhoneFiles.GetDMHandle();
            m_strSerial = Common.MainForm.LBX_PhoneFiles.GetCurrentSN();
            if (m_hDMHandle != 0)
            {
                // Get general device info
                iRet = CONADeviceManagement.CONAGetDeviceInfo(m_hDMHandle, m_strSerial, CONADefinitions.CONAPI_DEVICE_GENERAL_INFO, ref pStructure);
                if (iRet == PCCSErrors.CONA_OK)
                {
                    // Cast the pointer to CONAPI_DEVICE_GEN_INFO struct
                    info = (CONADefinitions.CONAPI_DEVICE_GEN_INFO)Marshal.PtrToStructure(pStructure, typeof(CONADefinitions.CONAPI_DEVICE_GEN_INFO));

                    // File system support
                    if (info.iFileSystemSupport == CONADefinitions.CONAPI_FS_NOT_SUPPORTED)
                    {
                        SetLabelText(labelFSSupport, "Device does not support file system");
                    }
                    else if ((info.iFileSystemSupport & CONADefinitions.CONAPI_FS_SUPPORTED) != 0)
                    {
                        SetLabelText(labelFSSupport, "Device supports file system");
                    }
                    SetLabelEnabled(labelJava, (info.iFileSystemSupport & CONADefinitions.CONAPI_FS_INSTALL_JAVA_APPLICATIONS) != 0);
                    SetLabelEnabled(labelSIS, (info.iFileSystemSupport & CONADefinitions.CONAPI_FS_INSTALL_SIS_APPLICATIONS) != 0);
                    SetLabelEnabled(labelConversion, (info.iFileSystemSupport & CONADefinitions.CONAPI_FS_FILE_CONVERSION) != 0);

                    // Syncronization support
                    if ((info.iSyncSupport == CONADefinitions.CONAPI_SYNC_NOT_SUPPORTED))
                    {
                        SetLabelText(labelSyncSupport, "Device does not support syncronization");
                    }
                    else
                    {
                        SetLabelText(labelSyncSupport, "Device supports syncronization");
                    }
                    SetLabelEnabled(labelSADS, (info.iSyncSupport & CONADefinitions.CONAPI_SYNC_SA_DS) != 0);
                    SetLabelEnabled(labelSADM, (info.iSyncSupport & CONADefinitions.CONAPI_SYNC_SA_DM) != 0);
                    SetLabelEnabled(labelCIDS, (info.iSyncSupport & CONADefinitions.CONAPI_SYNC_CI_DS) != 0);

                    // Device type
                    SetLabelEnabled(labelS40, info.iType == CONADefinitions.CONAPI_SERIES40_DEVICE);
                    SetLabelEnabled(labelS602ed, info.iType == CONADefinitions.CONAPI_SERIES60_2ED_DEVICE);
                    SetLabelEnabled(labelS603ed, info.iType == CONADefinitions.CONAPI_SERIES60_3ED_DEVICE);
                    SetLabelEnabled(labelS80, info.iType == CONADefinitions.CONAPI_SERIES80_DEVICE);
                    // Old type, not shown
                    //SetLabelEnabled(labelNokia7710, info.iType == CONADefinitions.CONAPI_NOKIA7710_DEVICE);
                    SetLabelEnabled(labelUnknown, info.iType == CONADefinitions.CONAPI_UNKNOWN_DEVICE);

                    // General info (device type name, software version, used language)
                    SetLabelText(labelName, info.pstrTypeName);
                    SetLabelText(labelVersion, info.pstrSWVersion);
                    SetLabelText(labelLang, info.pstrUsedLanguage);

                    // Release allocated resources
                    iRet = CONADeviceManagement.CONAFreeDeviceInfoStructure(CONADefinitions.CONAPI_DEVICE_GENERAL_INFO, pStructure);
                    if (iRet != PCCSErrors.CONA_OK)
                    {
                        PCCAPIUtils.ShowErrorMessage("CONAFreeDeviceInfoStructure failed!", iRet);
                    }
                }
                else
                {
                    PCCAPIUtils.ShowErrorMessage("CONAGetDeviceInfo failed:", iRet);
                }
            }
        }

        //===================================================================
        // SetLabelEnabled:
        // Sets a label enabled/disabled.
        //===================================================================
        private void SetLabelEnabled(Label lbl, bool val)
        {
            lbl.Enabled = val;
        }

        //===================================================================
        // SetLabelText:
        // Appends text to a label whether not null. Also enables/disables label.
        //===================================================================
        private void SetLabelText(Label lbl, string txt)
        {
            SetLabelEnabled(lbl, txt != null);
            if (txt != null)
            {
                lbl.Text += txt;
            }
        }

        //===================================================================
        // buttonClose_Click:
        // Close button has been pressed. Closes the dialog.
        //===================================================================
        private void buttonClose_Click(object sender, System.EventArgs e)
        {
            this.Close();
        }

        private void groupBoxFS_Enter(object sender, System.EventArgs e)
        {

        }
    }
}

⌨️ 快捷键说明

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