示例#1
0
        /// <summary>
        /// 查询短信余额
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void tsmiSmsBalance_Click(object sender, EventArgs e)
        {
            int res = SMSHelper.Instance.GetSMSBalance();

            if (res < 0)
            {
                if (res == -1)
                {
                    UserMessageBox.MessageError("错误,账户为空");
                }

                if (res == -2)
                {
                    UserMessageBox.MessageError("错误,密码为空");
                }

                if (res == -3)
                {
                    UserMessageBox.MessageError("错误,企业ID为空");
                }
                else
                {
                    UserMessageBox.MessageError("错误,查询失败!\r\n返回码未知:" + res);
                }
            }
            else
            {
                UserMessageBox.MessageInfo(string.Format("短信剩余{0}条", res));
            }
        }
示例#2
0
        public static void Main(string[] args)
        {
            try
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);

                Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
                Application.ThreadException += Application_ThreadException;

                DevExpress.Skins.SkinManager.EnableFormSkins();
                TmoSkin.TSCommon.SetSkin("Office 2013");

                bool createNew;//只允许一个实例运行
                using (Mutex mutex = new Mutex(true, Application.ProductName, out createNew))
                {
                    if (createNew)
                    {
                        if (args.Length == 0)
                        {
                            string upresult = ReflectHelper.InvokeStaticMethod("Update.exe", "Common", "CheckUpdate", null).ToString();
                            if (upresult.StartsWith("err_"))
                            {
                                UserMessageBox.MessageError("检查更新失败!\n" + upresult);
                            }
                            else
                            {
                                if (upresult.ToLower() != "noupdate")
                                {
                                    ProcessStartInfo ps = new ProcessStartInfo();
                                    ps.UseShellExecute = false;
                                    ps.FileName        = "Update.exe";
                                    ps.Arguments       = upresult;
                                    Process.Start(ps);
                                    return;
                                }
                            }
                        }
                        Application.Run(new FormMain());
                    }
                    else
                    {
                        MessageBox.Show("别着急,移动设备数据同步工具已经打开 … ", "^_^", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        Thread.Sleep(1000);
                        Environment.Exit(1);
                    }
                }
            }
            catch (Exception ex)
            {
                UserMessageBox.MessageError("启动程序出错\n" + ex.Message);
            }
        }
示例#3
0
        void btnClearCache_Click(object sender, EventArgs e)
        {
            //MemoryCacheHelper.GetCacheItem<string>("test", () => "testdata", DateTime.Now.AddHours(1));
            bool suc = MemoryCacheHelper.ClearCache();

            if (suc)
            {
                UserMessageBox.MessageInfo("缓存清理成功");
            }
            else
            {
                UserMessageBox.MessageError("缓存清理失败");
            }
        }
示例#4
0
        /// <summary>
        /// 发送消息 到指定的客户端
        /// </summary>
        private void btnSend_Click(object sender, EventArgs e)
        {
            TCPServerClient client = lbClientList.SelectedItem as TCPServerClient;

            if (client != null)
            {
                string        data  = txtCmdTxt.Text.Trim();
                List <string> datas = StringPlus.GetStrArray(data, ";");
                if (datas.Count < 2)
                {
                    if (string.IsNullOrWhiteSpace(datas[0]))
                    {
                        UserMessageBox.MessageError("发送内容不能为空!");
                        return;
                    }

                    bool suc = client.SendString(datas[0]);
                    if (!suc)
                    {
                        UserMessageBox.MessageError("发送失败");
                    }
                }
                else
                {
                    if (!TmoShare.IsNumricForInt(datas[0]))
                    {
                        UserMessageBox.MessageError("命令ID必须为整数");
                        return;
                    }

                    bool suc = client.SendCommand(int.Parse(datas[0]), datas[1]);
                    if (!suc)
                    {
                        UserMessageBox.MessageError("发送失败");
                    }
                }
            }
            else
            {
                UserMessageBox.MessageInfo("请选择要发送的客户端");
            }
        }