Ejemplo n.º 1
0
        /// <summary>
        /// OnPower
        /// </summary>
        /// <returns></returns>
        public static bool Open()
        {
            if (GprsControl.IsActived())
            {
                GprsControl.Deactive();
                Thread.Sleep(200);
            }

            IsOnPower = GprsControl.Active() > 0;
            Thread.Sleep(5000);
            return(IsOnPower);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Switch Gprs
        /// </summary>
        private void SwitchGprs()
        {
            bool isInvoke = false;

            if (GprsControl.IsActived())
            {
                if (DialogResult.Yes == MessageBox.Show("Are you sure to close the gprs?", "GPRS", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2))
                {
                    if (GprsControl.Deactive())
                    {
                        btGPRS.Text = "Open GPRS";
                    }
                }
                else
                {
                    isInvoke = true;
                }
            }
            else
            {
                int ret = GprsControl.Active();
                {
                    isInvoke = true;
                }
            }

            if (isInvoke)
            {
                btGPRS.Text = "Close GPRS";
                string procname = @"\Windows\rnaapp.exe";
                if (!File.Exists(procname))
                {
                    return;
                }
                Process.Start(procname, "-e\"GPRSDial\"");      //"-p-e\"GPRSDial\""
            }
        }