Exemple #1
0
        } // GroupTalk_Load

        /// <summary>
        /// 从MsgList中找到有效的数据并且填入窗口
        /// </summary>
        /// <param name="cancellationToken">a symbol of whether canceling task</param>
        private void pollMsg(CancellationToken cancellationToken)
        {
            while (!cancellationToken.IsCancellationRequested)
            {
                MsgList msgList = MsgList.GetInstance();

                // 已提取到的消息的下标
                ArrayList indexList = new ArrayList();
                int       i         = 0;

                if (msgList.recvMsgList.Count != 0)
                {
                    foreach (RecvdMsg msg in msgList.recvMsgList)
                    {
                        if (msg.type == "group" && msg.destName == "all")
                        {
                            string finalStr = msg.userName + "发来:" + msg.content;
                            lstBox_recMsg.Invoke(appendString, lstBox_recMsg, finalStr);
                            indexList.Add(i); // 下标索引
                        } // if

                        i++;
                    } // foreach
                }     // if

                // 删掉已经读取的消息
                foreach (int index in indexList)
                {
                    RecvdMsg msg = msgList.recvMsgList[index];
                    msgList.recvMsgList.Remove(msg);
                } // foreach
            }     // while
        }         // pollMsg
Exemple #2
0
        /// <summary>
        /// 消息命令输入
        /// </summary>
        /// <param name="no"></param>
        private void SetMsgCommand(string no)
        {
            // 确定
            if (no == "OK")
            {
            }
            // 是
            else if (no == "Yes")
            {
            }
            // 否
            else if (no == "No")
            {
            }

            PopupRoutedEventArgs popupArgs = MsgList.Dequeue();

            if (null != popupArgs.Operate)
            {
                popupArgs.Operate(no);
            }



            Msgs.AlertMsgMode = false;
            InitialMsg();
        }
Exemple #3
0
 protected void RemoveUser(SecurityTCP.Client client)
 {
     UserList[client].Client = null;
     MsgList.Remove(client);
     BigMsgList.Remove(client);
     UserList.Remove(client);
 }
Exemple #4
0
        /// <summary>
        /// 回调函数:接受消息
        /// </summary>
        /// <param name="ar">the ar</param>
        public static void recCallBack(IAsyncResult ar)
        {
            try
            {
                // 接受消息的缓冲槽
                byte[] recvBuffer = (byte[])ar.AsyncState;

                // 当前用户的实例
                User currentUser = User.GetInstance();

                // 接受到的每一条消息
                RecvdMsg recvMsg = new RecvdMsg();

                // 消息列表实例
                MsgList msgList = MsgList.GetInstance();

                try
                {
                    int    i        = currentUser.socket.EndReceive(ar);
                    string str_data = Encoding.UTF8.GetString(recvBuffer, 0, i);

                    // 解析数据
                    C2CAnayMsg c2cAnayMsg = new C2CAnayMsg(str_data);

                    // 初始化收到信息类
                    recvMsg.type     = c2cAnayMsg.type;
                    recvMsg.userName = c2cAnayMsg.srcUser;
                    recvMsg.srcIP    = c2cAnayMsg.srcIP;
                    recvMsg.destName = c2cAnayMsg.destName;
                    recvMsg.content  = c2cAnayMsg.content;

                    if (recvMsg.type != null)
                    {
                        msgList.recvMsgList.Add(recvMsg);
                    } // if

                    recvBuffer = new byte[currentUser.socket.SendBufferSize];

                    //循环接收
                    AsyncCallback callBack = new AsyncCallback(recCallBack);

                    //异步调用
                    currentUser.socket.BeginReceive(recvBuffer, 0, recvBuffer.Length, SocketFlags.None, callBack, recvBuffer);//开始从连接的Socket中接收数据
                } // try

                catch (System.Exception ex)
                {
                    if (currentUser.socket != null)
                    {
                        SocketHandler.ShutDownConn(currentUser.socket);
                    } // if
                }     /// catch
            }         // try

            catch (System.Exception ex)
            {
                // 封装客户端停止连接时的异常
            } // catch
        }     // recCallBack
Exemple #5
0
 public string getMessage(MsgList msg)
 {
     if (xml.GetNode("Messages") == null)
         return msg.ToString() + " ";
     if (xml.GetNode("Messages." + msg.ToString()) != null)
         return xml["Messages." + msg.ToString()];
     else
         return msg.ToString();
 }
Exemple #6
0
 private void SendMsg(string msg)
 {
     TuLingClient.SendMsg(msg, (result) =>
     {
         MsgList.Add(CreateMsg("我:", msg));
         MsgList.Add(CreateMsg("图灵机器人:", result.SelectToken("text") + ""));
         Console.WriteLine(result.SelectToken("code"));
     });
 }
Exemple #7
0
 public void ConsoleClear()
 {
     if (_conTxt != null)
     {
         _conTxt.text = "";
         InputList.Clear();
         MsgList.Clear();
     }
 }
 public Chat(string id, string name, string receId, string content, MsgList ml, int wait)
 {
     this.SenderId   = id;
     this.sName      = name;
     this.ReceiverId = receId;
     this.Content    = content;
     this.Msgs       = ml;
     this.WaitReads  = wait;
 }
Exemple #9
0
 void ContentListViewScrollToEnd()
 {
     if (viewModel.Items.Count > 0)
     {
         Device.BeginInvokeOnMainThread(() => {
             MsgList.ScrollTo(viewModel.Items[viewModel.Items.Count - 1], ScrollToPosition.End, false);
         });
     }
 }
Exemple #10
0
        //有新打印数据,加入到datagrid中等待
        public void AddUpdatePrintingMethod(MsgList msgJson, WebSocketSession sock)
        {
            /*
             *  DataGridViewRow dgvr = new DataGridViewRow();
             *  dgvr.CreateCells(waiting_dataGridView);
             *  dgvr.Cells[0].Value = msg;
             *  dgvr.Cells[1].Value = DateTime.Now.ToLocalTime().ToString();
             *  dgvr.Cells[2].Value = "排队等待";
             *
             *  //插入到第一行
             *  // this.waiting_dataGridView.Rows.Insert(0, dgvr);
             *  //附加到最后
             *  this.waiting_dataGridView.Rows.Add(dgvr);
             */

            //waiting_dataGridView.DataSource = dt;

            if (msgJson != null && sock != null)
            {
                foreach (var item in msgJson.msgs)
                {
                    Console.WriteLine("添加数据到DT中的服务线程..." + Thread.CurrentThread.GetHashCode());
                    DataRow dr = dt.NewRow();
                    dr["编码"]   = item.PrintCode;
                    dr["入队时间"] = DateTime.Now.ToLocalTime().ToString();
                    dr["状态"]   = "排队等待";
                    dt.Rows.Add(dr);
                    sock.Send(item.PrintCode + "已加入到打印队列");
                }
            }
            //如果printing_text_label上内容为空,把第一行rows[0]放到里面打码
            string markNum = dt.Rows.Count > 0 ? dt.Rows[0]["编码"] as string : "";

            if (printing_text_label.Text == null || printing_text_label.Text.Trim().Length == 0 || printing_text_label.Text != markNum)
            {
                if (dt.Rows.Count > 0)
                {
                    dt.Rows[0]["状态"] = "正在标刻";
                }
                this.printing_text_label.BeginInvoke(UpdatePrintingTextLabelDelegate, markNum);//label上显示正在打码的数据
            }

            if (dt.Rows.Count > 3)
            {
                waiting_dataGridView.ScrollBars = ScrollBars.Vertical;
            }
            else
            {
                waiting_dataGridView.ScrollBars = ScrollBars.None;
            }
            waiting_dataGridView.Refresh();
            waiting_dataGridView.Update();


            //Console.WriteLine(Thread.CurrentThread.GetHashCode() + "---" + "刷新到UI grid中");
        }
        protected void rptAdminUserList_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            int result = 0;

            int.TryParse(e.CommandArgument.ToString(), out result);
            MsgList myList = new MsgList();
            TextBox box    = e.Item.FindControl("txtUserOpenId") as TextBox;

            myList.UserOpenId = box.Text.Trim();
            TextBox box2 = e.Item.FindControl("txtRoleName") as TextBox;

            myList.RoleName = box2.Text.Trim();
            TextBox box3 = e.Item.FindControl("txtRealName") as TextBox;

            myList.RealName = box3.Text.Trim();
            myList.Msg1     = Convert.ToInt32((e.Item.FindControl("cbMsg1") as CheckBox).Checked);
            myList.Msg2     = Convert.ToInt32((e.Item.FindControl("cbMsg2") as CheckBox).Checked);
            myList.Msg3     = Convert.ToInt32((e.Item.FindControl("cbMsg3") as CheckBox).Checked);
            myList.Msg4     = Convert.ToInt32((e.Item.FindControl("cbMsg4") as CheckBox).Checked);
            myList.Msg5     = Convert.ToInt32((e.Item.FindControl("cbMsg5") as CheckBox).Checked);
            myList.Msg6     = Convert.ToInt32((e.Item.FindControl("cbMsg6") as CheckBox).Checked);
            string retInfo     = "";
            bool   success     = false;
            string commandName = e.CommandName;

            if (commandName != null)
            {
                if (!(commandName == "Save"))
                {
                    if (!(commandName == "Delete"))
                    {
                        return;
                    }
                }
                else
                {
                    if ((((((myList.Msg1 + myList.Msg2) + myList.Msg3) + myList.Msg4) + myList.Msg5) + myList.Msg6) == 0)
                    {
                        this.ShowMsg("当前用户未选择任何消息提醒,无法保存。", false);
                        return;
                    }
                    success = VShopHelper.SaveAdminUserMsgList(false, myList, myList.UserOpenId, out retInfo);
                    this.BindData();
                    this.ShowMsg(retInfo, success);
                    return;
                }
                success = VShopHelper.DeleteAdminUserMsgList(myList, out retInfo);
                if (success)
                {
                    this.rptAdminUserList.Items[0].Visible = false;
                }
                this.ShowMsg(retInfo, success);
            }
        }
 private QueueMessageBoxNotification()
 {
     ActionMessageBox = (sender, page, title, content, mode, imageMode, buttonMode, command, args) =>
     {
         MsgList.Enqueue(new MessageBoxInfo()
         {
             Sender = sender, Page = page, Title = title, Content = content, Mode = mode, ImageMode = imageMode, ButtonMode = buttonMode, Command = command, Args = args
         });
         MoveNext();
     };
 }
Exemple #13
0
        private void Delete(Object paramater)
        {
            string id = paramater as string;

            if (id != null)
            {
                UserModel user = MsgList.FirstOrDefault(u => u.uid == id);
                MsgList.Remove(user);
                DbService.Current.DeleteUser(user);
                DbService.Current.DeleteMsg(id);
            }
        }
 private void ScollerToButtom()
 {
     MsgList.BeginRefresh();
     if (Messages.Count > 0)
     {
         Device.BeginInvokeOnMainThread(() =>
         {
             MsgList.ScrollTo(Messages.Last(), ScrollToPosition.End, false);
         });
     }
     MsgList.EndRefresh();
 }
Exemple #15
0
        //创建服务器
        public void createServerFunc()
        {
            Console.WriteLine("websocketserver服务器启动..." + Thread.CurrentThread.GetHashCode());
            server                     = new WebSocketServer();
            jsonSerializer             = new JSONSerializer();
            server.NewMessageReceived += (sock, message) =>
            {
                try
                {
                    MsgList msgJson = jsonSerializer.Deserialize <MsgList>(message);
                    Console.WriteLine("收到新的消息..." + message);
                    if (msgJson != null && msgJson.msgs.Count > 0)
                    {
                        lock (this.waiting_dataGridView)
                        {
                            //因为是在自己的线程里面调用,所以关于datagridview的操作都必须放到委托里面,否则一出滚动条就卡死
                            this.waiting_dataGridView.BeginInvoke(UpdatePrintingDelegate, msgJson, sock);
                            Monitor.PulseAll(this.waiting_dataGridView);
                        }
                    }

                    Console.WriteLine("服务线程..." + Thread.CurrentThread.GetHashCode());
                    //sock.Send(message+"已加入到打印队列");
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.ToString());
                    sock.Close();
                }
            };

            server.SessionClosed += (sock, message) =>
            {
                Console.WriteLine("session连接断开...");
                this.connected_client_count_label.BeginInvoke(UpdateConnectedStateDelegate, "当前连接数 " + server.SessionCount);
            };


            server.NewSessionConnected += (sock) =>
            {
                Console.WriteLine("打开新的连接...");

                this.connected_client_count_label.BeginInvoke(UpdateConnectedStateDelegate, "当前连接数 " + server.SessionCount);
            };
            this.server_state_label.BeginInvoke(UpdateServerStateDelegate, "正在运行");
            if (!server.Setup(new ServerConfig {
                Port = 8881, MaxConnectionNumber = 100
            }) || !server.Start())
            {
                this.server_state_label.BeginInvoke(UpdateServerStateDelegate, "启动失败...");
                WebSocketException.ThrowServerError("启动失败...");
            }
        }
    protected void MsgBind()
    {
        PagedDataSource pg = new PagedDataSource();

        pg.DataSource       = DbFilter.GetMsgList().Tables[0].DefaultView;
        pg.AllowPaging      = true;
        pg.PageSize         = 3;
        pg.CurrentPageIndex = int.Parse(ViewState["Page"].ToString());
        ViewState["count"]  = pg.PageCount;
        MsgList.DataSource  = pg;
        MsgList.DataBind();
    }
        public bool DeleteAdminUserMsgList(MsgList myList, out string RetInfo)
        {
            RetInfo = "";
            DbCommand sqlStringCommand = this.database.GetSqlStringCommand(" delete from Hishop_MessageAdminUserMsgList  where UserOpenId='" + myList.UserOpenId + "' ");

            if (this.database.ExecuteNonQuery(sqlStringCommand) == 0)
            {
                RetInfo = "此OpenId不存在,无法删除。";
                return(false);
            }
            RetInfo = "删除成功!";
            return(true);
        }
Exemple #18
0
        public bool SaveAdminUserMsgList(bool IsInsert, MsgList myList, string OldUserOpenIdIfUpdate, out string RetInfo)
        {
            RetInfo = "";
            System.Data.Common.DbCommand sqlStringCommand;
            int  num;
            bool result;

            if (IsInsert)
            {
                sqlStringCommand = this.database.GetSqlStringCommand(" select count(*) as SumRec from Hishop_MessageAdminUserMsgList where UserOpenId='" + myList.UserOpenId + "' ");
                num = Convert.ToInt32(this.database.ExecuteScalar(sqlStringCommand).ToString());
                if (num > 0)
                {
                    RetInfo = "此OpenId已存在。";
                    result  = false;
                    return(result);
                }
                sqlStringCommand = this.database.GetSqlStringCommand(" insert into Hishop_MessageAdminUserMsgList(UserOpenId, RealName,RoleName, Msg1,Msg2,Msg3,Msg4,Msg5,Msg6,Type )\r\n                        values (@UserOpenId, @RealName,@RoleName, @Msg1,@Msg2,@Msg3,@Msg4,@Msg5,@Msg6,@Type)\r\n                ");
                this.database.AddInParameter(sqlStringCommand, "UserOpenId", System.Data.DbType.String, myList.UserOpenId);
            }
            else
            {
                sqlStringCommand = this.database.GetSqlStringCommand(" select count(*) as SumRec from Hishop_MessageAdminUserMsgList where UserOpenId='" + OldUserOpenIdIfUpdate + "' ");
                num = Convert.ToInt32(this.database.ExecuteScalar(sqlStringCommand).ToString());
                if (num == 0)
                {
                    RetInfo = "此OpenId不存在,无法更新。";
                    result  = false;
                    return(result);
                }
                sqlStringCommand = this.database.GetSqlStringCommand(" update  Hishop_MessageAdminUserMsgList set  RealName=@RealName,\r\n                        RoleName=@RoleName, Msg1=@Msg1,Msg2=@Msg2,Msg3=@Msg3,Msg4=@Msg4,Msg5=@Msg5,Msg6=@Msg6   \r\n                        where UserOpenId=@OldUserOpenId\r\n                ");
                this.database.AddInParameter(sqlStringCommand, "OldUserOpenId", System.Data.DbType.String, OldUserOpenIdIfUpdate);
            }
            this.database.AddInParameter(sqlStringCommand, "RealName", System.Data.DbType.String, myList.RealName);
            this.database.AddInParameter(sqlStringCommand, "RoleName", System.Data.DbType.String, myList.RoleName);
            this.database.AddInParameter(sqlStringCommand, "Msg1", System.Data.DbType.Int32, myList.Msg1);
            this.database.AddInParameter(sqlStringCommand, "Msg2", System.Data.DbType.Int32, myList.Msg2);
            this.database.AddInParameter(sqlStringCommand, "Msg3", System.Data.DbType.Int32, myList.Msg3);
            this.database.AddInParameter(sqlStringCommand, "Msg4", System.Data.DbType.Int32, myList.Msg4);
            this.database.AddInParameter(sqlStringCommand, "Msg5", System.Data.DbType.Int32, myList.Msg5);
            this.database.AddInParameter(sqlStringCommand, "Msg6", System.Data.DbType.Int32, myList.Msg6);
            this.database.AddInParameter(sqlStringCommand, "Type", System.Data.DbType.Int32, myList.Type);
            num = this.database.ExecuteNonQuery(sqlStringCommand);
            if (num == 0)
            {
                RetInfo = "保存失败。";
            }
            RetInfo = "保存成功!";
            result  = (num > 0);
            return(result);
        }
Exemple #19
0
        protected void rptAdminUserList_ItemCommand(object source, System.Web.UI.WebControls.RepeaterCommandEventArgs e)
        {
            int num = 0;

            int.TryParse(e.CommandArgument.ToString(), out num);
            MsgList myList = default(MsgList);

            System.Web.UI.WebControls.TextBox textBox = e.Item.FindControl("txtUserOpenId") as System.Web.UI.WebControls.TextBox;
            myList.UserOpenId = textBox.Text.Trim();
            System.Web.UI.WebControls.TextBox textBox2 = e.Item.FindControl("txtRoleName") as System.Web.UI.WebControls.TextBox;
            myList.RoleName = textBox2.Text.Trim();
            System.Web.UI.WebControls.TextBox textBox3 = e.Item.FindControl("txtRealName") as System.Web.UI.WebControls.TextBox;
            myList.RealName = textBox3.Text.Trim();
            myList.Msg1     = System.Convert.ToInt32((e.Item.FindControl("cbMsg1") as System.Web.UI.WebControls.CheckBox).Checked);
            myList.Msg2     = System.Convert.ToInt32((e.Item.FindControl("cbMsg2") as System.Web.UI.WebControls.CheckBox).Checked);
            myList.Msg3     = System.Convert.ToInt32((e.Item.FindControl("cbMsg3") as System.Web.UI.WebControls.CheckBox).Checked);
            myList.Msg4     = System.Convert.ToInt32((e.Item.FindControl("cbMsg4") as System.Web.UI.WebControls.CheckBox).Checked);
            myList.Msg5     = System.Convert.ToInt32((e.Item.FindControl("cbMsg5") as System.Web.UI.WebControls.CheckBox).Checked);
            myList.Msg6     = System.Convert.ToInt32((e.Item.FindControl("cbMsg6") as System.Web.UI.WebControls.CheckBox).Checked);
            string msg = "";
            string commandName;

            if ((commandName = e.CommandName) != null)
            {
                if (!(commandName == "Save"))
                {
                    if (!(commandName == "Delete"))
                    {
                        return;
                    }
                    bool flag = VShopHelper.DeleteAdminUserMsgList(myList, out msg);
                    if (flag)
                    {
                        this.rptAdminUserList.Items[0].Visible = false;
                    }
                    this.ShowMsg(msg, flag);
                }
                else
                {
                    if (myList.Msg1 + myList.Msg2 + myList.Msg3 + myList.Msg4 + myList.Msg5 + myList.Msg6 == 0)
                    {
                        this.ShowMsg("当前用户未选择任何消息提醒,无法保存。", false);
                        return;
                    }
                    bool flag = VShopHelper.SaveAdminUserMsgList(false, myList, myList.UserOpenId, out msg);
                    this.BindData();
                    this.ShowMsg(msg, flag);
                    return;
                }
            }
        }
Exemple #20
0
 public string getMessage(MsgList msg)
 {
     if (xml.GetNode("Messages") == null)
     {
         return(msg.ToString() + " ");
     }
     if (xml.GetNode("Messages." + msg.ToString()) != null)
     {
         return(xml["Messages." + msg.ToString()]);
     }
     else
     {
         return(msg.ToString());
     }
 }
Exemple #21
0
        private void btnChatAddOne_Click(object sender, RoutedEventArgs e)
        {
            PerMsg  pt1 = new PerMsg("test", "ceshi");
            PerMsg  pt2 = new PerMsg("test", "ceshi");
            PerMsg  pt3 = new PerMsg("test", "ceshi");
            MsgList mt1 = new MsgList();

            mt1.Add(pt1);
            mt1.Add(pt2);
            mt1.Add(pt3);

            //model.AllChatWaitReads += 1;
            //chats.Add(new Chat { SenderId = "8888", sName = "test", ReceiverId = "1111", Content = "测试测试测试测试测试测试", Msgs = mt1 });
            chats.Add(new Chat("8888", "test", "1111", "测试测试测试测试测试测试", mt1, 0));
        }
Exemple #22
0
        } // W_Main_Load

        /// <summary>
        /// 遍历消息列表,每20秒查询一下是否有新好友加入
        /// </summary>
        /// <param name="cancellationToken">the sing of cancel task</param>
        private void findAddMsg(CancellationToken cancellationToken)
        {
            while (!cancellationToken.IsCancellationRequested)
            {
                // 发现未读消息
                Thread.Sleep(1000);
                MsgList   msgList   = MsgList.GetInstance();
                ArrayList indexList = new ArrayList();
                int       i         = 0;
                unReadMsg = "";
                lbl_unRdMsg.Invoke(reset, "", lbl_unRdMsg);
                if (msgList.recvMsgList.Count != 0)
                {
                    foreach (RecvdMsg msg in msgList.recvMsgList)
                    {
                        if (msg.type == "addfrd")
                        {
                            pnl_userList.Invoke(iniFrdList, pnl_userList);
                            indexList.Add(i);
                        } // if

                        // 查看是否有未读消息
                        if (msg.type == "client2client")
                        {
                            unReadMsg += msg.userName + ",";
                        }
                        i++;
                    } // foreach
                }     // if

                unReadMsg.TrimEnd(',');
                if (unReadMsg != "")
                {
                    unReadMsg += "的消息未读";
                    lbl_unRdMsg.Invoke(reset, unReadMsg, lbl_unRdMsg);
                } // if

                // 删掉已经读取的消息
                foreach (int index in indexList)
                {
                    RecvdMsg msg = msgList.recvMsgList[index];
                    msgList.recvMsgList.Remove(msg);
                }
            } // while
        }     // findAddMsg
Exemple #23
0
        protected virtual void ProcessMessages()
        {
            if (MsgList != null && MsgList.Count > 0)
            {
                AddConsoleText(MsgList.ToArray());
            }

            if (MsgList.Count > MSG_COUNT_MAX)
            {
                int numToRemove = MsgList.Count - MSG_COUNT_MAX;
                for (int i = 0; i < numToRemove; i++)
                {
                    MsgList.RemoveRange(0, numToRemove);
                }
            }

            MsgList.Clear();
        }
Exemple #24
0
        /// <summary>
        /// 消息命令输入
        /// </summary>
        /// <param name="no"></param>
        private void SetMsgCommand(string no)
        {
            // 确定
            if (no == "OK")
            {
            }
            // 是
            else if (no == "Yes")
            {
            }
            // 否
            else if (no == "No")
            {
            }

            PopupRoutedEventArgs popupArgs = MsgList.Dequeue();

            if (null != popupArgs.Operate)
            {
                popupArgs.Operate(no);
            }



            if (OperatesService.GetOperates().IsExpired || OperatesService.GetOperates().IsAdminUsing)
            {
                this.Key.KeyMsgMode  = 0;
                this.IsOpenKeyWindow = true;

                this.MsgList.Clear();
                this.Msg.AlertMsgMode = false;


                OperatesService.GetOperates().IsExpired = false;
                Resources.GetRes().SERVER_SESSION       = null;
                _reLogin();
                return;
            }



            Msg.AlertMsgMode = false;
            InitialMsg();
        }
Exemple #25
0
        public bool DeleteAdminUserMsgList(MsgList myList, out string RetInfo)
        {
            RetInfo = "";
            System.Data.Common.DbCommand sqlStringCommand = this.database.GetSqlStringCommand(" delete from Hishop_MessageAdminUserMsgList  where UserOpenId='" + myList.UserOpenId + "' ");
            int  num = this.database.ExecuteNonQuery(sqlStringCommand);
            bool result;

            if (num == 0)
            {
                RetInfo = "此OpenId不存在,无法删除。";
                result  = false;
            }
            else
            {
                RetInfo = "删除成功!";
                result  = true;
            }
            return(result);
        }
Exemple #26
0
        protected void btnSaveRole_Click(object sender, System.EventArgs e)
        {
            MsgList myList = default(MsgList);

            myList.UserOpenId = this.txtScanOpenID.Text.Trim();
            myList.RoleName   = this.txtAdminRole.Text.Trim();
            myList.RealName   = this.txtAdminName.Text.Trim();
            myList.Msg1       = System.Convert.ToInt32(this.cbMsg1.Checked);
            myList.Msg2       = System.Convert.ToInt32(this.cbMsg2.Checked);
            myList.Msg3       = System.Convert.ToInt32(this.cbMsg3.Checked);
            myList.Msg4       = System.Convert.ToInt32(this.cbMsg4.Checked);
            myList.Msg5       = System.Convert.ToInt32(this.cbMsg5.Checked);
            myList.Msg6       = System.Convert.ToInt32(this.cbMsg6.Checked);
            myList.Type       = 1;
            string msg     = "";
            bool   success = VShopHelper.SaveAdminUserMsgList(true, myList, myList.UserOpenId, out msg);

            this.DataListBind();
            this.ShowMsg(msg, success);
        }
Exemple #27
0
    public void OnBackButton()
    {
        var completeCount = PlayerStatus.completeCount;

        if (completeCount == 2 || completeCount == 3)
        {
            var text  = MsgList.Get("comment");
            var param = new DialogParam();
            param.des    = text;
            param.button = "确定";
            var admin  = new Admission_PopupNewPage();
            var dialog = UIEngine.Forward <DialogPage>(param, admin);
            dialog.Complete = result => {
                if (result == DialogResult.Conform)
                {
                    SDKManager.Comment();
                }
                DoBack();
            };
        }
        else if (completeCount >= 4)
        {
            if (SDKManager.IsAdLoaded)
            {
                AdPage.sources = AdPageOpenSources.LevelComplete;
                var admin  = new Admission_PopupNewPage();
                var adPage = UIEngine.Forward <AdPage>(null, admin);
                adPage.Compelte = () => {
                    DoBack();
                };
            }
            else
            {
                DoBack();
            }
        }
        else
        {
            DoBack();
        }
    }
Exemple #28
0
        public void ReceiveAsync(Message msg)
        {
            if (msg == null)
            {
                return;
            }

            lock (MsgList.SyncRoot)
            {
                MsgList.Enqueue(msg);

                if (Handling)
                {
                    return;
                }

                Handling = true;
            }

            ThreadPool.QueueUserWorkItem(new WaitCallback(MsgHandle), this);
        }
Exemple #29
0
    protected void Button2_Click(object sender, EventArgs e)
    {
        Massage msg1 = new Massage();

        if (TextBoxName.Text == "" || TextBoxName.Text == "点此改名")
        {
            msg1.Username = "******";
        }
        else
        {
            msg1.Username = TextBoxName.Text;
        }
        if (TextBox2.Text != "")
        {
            msg1.Content = TextBox2.Text;
            MsgList.msg.Add(msg1);
            MsgList.Test();
            Refresh();
        }
        TextBox2.Text = null;
    }
        protected void btnSaveRole_Click(object sender, EventArgs e)
        {
            MsgList myList = new MsgList {
                UserOpenId = this.txtScanOpenID.Text.Trim(),
                RoleName   = this.txtAdminRole.Text.Trim(),
                RealName   = this.txtAdminName.Text.Trim(),
                Msg1       = Convert.ToInt32(this.cbMsg1.Checked),
                Msg2       = Convert.ToInt32(this.cbMsg2.Checked),
                Msg3       = Convert.ToInt32(this.cbMsg3.Checked),
                Msg4       = Convert.ToInt32(this.cbMsg4.Checked),
                Msg5       = Convert.ToInt32(this.cbMsg5.Checked),
                Msg6       = Convert.ToInt32(this.cbMsg6.Checked),
                Type       = 1
            };
            string retInfo = "";
            bool   success = false;

            success = VShopHelper.SaveAdminUserMsgList(true, myList, myList.UserOpenId, out retInfo);
            this.DataListBind();
            this.ShowMsg(retInfo, success);
        }
Exemple #31
0
    void OnItemUnlockButton(PictruePage_Item item)
    {
        var data = item.data;
        var cost = data.picRow.Get <int>("cost");
        var gold = PlayerStatus.gold;

        if (gold >= cost)
        {
            Debug.Log("can unlock");
            gold -= cost;
            PlayerStatus.gold = gold;
            var pictureId = data.picRow.Get <string>("id");
            LevelStorage.SetPictureUnlocked(pictureId);
            PlayerStatus.Save();

            // 单独处理需要修改显示状态的 item
            data.status = PicturePage_ItemStatus.Unlocked;
            SetItem(item, data);
            item.Flash();
            AudioManager.PlaySe("button");
            AudioManager.PlaySe("unlock-pic");
        }
        else
        {
            var param = new DialogParam();
            param.des    = MsgList.Get("lack_of_gold");
            param.button = "商城";
            var popup  = new Admission_PopupNewPage();
            var dialog = UIEngine.Forward <DialogPage>(param, popup);
            dialog.Complete = result => {
                if (result == DialogResult.Conform)
                {
                    UIEngineHelper.WateAdmissionComplete(() => {
                        UIEngine.Forward <ShopPage>();
                    });
                }
            };
            AudioManager.PlaySe("lack-of-gold");
        }
    }