Example #1
0
        public void connect()
        {
            string cmbCOM = "COM" + comms.Text;

            comm = new GsmCommMain(cmbCOM, 9600, 150);

            try
            {
                if (comm.IsConnected())
                {
                    info.Content    = comm.IdentifyDevice().Manufacturer.ToUpper().ToString();
                    info.Content    = info.Content + Environment.NewLine + comm.IdentifyDevice().Manufacturer.ToUpper().ToString();
                    info.Content    = info.Content + Environment.NewLine + comm.IdentifyDevice().Model.ToUpper().ToString();
                    info.Content    = info.Content + Environment.NewLine + comm.IdentifyDevice().Revision.ToUpper().ToString();
                    info.Content    = info.Content + Environment.NewLine + comm.IdentifyDevice().SerialNumber.ToUpper().ToString();
                    info.Content    = info.Content + Environment.NewLine + comm.GetCurrentOperator();
                    info.Content    = info.Content + Environment.NewLine + comm.GetSignalQuality();
                    info.Content    = info.Content + Environment.NewLine + comm.GetSmscAddress();
                    info.Content    = info.Content + Environment.NewLine + comm.GetSubscriberNumbers();
                    save.Visibility = Visibility.Visible;


                    Console.WriteLine("comm is already open");
                }
                else
                {
                    Console.WriteLine("comm is not open");
                    comm.Open();

                    info.Content    = comm.IdentifyDevice().Manufacturer.ToUpper().ToString();
                    info.Content    = info.Content + Environment.NewLine + comm.IdentifyDevice().Manufacturer.ToUpper().ToString();
                    info.Content    = info.Content + Environment.NewLine + comm.IdentifyDevice().Model.ToUpper().ToString();
                    info.Content    = info.Content + Environment.NewLine + comm.IdentifyDevice().Revision.ToUpper().ToString();
                    info.Content    = info.Content + Environment.NewLine + comm.IdentifyDevice().SerialNumber.ToUpper().ToString();
                    save.Visibility = Visibility.Visible;
                }
            }
            catch (Exception r)
            {
                MessageBox.Show(r.Message);
            }
        }