//Handles messages from messaging service after GetMoreHistory() is called
        public void MessageRecieverLimited(MessagingTask task)
        {
            if (task.Conversation.Id != viewModel.Conversation.Id)
            {
                return;
            }
            Console.WriteLine("Starting adding");
            var topMessage = Items.Count >= 2 ? Items[1] : Items.FirstOrDefault();

            Console.WriteLine(topMessage == null);
            var messages = task.Messages;

            if (messages.Count == 0 || messages[0].Conversation != viewModel.Conversation.Id)
            {
                gotAllHistory = true;
                return;
            }
            var users = task.Users;

            users[LocalUserManager.LocalUser.Username] = LocalUserManager.LocalUser;
            updatingItems = true;
            ParseMessage(messages, users, true);
            updatingItems = false;

            if (topMessage != null && !lastVisible)
            {
                MessageListView.ScrollTo(topMessage, ScrollToPosition.MakeVisible, false);
            }
            else
            {
                MessageListView.ScrollTo(Items.LastOrDefault(), ScrollToPosition.End, false);
            }
            Console.WriteLine("Stopping adding");
        }
        //Adds messages to the list
        public void ParseMessage(List <Message> messages, Dictionary <string, User> users, bool reverse = false)
        {
            MessageListView.BatchBegin();
            int i = 0;

            messages.ForEach(message =>
            {
                var model = new MessageModel
                {
                    Message       = message.Text,
                    Name          = viewModel.Users[message.Username].FirstName,
                    Date          = message.Timestamp.ToFullDate(),
                    RightSide     = (message.Username == LocalUserManager.LocalUser.Username),
                    MessageObject = message
                };
                //Ar į pabaigą ar į pradžią dėti pranešimus
                if (reverse)
                {
                    Items.Insert(i, model);
                    i++;
                }
                else
                {
                    Items.Add(model);
                }
            });

            //Scrolls to the end if at the bottom (kinda, I did my best)
            if (lastVisible)
            {
                MessageListView.ScrollTo(Items.LastOrDefault(), ScrollToPosition.End, false);
            }
            MessageListView.BatchCommit();
        }
Beispiel #3
0
        //function that is called when send button is pressed
        void OnImageTapped(object sender, EventArgs args)
        {
            var buttonSend = (Image)sender;

            //Need to change format for user sent texts
            //if last message was from the same user dont show name

            /*int count = MessagesList.Count;
             * if (count>0 && MessagesList[count-1].UserSent.Equals(currentUser))
             * {
             *  //should be false here in final version
             *  MessagesList.Add(new Message { MessageText = Editor_Chat.Text, UserSent = null, Time = DateTime.Now.ToString("h:mm tt"), NotSameUser = true, colorMessage ="Green" });
             * }
             * else
             * {
             *  MessagesList.Add(new Message { MessageText = Editor_Chat.Text, UserSent = currentUser, Time = DateTime.Now.ToString("h:mm tt"), NotSameUser = true , colorMessage = "White" });
             *
             * }*/


            //Send the message
            MessagesList.Add(new Message {
                MessageText = Editor_Chat.Text, UserSent = "Roger", Time = DateTime.Now.ToString("h:mm tt"), NotSameUser = false, colorMessage = "Green", alignment = LayoutOptions.EndAndExpand
            });
            //for current testing we are just adding it to the data source
            //need to reformat the message to: change text to right align, background color to green with opacity
            MessageListView.ItemsSource = null;
            MessageListView.ItemsSource = MessagesList;
            //reset text and hide keyboard
            string text = Editor_Chat.Text;

            Editor_Chat.Text = "";
            Editor_Chat.Unfocus();
            MessageListView.ScrollTo(MessagesList.Last(), ScrollToPosition.End, true);
        }
Beispiel #4
0
        public ChatWindow(IWindowServer windowServer, IClient client)
        {
            ViewModel = new ChatViewModel(windowServer, client);
            InitializeComponent();

            ViewModel.Messages.CollectionChanged += (sender, e) =>
            {
                MessageListView.ScrollIntoView(e.NewItems[e.NewItems.Count - 1]);
            };

            var messageCollectionView = CollectionViewSource.GetDefaultView(MessageListView.ItemsSource) as CollectionView;

            Debug.Assert(messageCollectionView != null, nameof(messageCollectionView) + " != null");
            messageCollectionView.Filter = (item) =>
            {
                var message  = (ChatMessage)item;
                var roomName = message.Room;
                if (roomName == null || roomName.Equals("[System]"))
                {
                    return(true);
                }
                var selectedItem = JoinedRoomList.SelectedItem;
                return(roomName.Equals(selectedItem));
            };
        }
Beispiel #5
0
        public void IndexTest()
        {
            MessageController target = CreateMessageControllerAs("hpotter", TestModel);
            ViewResult        result = target.Index(1) as ViewResult;
            MessageListView   actual = result.ViewData.Model as MessageListView;

            Assert.AreEqual(actual.ActualPage, 1);
            Assert.AreEqual(actual.LastPage, 1);

            MessageModelView message = actual.MessageList.ToArray()[0];

            Assert.AreEqual(message.Indent, 0);
            Assert.IsFalse(message.Recieved);
            Assert.AreEqual(message.TextPreview, "Text");

            MessageModelView message2 = actual.MessageList.ToArray()[1];

            Assert.AreEqual(message2.Indent, 20);
            Assert.IsTrue(message2.Recieved);
            Assert.AreEqual(message2.TextPreview, "Another Text");


            result = target.Index(2) as ViewResult;
            Assert.AreEqual(result.ViewName, "NotExist");

            result = target.Index(0) as ViewResult;
            Assert.AreEqual(result.ViewName, "NotExist");

            result = target.Index(-1) as ViewResult;
            Assert.AreEqual(result.ViewName, "NotExist");
        }
Beispiel #6
0
 private void Entry_Completed(object sender, EventArgs e)
 {
     Device.BeginInvokeOnMainThread(() => {
         MessageListView.ScrollTo(vm.Messages.Last(), ScrollToPosition.End, false);
     });
     //EntryText.Focus();
 }
        public static string userTo;  // gdy napiszemy wiadomosc do uzytkownika A, wracamy ponownie do widoku z uzytkownikiem A
        public ActionResult Index(string userID)
        {
            ProjektEntities db = new ProjektEntities();

            var message = from m in db.MESSAGES  // wyswietlanie wiadomosci
                          where (m.Message_From == User.Identity.Name && m.Message_To == userID) || (m.Message_From == userID && m.Message_To == User.Identity.Name)
                          orderby m.Message_ID
                          select new { m.Message_From, m.Message_To, m.Content, m.Message_ID, m.Date };

            userTo = userID;

            var mod = new MessageListView
            {
                ListMessage      = new List <MessageView>(),
                ListUsersMessage = new List <MessageView>()
            };

            foreach (var item in message)   // dolaczenie wiadomosci do modelu, ktory jest wyswietlony
            {
                mod.ListMessage.Add(new MessageView {
                    fromUser = item.Message_From, toUser = item.Message_To, content = item.Content, messageID = item.Message_ID, date = item.Date
                });
            }


            var listUser = db.MESSAGES.Where(m => m.Message_From == User.Identity.Name)  // wybranie listy osob, do ktorych pisalismy(lista nie ma duplikatow)
                           .GroupBy(p => p.Message_To, (a, b) => b.OrderByDescending(e => e.Message_ID)).Select(s => s.FirstOrDefault());

            foreach (var item in listUser)   // dolaczenie uzytkownikow do modelu
            {
                mod.ListUsersMessage.Add(new MessageView {
                    toUser = item.Message_To, date = item.Date
                });
            }

            var listUser1 = db.MESSAGES.Where(m => m.Message_To == User.Identity.Name && m.Message_From != User.Identity.Name)  // wybranie listy osob, ktore do nas pisaly
                            .GroupBy(p => p.Message_From, (a, b) => b.OrderByDescending(e => e.Message_ID)).Select(s => s.FirstOrDefault());

            foreach (var item in listUser1)  // dolaczenie do modelu
            {
                mod.ListUsersMessage.Add(new MessageView {
                    toUser = item.Message_From, date = item.Date
                });
            }

            for (int i = 0; i < mod.ListUsersMessage.Count; i++)   // usuniecie duplikatow
            {
                for (int j = i + 1; j < mod.ListUsersMessage.Count; j++)
                {
                    if (mod.ListUsersMessage[i].toUser == mod.ListUsersMessage[j].toUser)
                    {
                        mod.ListUsersMessage.Remove(mod.ListUsersMessage[j]);
                    }
                }
            }
            return(View(mod));
        }
Beispiel #8
0
        public async void notify(string type, params object[] list)
        {
            switch (type)
            {
            case "new messages":
                Device.BeginInvokeOnMainThread(() =>
                {
                    if (vm.Messages != null && vm.Messages.Count > 0)
                    {
                        MessageListView.ScrollTo(vm.Messages.Last(), ScrollToPosition.End, false);
                    }
                });
                break;

            case "error":
                AlertMessage("Unexpected Error", "Error while getting messages: " + list[0].ToString() + Environment.NewLine + "The chat will try to update automatically.");
                break;

            case "session error":
                AlertMessage("Session Error", "Error while getting session info: " + list[0].ToString() + Environment.NewLine + "The session will try to update automatically.");
                break;

            case "EmailError":
                AlertMessage("Error sending chat copy to the customer", list[0].ToString());
                break;

            case "closing error":
                AlertMessage("Error closing the session", list[0].ToString());
                break;

            case "session closed":
                await Navigation.PopAsync();

                break;

            case "message error":
                AlertMessage("Error sending message!", "Sending the message failed too many times... The message will not be sent." + Environment.NewLine + "Error: " + list[0].ToString());
                break;

            case "closed without copy":
                AlertMessage("Error sending a copy", "The copy failed to send.");
                break;

            case "no internet":
                AlertMessage("No internet", "There is no internet connection. The background of the chat will stay red until there is no internet connectivity");
                break;

            case "no session error":
                AlertMessage("Error", "Unable to start chat session. Check your internet connectivity.");
                break;

            case "error host":
                AlertMessage("Error", "Unable to reach host after few attempts. Check your network connectivity. The app will try to reach the host again!");
                break;
            }
        }
Beispiel #9
0
 private void EntryText_Focused(object sender, FocusEventArgs e)
 {
     if (vm.Messages != null && vm.Messages.Count > 0)
     {
         Device.BeginInvokeOnMainThread(() =>
         {
             MessageListView.ScrollTo(vm.Messages.Last(), ScrollToPosition.End, false);
         });
     }
 }
Beispiel #10
0
 private void Button_Clicked(object sender, EventArgs e)
 {
     if (vm.Messages != null && vm.Messages.Count > 0)
     {
         Device.BeginInvokeOnMainThread(() =>
         {
             MessageListView.ScrollTo(vm.Messages.Last(), ScrollToPosition.MakeVisible, false);
         });
     }
 }
        //绑定评论信息
        private void BindMessage()
        {
            int       id = Convert.ToInt32(ViewState["ActID"]);
            DataTable dt = CommentsService.SelectComments(id);

            if (dt != null && dt.Rows.Count > 0)
            {
                MessageListView.DataSource = dt;
                MessageListView.DataBind();
            }
        }
Beispiel #12
0
        private void ScrollToEnd()
        {
            if (ServiceManager.Instance.Dispatcher.Thread != Thread.CurrentThread)
            {
                ServiceManager.Instance.Dispatcher.BeginInvoke((Action)(ScrollToEnd));
                return;
            }

            MessageListView.SelectedIndex = MessageListView.Items.Count - 1;
            MessageListView.ScrollIntoView(MessageListView.SelectedItem);
        }
 private void OnSMSReceived(ClassLibraryPhone.Messages.Message message)
 {
     if (MessageListView.InvokeRequired)
     {
         MessageListView.Invoke(new SMSReceivedDelegate(OnSMSReceived), message);
     }
     else
     {
         ListOfMessages.Add(Formatter.FormatMethod(message));
         ShowMessage(ListOfMessages);
     }
 }
Beispiel #14
0
        //绑定留言信息
        private void BindMessage()
        {
            //int id = Convert.ToInt32(ViewState["VideoID"]);
            int       id = int.Parse(Request.QueryString["id"]);
            DataTable dt = LeavewordsService.SelectLeavewords(id);

            if (dt != null && dt.Rows.Count > 0)
            {
                MessageListView.DataSource = dt;
                MessageListView.DataBind();
            }
        }
Beispiel #15
0
        private void CharPage_Loaded(object sender, RoutedEventArgs e)
        {
            Debug.Assert(ConnectedPeerModel != null);

            DataContext = ConnectedPeerModel;
            MessageListView.ScrollToBottom();

            // 有消息过来,自动滚动到最下
            ConnectedPeerModel.MessageList.CollectionChanged += (o, args) =>
            {
                Dispatcher.InvokeAsync(() =>
                {
                    MessageListView.ScrollToBottom();
                }, DispatcherPriority.Background);
            };
        }
Beispiel #16
0
        public ActionResult Index(string search, int page = 1)
        {
            //取得首頁資料
            MessageListView messageList = new MessageListView();

            messageList.Search      = search;
            messageList.Paging      = new ForPaging(page);
            messageList.MessageList = new List <MessageView>();
            List <Message> data = _messageServices.GetDataList(messageList.Paging, messageList.Search);

            messageList.MessageList = Mapper.Map <List <MessageView> >(data);
            foreach (var item in messageList.MessageList)
            {
                item.UserName = _userServices.GetNameByAccount(item.Account);
            }
            return(PartialView(messageList));
        }
        private async void Button_Click(object sender, RoutedEventArgs e)
        {
            if (!(string.IsNullOrEmpty(SendBox.Text) || string.IsNullOrWhiteSpace(SendBox.Text)))
            {
                MessageInterface.Message messageSent = new MessageInterface.Message(SendBox.Text, true, DateTime.Now);
                talkWindow.AddMessage(messageSent);
                MessageInterface.Message messageReceived = new MessageInterface.Message();

                messageReceived.Content = await connector.QueryAndStore(messageSent.Content);

                //messageReceived.Content = Model.Record.replies.Last();
                messageReceived.IsSelf   = false;
                messageReceived.SentTime = DateTime.Now;
                talkWindow.AddMessage(messageReceived);
                MessageListView.SelectedIndex = MessageListView.Items.Count - 1;
                MessageListView.ScrollIntoView(MessageListView.SelectedItem);
            }
            SendBox.Text = string.Empty;
        }
        public ConversationPage(ConversationViewModel viewModel)
        {
            InitializeComponent();
            if (!viewModel.Users.ContainsKey(LocalUserManager.LocalUser.Username))
            {
                viewModel.Users[LocalUserManager.LocalUser.Username] = LocalUserManager.LocalUser;
            }
            BindingContext = this.viewModel = viewModel;
            Items          = new ObservableCollection <MessageModel>
            {
            };
            MessageListView.ItemsSource = Items;
            //Listens messages already loaded
            MessagingCenter.Subscribe <MessagingTask>(this, MessagingTask.LocalMessagesLimited, (task) =>
            {
                Device.BeginInvokeOnMainThread(() =>
                {
                    //Adds them to the list
                    MessageRecieverLimited(task);

                    //Stops listening
                    MessagingCenter.Unsubscribe <MessagingTask>(this, MessagingTask.LocalMessagesLimited);

                    MessagingCenter.Subscribe <MessagingTask>(this, MessagingTask.LocalMessagesLimited, MessageRecieverLimited);

                    //Starts listening for new messages
                    MessagingCenter.Subscribe <MessagingTask>(this, MessagingTask.NewMessages, MessageReciever);
                    MessageListView.ScrollTo(Items.LastOrDefault(), ScrollToPosition.End, false);
                });
            });
            //Ask for messages already loaded
            GetMoreHistory();

#pragma warning disable CS0618 // Type or member is obsolete
            ProfileLayout.GestureRecognizers.Add(new TapGestureRecognizer(async(view) =>
            {
                ProfileLayout.IsEnabled = false;
                await ProfileOpener.OpenProfile(viewModel.Users[viewModel.Conversation.Users[0]]);
                ProfileLayout.IsEnabled = true;
            }));
#pragma warning restore CS0618 // Type or member is obsolete
        }
Beispiel #19
0
        private void ScrollToEnd()
        {
            //************************************************************************************************************************************
            // When Chat conversation is updated then it will scroll to end of chat so recent message should display.
            //************************************************************************************************************************************

            if (ServiceManager.Instance.Dispatcher.Thread != Thread.CurrentThread)
            {
                ServiceManager.Instance.Dispatcher.BeginInvoke((Action)(ScrollToEnd));
                return;
            }

            MessageListView.SelectedIndex = MessageListView.Items.Count - 1;
            var item = MessageListView.SelectedItem as VATRPChatMessage;

            if (item != null)
            {
                MessageListView.ScrollIntoView(item);
            }
        }
Beispiel #20
0
 public ChatPage()
 {
     this.ToolbarItems.Add(new ToolbarItem("Group", "ChatPageGroupButtonImage.png", () =>
     {
         //What the button does when it is pressed
         Navigation.PushAsync(new ChatGroupPage());
     }));
     InitializeComponent();
     MessagesList = new List <Message> {
         new Message {
             MessageText = "Hi Joe how is your camp spot?", UserSent = "Bill", Time = "8:19 PM", NotSameUser = true, colorMessage = "White", alignment = LayoutOptions.Start
         },
         new Message {
             MessageText = "Pretty good, getting dark you got a campfire started yet?", UserSent = "Joe", Time = "8:22 PM", NotSameUser = true, colorMessage = "White", alignment = LayoutOptions.Start
         },
         new Message {
             MessageText = "Yeah I started one about an hour ago", UserSent = "George", Time = "8:25 PM", NotSameUser = true, colorMessage = "White", alignment = LayoutOptions.Start
         },
     };
     MessageListView.ItemsSource = MessagesList;
     MessageListView.ScrollTo(MessagesList.Last(), ScrollToPosition.End, true);
 }
Beispiel #21
0
 //使用Bind的Inculde來定義指接受的欄位,用來避免傳入其他不相干值
 public ActionResult Index([Bind(Include = "Search")] MessageListView data)
 {
     return(RedirectToAction("Index", new { Search = data.Search }));
 }
Beispiel #22
0
 public MessageListPresenter(MessageListView listview)
 {
     this.view = listview;
 }
 public void Scroll(int index)
 {
     MessageListView.SelectedIndex = index;
     MessageListView.ScrollIntoView(MessageListView.SelectedItem);
 }
 public void ScrollStart()
 {
     _countZero = 1;
     MessageListView.SelectedIndex = MessageListView.Items.Count - 1;
     MessageListView.ScrollIntoView(MessageListView.SelectedItem);
 }
Beispiel #25
0
 private void Vm_DataAdded(object sender, EventArgs e)
 {
     MessageListView.ScrollTo(vm.Messages.Last(), ScrollToPosition.Start, true);
 }
        public ActionResult Index(MessageListView messageListView) // szukaj
        {
            ProjektEntities db = new ProjektEntities();

            var us = db.USER.Where(o => o.User_ID.Equals(messageListView.newMessageTo));     // szukanie uzytkownika w bazie danych

            if (us.Any())
            {
                userTo = messageListView.newMessageTo;
            }
            else
            {
                ModelState.AddModelError("", "Użytkownik o podanym loginie nie istnieje.");
            }

            var message = from m in db.MESSAGES
                          where (m.Message_From == User.Identity.Name && m.Message_To == userTo) || (m.Message_From == userTo && m.Message_To == User.Identity.Name)
                          orderby m.Message_ID
                          select new { m.Message_From, m.Message_To, m.Content, m.Message_ID, m.Date };

            var mod = new MessageListView
            {
                ListMessage      = new List <MessageView>(),
                ListUsersMessage = new List <MessageView>()
            };

            foreach (var item in message)
            {
                mod.ListMessage.Add(new MessageView {
                    fromUser = item.Message_From, toUser = item.Message_To, content = item.Content, messageID = item.Message_ID, date = item.Date
                });
            }


            var listUser = db.MESSAGES.Where(m => m.Message_From == User.Identity.Name)
                           .GroupBy(p => p.Message_To, (a, b) => b.OrderByDescending(e => e.Message_ID)).Select(s => s.FirstOrDefault());

            foreach (var item in listUser)
            {
                mod.ListUsersMessage.Add(new MessageView {
                    toUser = item.Message_To, date = item.Date
                });
            }

            var listUser1 = db.MESSAGES.Where(m => m.Message_To == User.Identity.Name && m.Message_From != User.Identity.Name)
                            .GroupBy(p => p.Message_From, (a, b) => b.OrderByDescending(e => e.Message_ID)).Select(s => s.FirstOrDefault());

            foreach (var item in listUser1)
            {
                mod.ListUsersMessage.Add(new MessageView {
                    toUser = item.Message_From, date = item.Date
                });
            }

            for (int i = 0; i < mod.ListUsersMessage.Count; i++)
            {
                for (int j = i + 1; j < mod.ListUsersMessage.Count; j++)
                {
                    System.Diagnostics.Debug.WriteLine("i " + mod.ListUsersMessage[i].toUser + " j " + mod.ListUsersMessage[j].toUser);
                    if (mod.ListUsersMessage[i].toUser == mod.ListUsersMessage[j].toUser)
                    {
                        mod.ListUsersMessage.Remove(mod.ListUsersMessage[j]);
                    }
                }
            }

            return(View(mod));
        }
        public ActionResult wyslij(MessageListView messageListView)
        {
            if (string.IsNullOrWhiteSpace(messageListView.newMessageContent))   // blokada przy wysylaniu pustej wiadomosci
            {
                return(RedirectToAction("Index", new { userID = userTo }));
            }
            ProjektEntities db  = new ProjektEntities();
            var             mod = new MessageListView
            {
                ListMessage      = new List <MessageView>(),
                ListUsersMessage = new List <MessageView>()
            };
            var message = from m in db.MESSAGES
                          where (m.Message_From == User.Identity.Name && m.Message_To == userTo) || (m.Message_From == userTo && m.Message_To == User.Identity.Name)
                          orderby m.Message_ID
                          select new { m.Message_From, m.Message_To, m.Content, m.Message_ID, m.Date };


            foreach (var item in message)
            {
                mod.ListMessage.Add(new MessageView {
                    fromUser = item.Message_From, toUser = item.Message_To, content = item.Content, messageID = item.Message_ID, date = item.Date
                });
            }

            var listUser = db.MESSAGES.Where(m => m.Message_From == User.Identity.Name)
                           .GroupBy(p => p.Message_To, (a, b) => b.OrderByDescending(e => e.Message_ID)).Select(s => s.FirstOrDefault());

            foreach (var item in listUser)
            {
                mod.ListUsersMessage.Add(new MessageView {
                    toUser = item.Message_To, date = item.Date
                });
            }

            var listUser1 = db.MESSAGES.Where(m => m.Message_To == User.Identity.Name && m.Message_From != User.Identity.Name)
                            .GroupBy(p => p.Message_From, (a, b) => b.OrderByDescending(e => e.Message_ID)).Select(s => s.FirstOrDefault());

            foreach (var item in listUser1)
            {
                mod.ListUsersMessage.Add(new MessageView {
                    toUser = item.Message_From, date = item.Date
                });
            }

            for (int i = 0; i < mod.ListUsersMessage.Count; i++)
            {
                for (int j = i + 1; j < mod.ListUsersMessage.Count; j++)
                {
                    System.Diagnostics.Debug.WriteLine("i " + mod.ListUsersMessage[i].toUser + " j " + mod.ListUsersMessage[j].toUser);
                    if (mod.ListUsersMessage[i].toUser == mod.ListUsersMessage[j].toUser)
                    {
                        mod.ListUsersMessage.Remove(mod.ListUsersMessage[j]);
                    }
                }
            }


            if (userTo == null)             // mozliwosc napisania do samego siebie
            {
                userTo = User.Identity.Name;
            }

            MESSAGES newMessage = new MESSAGES();

            newMessage.Message_From = User.Identity.Name;
            newMessage.Message_To   = userTo;
            newMessage.Content      = messageListView.newMessageContent;
            newMessage.Date         = DateTime.Now;
            db.MESSAGES.Add(newMessage);
            db.SaveChanges();

            return(RedirectToAction("Index", new { userID = userTo })); // przekazanie userTo do funkcji Index
        }
Beispiel #28
0
 private void EntryText_Focused(object sender, FocusEventArgs e)
 {
     MessageListView.ScrollTo(vm.Messages.Last(), ScrollToPosition.End, false);
 }
Beispiel #29
0
 private void Entry_Completed(object sender, EventArgs e)
 {
     MessageListView.ScrollTo(vm.Messages.Last(), ScrollToPosition.End, false);
     //EntryText.Focus();
 }
Beispiel #30
0
        private void Button_Clicked(object sender, EventArgs e)
        {
            var x = MessageListView.ItemsSource;

            MessageListView.ScrollTo(vm.Messages.Last(), ScrollToPosition.MakeVisible, false);
        }