Esempio n. 1
0
        public void RemoveMessage_NullMessage_ArgumentNullException()
        {
            var messageBoard = new MessageBoard();
            var ex           = Assert.Throws <ArgumentNullException>(() => messageBoard.RemoveMessage(null));

            Assert.That(ex.ParamName, Is.EqualTo(RemoveMessageMessageParam));
        }
Esempio n. 2
0
        public ChatPage(Conversation con) : this()
        {
            var vm = new Chat.ViewModels.ChatPageViewModel(con);

            vm.View             = this;
            this.BindingContext = vm;

            this.Title        = con.Title;
            ScrollListCommand = new Command(() =>
            {
                ChatList.ScrollToLast();
            });
            if (!string.IsNullOrEmpty(con.HTMLTable))
            {
                var webView = MessageBoard.FindByName <WebView>("webView");
                webView.Source = new HtmlWebViewSource
                {
                    Html = con.HTMLTable
                };
            }
            // ChatList.Opacity = 0;
            //var itemSource = ChatList.ItemsSource as ObservableCollection<GroupedMessage>;
            //var lastMessage = itemSource.Last().Last();

            ChatList.ScrollToLast();
            //ChatList.ScrollToLast();
            //ChatList.ScrollTo(lastMessage, ScrollToPosition.MakeVisible, false);
            // ChatList.Opacity = 1;
        }
Esempio n. 3
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        if (txtUName.Text.Trim() == "")
        {
            return;
        }
        if (txtContent.Text.Trim() == "")
        {
            return;
        }
        MessageBoard mess = new MessageBoard();

        mess.M_UName   = txtUName.Text.Trim();
        mess.M_Content = txtContent.Text.Trim();
        mess.M_SID     = ((ServiceInfo)Session["serviceinfo"]).S_ID;
        mess.M_Emotion = "";
        int result = MessageBoardService.Insert_MessageBoard(mess);

        if (result > 0)
        {
            txtUName.Text   = "";
            txtContent.Text = "";
            CommonFunction.Alert(Literal1, "提交成功,谢谢您的参与!");
        }
    }
Esempio n. 4
0
        public void GetMessageBoardFromProject()
        {
            Project      p = Project.GetProject(Api, Settings.TestProject).Result;
            MessageBoard b = RunTest(p.GetMessageBoard(Api));

            Assert.AreEqual(Settings.TestMessageBoard, b.id);
        }
Esempio n. 5
0
        public void AddMessage_EmptyMessage_ArgumentException()
        {
            var messageBoard = new MessageBoard();
            var ex           = Assert.Throws <ArgumentException>(() => messageBoard.AddMessage(string.Empty));

            Assert.That(ex.ParamName, Is.EqualTo(AddMessageMessageParam));
        }
Esempio n. 6
0
    private bool lobbyTryParseCommand(Player player, string text)
    {
        string[] tokens = text.Split().Where(t => t.Length > 0).ToArray();
        if (tokens.Length == 0)
        {
            return(false);
        }

        string command = tokens[0].ToLower();

        if (command == "/play")
        {
            if (player.isServer)
            {
                StartClassicGame();
            }
            else
            {
                MessageBoard.TargetSubmitMessage(player.connectionToClient, Message.Server("Only the server can start a game."));
            }
            return(true);
        }

        return(false);
    }
Esempio n. 7
0
    public void RejectCurrentWord(NetworkInstanceId clickerId)
    {
        Player clickingPlayer = Player.All.FirstOrDefault(p => p.netId == clickerId);

        if (clickingPlayer == null)
        {
            Debug.LogError("Could not find player with id " + clickerId);
            return;
        }

        //If the clicking player is also the drawing player
        //And as long as nobody has guessed yet
        if (clickingPlayer == DrawingPlayer && Player.All.All(p => !p.HasGuessed))
        {
            //First we let everybody know the word has been rejected, and what the word was
            MessageBoard.RpcSubmitMessage(Message.Server(clickingPlayer.GameName + " has rejected the word " + CurrentWord + "."));

            //Then we record the rejection in the current word transaction, and complete the transaction
            _currentWordTransaction.Reject(1.0f - _serverTimeLeft / _timePerTurn.Value);
            _currentWordTransaction.CompleteTransaction();
            _currentWordTransaction = null;
            _wordBankManager.SaveActiveWordBank();

            //Then we (re)start the turn
            startNextTurn();
        }
    }
Esempio n. 8
0
        public void GetMessages()
        {
            MessageBoard      b        = MessageBoard.GetMessageBoard(Api, Settings.TestProject, Settings.TestMessageBoard).Result;
            ApiList <Message> messages = RunTest(b.GetMessages(Api));

            Assert.IsTrue(messages.All(Api).Any(m => m.id == Settings.TestMessage));
        }
Esempio n. 9
0
        protected void Page_Init(object sender, EventArgs e)
        {
            climberProfile = cfController.GetClimberProfile(UserID);

            climberProfile.PlacesUserClimbs = cfController.GetPlacesUserClimbs(UserID);
            messageBoard = cfController.GetMessageBoard(climberProfile.MessageBoardID);
        }
Esempio n. 10
0
 /// <summary>
 /// 添加回复留言信息
 /// </summary>
 /// <param name="entity"></param>
 public void AnswerAdd(MessageBoard entity)
 {
     //
     Song.Entities.Organization org = Business.Do <IOrganization>().OrganCurrent();
     if (org != null)
     {
         entity.Org_ID   = org.Org_ID;
         entity.Org_Name = org.Org_Name;
     }
     Song.Entities.MessageBoard theme = Gateway.Default.From <MessageBoard>().Where(MessageBoard._.Mb_IsTheme == true && MessageBoard._.Mb_UID == entity.Mb_UID).ToFirst <MessageBoard>();
     using (DbTrans tran = Gateway.Default.BeginTrans())
     {
         try
         {
             theme.Mb_AnsTime      = DateTime.Now;
             theme.Mb_ReplyNumber += 1;
             tran.Save <MessageBoard>(theme);
             //
             entity.Mb_IsTheme = false;
             entity.Mb_CrtTime = DateTime.Now;
             entity.Mb_IP      = WeiSha.Common.Request.IP.IPAddress;
             tran.Save <MessageBoard>(entity);
             tran.Commit();
         }
         catch (Exception ex)
         {
             tran.Rollback();
             throw ex;
         }
         finally
         {
             tran.Close();
         }
     }
 }
Esempio n. 11
0
        /// <summary>
        /// 删除回复信息
        /// </summary>
        /// <param name="identify"></param>
        public void AnswerDelete(int identify)
        {
            MessageBoard mb = Gateway.Default.From <MessageBoard>().Where(MessageBoard._.Mb_Id == identify).ToFirst <MessageBoard>();

            if (mb.Mb_IsTheme)
            {
                this.ThemeDelete(mb);
            }
            else
            {
                Song.Entities.MessageBoard theme = Gateway.Default.From <MessageBoard>().Where(MessageBoard._.Mb_IsTheme == true && MessageBoard._.Mb_UID == mb.Mb_UID).ToFirst <MessageBoard>();
                using (DbTrans tran = Gateway.Default.BeginTrans())
                    try
                    {
                        theme.Mb_AnsTime      = DateTime.Now;
                        theme.Mb_ReplyNumber -= 1;
                        tran.Save <MessageBoard>(theme);
                        //
                        tran.Delete <MessageBoard>(MessageBoard._.Mb_Id == identify);
                        tran.Commit();
                    }
                    catch (Exception ex)
                    {
                        tran.Rollback();
                        throw ex;
                    }
                finally
                {
                    tran.Close();
                }
            }
        }
Esempio n. 12
0
 bool ConfirmLeaveBoard(MessageBoard messageBoard)
 {
     return(MessageBox.Show(
                String.Format("Leave the group {0}?", messageBoard.Topic),
                "Leave group",
                MessageBoxButton.OKCancel) == MessageBoxResult.OK);
 }
Esempio n. 13
0
 internal static void PopulateWithRandomValues(MessageBoard record, DummyDataManager dtm, Random random)
 {
     record.Name        = "TestMessageBoard " + random.Next(1000000, 10000000);
     record.Description = "Description " + random.Next(1000000, 10000000);
     record.IsActive    = DebugUtility.FlipCoin(random);
     record.IsModerated = DebugUtility.FlipCoin(random);
 }
Esempio n. 14
0
        public void GetMessageFromMessageBoard()
        {
            MessageBoard b = MessageBoard.GetMessageBoard(Api, Settings.TestProject, Settings.TestMessageBoard).Result;
            Message      m = RunTest(b.GetMessage(Api, Settings.TestMessage));

            Assert.AreEqual(Settings.TestMessage, m.id);
        }
Esempio n. 15
0
 public void Update(MessageBoard message)
 {
     if (message != null && message.Id > 0)
     {
         _messageRepository.Update(message);
     }
 }
        public ResultDto Post([FromBody] CreateMessageBoardDto createMessageBoardDto)
        {
            MessageBoard messageBoard = _mapper.Map <MessageBoard>(createMessageBoardDto);

            messageBoard.Ip       = this.GetIp();
            messageBoard.Agent    = Request.Headers["User-agent"].ToString();
            messageBoard.UserHost = Dns.GetHostName();
            messageBoard.System   = LinCmsUtils.GetOsNameByUserAgent(messageBoard.Agent);
            if (messageBoard.Ip.IsNotNullOrEmpty())
            {
                IpQueryResult ipQueryResult = LinCmsUtils.IpQueryCity(messageBoard.Ip);
                messageBoard.GeoPosition = ipQueryResult.errno == 0 ? ipQueryResult.data : ipQueryResult.errmsg;
            }

            LinUser linUser = _userService.GetCurrentUser();

            if (linUser == null)
            {
                messageBoard.Avatar = "/assets/user/" + new Random().Next(1, 360) + ".png";
            }
            else
            {
                messageBoard.Avatar = _currentUser.GetFileUrl(linUser.Avatar);
            }

            _messageBoardRepository.Insert(messageBoard);
            return(ResultDto.Success("留言成功"));
        }
Esempio n. 17
0
        public void Detach_DoesNotThrow()
        {
            var messageBoard = new MessageBoard();
            var observerMock = new Mock <IMessageBoardObserver>();

            Assert.DoesNotThrow(() => messageBoard.Detach(observerMock.Object));
        }
Esempio n. 18
0
        public void Detach_NullObserver_ArgumentNullException()
        {
            var messageBoard = new MessageBoard();
            var ex           = Assert.Throws <ArgumentNullException>(() => messageBoard.Detach(null));

            Assert.That(ex.ParamName, Is.EqualTo(DetachObserverParam));
        }
Esempio n. 19
0
 public void Insert(MessageBoard message)
 {
     if (message != null)
     {
         _messageRepository.Insert(message);
     }
 }
Esempio n. 20
0
        public async Task CreateAsync(CreateMessageBoardDto createMessageBoardDto)
        {
            MessageBoard messageBoard = _mapper.Map <MessageBoard>(createMessageBoardDto);

            messageBoard.Ip       = this.GetIp();
            messageBoard.Agent    = _httpContextAccessor.HttpContext.Request.Headers["User-agent"].ToString();
            messageBoard.UserHost = Dns.GetHostName();
            messageBoard.System   = LinCmsUtils.GetOsNameByUserAgent(messageBoard.Agent);
            if (messageBoard.Ip.IsNotNullOrEmpty())
            {
                IpQueryResult ipQueryResult = LinCmsUtils.IpQueryCity(messageBoard.Ip);
                messageBoard.GeoPosition = ipQueryResult.errno == 0 ? ipQueryResult.data : ipQueryResult.errmsg;
            }

            LinUser linUser = await _userService.GetCurrentUserAsync();

            if (linUser == null)
            {
                messageBoard.Avatar = "/assets/user/" + new Random().Next(1, 360) + ".png";
            }
            else
            {
                messageBoard.Avatar = _currentUser.GetFileUrl(linUser.Avatar);
            }

            await _messageBoardRepository.InsertAsync(messageBoard);
        }
Esempio n. 21
0
        private void pictureBox5_Click(object sender, EventArgs e)
        {
            if (tabstock == false)
            {
                PictureBox picBox = (PictureBox)(sender);
                picBox.BorderStyle = BorderStyle.Fixed3D;
                tabstock           = true;

                if (f5 == null)
                {
                    MessageBoard f = new MessageBoard(logg);
                    f.TopLevel = false;
                    panel1.Controls.Add(f);
                    f.Show();
                    f5 = f;
                }
                else
                {
                    f5.Show();
                }
            }
            else
            {
                PictureBox picBox = (PictureBox)(sender);
                picBox.BorderStyle = BorderStyle.None;
                tabstock           = false;
                f5.Hide();
            }
        }
Esempio n. 22
0
        /// <summary>
        /// 前台页面留言信息的提交
        /// </summary>
        /// <param name="mb"></param>
        public static void AddMessage(MessageBoard mb)
        {
            string sql        = "";
            string uname      = "";
            string namenumber = "";

            if (mb.M_UName.Contains("路人"))
            {
                sql   = "select top 1 M_UName from T_MessageBoard where M_UName like '%路人%' order by M_ID desc";
                uname = DBHelper.GetStringScalar(sql);

                if (uname == "")
                {
                    mb.M_UName = mb.M_UName + "1";
                    Insert_MessageBoard(mb);
                }
                else
                {
                    namenumber = uname.Substring(2, uname.Length - 2);
                    uname      = "路人" + Convert.ToString((Convert.ToInt32(namenumber) + 1));
                    mb.M_UName = uname;

                    Insert_MessageBoard(mb);
                }
            }
            else
            {
                Insert_MessageBoard(mb);
            }
        }
Esempio n. 23
0
        public async Task <IActionResult> Edit(int id, [Bind("MessageBoardID,Date,Topic,Message,Name")] MessageBoard messageBoard)
        {
            if (id != messageBoard.MessageBoardID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(messageBoard);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MessageBoardExists(messageBoard.MessageBoardID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(messageBoard));
        }
Esempio n. 24
0
        /// <summary>
        /// 接收提交的信息
        /// </summary>
        private void submit()
        {
            string msg     = WeiSha.Common.Request.Form["msg"].String;              //提交的信息
            string imgCode = WeiSha.Common.Request.Cookies["accmsgcode"].ParaValue; //取图片验证码
            string vcode   = WeiSha.Common.Request.Form["vcode"].MD5;               //取工输入的验证码

            //如果验证不通过
            if (imgCode != vcode)
            {
                Response.Write("-1");
            }
            else
            {
                //添加留言
                if (!string.IsNullOrWhiteSpace(msg))
                {
                    Song.Entities.Accounts student = this.Account;
                    if (student != null)
                    {
                        Song.Entities.MessageBoard mb = new MessageBoard();
                        mb.Ac_ID      = student.Ac_ID;
                        mb.Ac_Name    = student.Ac_Name;
                        mb.Ac_Photo   = student.Ac_Photo;
                        mb.Mb_Content = msg;
                        mb.Cou_ID     = couid;
                        mb.Mb_IsTheme = true;
                        Business.Do <IMessageBoard>().ThemeAdd(mb);
                        Response.Write(1);
                    }
                }
            }
            Response.End();
        }
Esempio n. 25
0
        public void Test_CreateUpdateDeleteThread()
        {
            MessageBoard messageBoard = Test_MessageBoards.Create(this.DataStore, Workmate.Components.InstanceContainer.ApplicationSettings, this.Application, this.Random);

            MessageBoardThreadManager manager = new MessageBoardThreadManager(this.DataStore);
            MessageBoardThread        record  = Create(this.DataStore, Workmate.Components.InstanceContainer.ApplicationSettings, this.Application, messageBoard, this.Random);

            MessageBoardThread recordToCompare;

            for (int i = 0; i < this.DefaultUpdateTestIterations; i++)
            {
                PopulateWithRandomValues(record, this.DummyDataManager, this.Random);
                recordToCompare = record;

                manager.Update(record);
                record = manager.GetMessageBoardThread(record.MessageBoardThreadId);

                string errors = string.Empty;
                // TODO (Roman): relax datetime comparisons
                Assert.IsTrue(DebugUtility.ArePropertyValuesEqual(record, recordToCompare, out errors), errors);
                Trace.WriteLine("Update test successfull.");
            }

            Delete(this.DataStore, record);
            Test_MessageBoards.Delete(this.DataStore, messageBoard);
        }
Esempio n. 26
0
 public void Add(MessageBoard model)
 {
     using (var db = new MXMDBContext())
     {
         db.MessageBoards.Add(model);
         db.SaveChanges();
     }
 }
Esempio n. 27
0
        public ActionResult DeleteConfirmed2(int id)
        {
            MessageBoard messageBoard = db.MessageBoards.Find(id);

            db.MessageBoards.Remove(messageBoard);
            db.SaveChanges();
            return(RedirectToAction("Index2"));
        }
 // Use this for initialization
 void Awake()
 {
     Debug.Log(PlayerPrefs.GetInt("Select") + " Selected!");
     messageBoard = MessageBoard.Instance();
     Assert.IsTrue(messageBoard);
     scrollOver = false;
     pauseGame();
 }
Esempio n. 29
0
        public void GetComments()
        {
            MessageBoard      b        = MessageBoard.GetMessageBoard(Api, Settings.TestProject, Settings.TestMessageBoard).Result;
            Message           m        = b.GetMessage(Api, Settings.TestMessage).Result;
            ApiList <Comment> comments = RunTest(m.GetComments(Api));

            Assert.IsTrue(comments.All(Api).Any(c => c.id == Settings.TestComment));
        }
        static void Main(string[] args)
        {
            StandardMessages.WelcomeMessage();

            // se afiseaza comenzile pe care utilizatorul le poate da
            CommandLine.UserCommandLine();

            // se instantiaza  clasele Brain, UserService si MessageBoard folosind clasa Factory
            // clasa Brain are evenimente care sunt apelate atunci cand utilizatorul scrie o comanda
            Brain startApplication = Factory.CreateBrain();

            // clasa UserService descrie toate actiunile pe care un user le poate face in cadrul aplicatiei
            UserService userService = Factory.CreateUserService();

            // clasa MessageBoard descrie actiunile ce pot fi facute cu postarile existente
            MessageBoard postService = Factory.CreateMessageBoard();

            startApplication.ExitApplication += Exit.ExitApplication;
            startApplication.FakeCommand     += StandardMessages.FakeCommand;
            startApplication.HelpCommand     += CommandLine.UserCommandLine;
            startApplication.CreateAccount   += userService.CreateAccount;
            startApplication.LogOut          += userService.LogOut;
            startApplication.LogIn           += userService.LogIn;
            startApplication.AddPost         += userService.AddPost;
            startApplication.ShowAllPost     += postService.ShowAllPost;
            startApplication.ShowPost        += postService.ShowPost;
            startApplication.WrongId         += StandardMessages.WrongId;
            userService.UserNotConnected     += StandardMessages.UserNotConnected;
            userService.NewMessage           += StandardMessages.NewPost;
            userService.NewPostIsAdded       += postService.AddNewPost;
            postService.UserNotConnected     += StandardMessages.UserNotConnected;
            postService.ShowPostById         += DisplayPost.DisplayPostById;
            postService.ShowAllPosts         += DisplayPost.DisplayAllPosts;

            string command = null;
            string getCommand;

            do
            {
                Console.Write($"  > ");

                // daca exista un user conectat numele lui va fi afisat in consola
                if (UserService.UserConnected != null)
                {
                    Console.Write($"({UserService.UserConnected}): ");
                }

                // se citeste comanda de la tastatura
                getCommand = UserCommand.Read();

                if (!string.IsNullOrEmpty(getCommand))
                {
                    // daca userul introduce o comanda care nu este nula se trimite ca parametru catre Brain
                    startApplication.GetUserCommand(getCommand);
                    command = Brain.Command;
                }
            }while (true);
        }
Esempio n. 31
0
        protected void Page_Init(object sender, EventArgs e)
        {
            climberProfile = cfController.GetClimberProfile(UserID);

            //climberProfile.PlacesUserClimbs = cfController.GetPlacesUserClimbs(UserID);
            messageBoard = cfController.GetMessageBoard(climberProfile.MessageBoardID);
            //allPlaces = CFDataCache.AllPlaces;
            //placesUserClimbsIDs = climberProfile.PlacesUserClimbs.Select(c => c.ID).ToList();
        }
Esempio n. 32
0
 public vMessageBoard(MessageBoard model)
 {
     this.ID = model.ID;
     this.FromUserID = model.FromUserID;
     this.ToUserID = model.ToUserID;
     this.Description = model.Description;
     this.Time = Helpers.Time.ToTimeTip(model.Time);
     this.FromUser = model.FromUser;
     this.ToUser = model.ToUser;
 }
Esempio n. 33
0
public static void Main()
{
MessageBoard message = new MessageBoard();
Thread reader = new Thread(new ThreadStart(message.Reader));
reader.Name = "ReaderThread";
Thread writer = new Thread(new ThreadStart(message.Writer));
writer.Name = "Writer thread";
reader.Start();
reader.SetPriority = 
writer.Start();


}
 public static MessageBoard Instance()
 {
     if (instance != null)
         return instance;
     lock (instance_lock)
     {
         instance = (MessageBoard)FindObjectOfType(typeof(MessageBoard));
         if (FindObjectsOfType(typeof(MessageBoard)).Length > 1)
         {
             Debug.LogError("There can only be one instance!");
             return instance;
         }
         if (instance != null)
             return instance;
         Debug.LogError("Could not find a instance!");
         return null;
     }
 }
    void Awake()
    {
        childWaves = new List<StageWave>();
        IEnumerable waves = transform.GetComponentsInChildren<StageWave>();
        foreach (StageWave w in waves)
        {
            childWaves.Add(w);
            w.Initialize(this);
        }
        numOfWaves = childWaves.Count;
        currentWaveIndex = 0;

        if (numOfWaves <= 0)
            Debug.LogError("num of waves is empty! CampaignStage" + name);
        beginNextWave = false;
        messageBoard = MessageBoard.Instance();
        numOfWavesCompleted = 0;
    }
Esempio n. 36
0
 public void MessageDelegation(MessageBoard mb)
 {
     mb();
 }
Esempio n. 37
0
 void Start()
 {
     windowRect = new Rect (0, 0, 3*Screen.width/4, 3*Screen.height/4);
     mBoardGO = GameObject.FindWithTag ("MessageBoard");
     mBoard = mBoardGO.GetComponent<MessageBoard>();
 }
Esempio n. 38
0
 //Action<> blah();
 public void RunDelegate(MessageBoard mb, BillBoard bb)
 {
     Console.WriteLine(mb());
      bb();
 }
Esempio n. 39
0
 private static MessageBoard PrepareMessageBoard()
 {
     var mb = new MessageBoard();
     mb.Receive<CreateCommand>(On);
     mb.Receive<DestroyCommand>(On);
     mb.Receive<OpenCommand>(On);
     mb.Receive<CloseCommand>(On);
     mb.Receive<WriteCommand>(On);
     mb.Receive<ReadCommand>(On);
     mb.Receive<SeekCommand>(On);
     mb.Receive<DirectoryCommand>(On);
     mb.Receive<InitCommand>(On);
     mb.Receive<SaveCommand>(On);
     mb.Receive<HelpCommand>(On);
     mb.Receive<ExitCommand>(On);
     return mb;
 }