コード例 #1
0
        //event for the edit button click
        // lets to update if he is the owner of the message
        // does nothing if he is not the owner
        private void Button_Click_Edit(object sender, RoutedEventArgs e)
        {
            int index = _main.Messages.IndexOf(_main.SelectedListItem);

            if (index < 0)
            {
                return;
            }
            Boolean isOwner = chatroom.isOwner(index);

            if (isOwner)
            {
                Window edit = new EditMessage(_main);
                edit.ShowDialog();
                String newMessage = _main.Edit;
                if (_main.PressEdit)
                {
                    chatroom.EditMesage(index, newMessage);
                    _main.PressEdit = false;
                }
                _main.Edit = "";
            }
            NewView();
        }