Exemplo n.º 1
0
        public MainWindow()
        {
            InitializeComponent( );

            var primaryForm = new PrimaryWindow( );

            primaryForm.Show( );
        }
Exemplo n.º 2
0
        private void SortBroadcastingPeers(object sender, EventArgs e)
        {
            //Incase it is being called by window for first time initialization then get the nick too
            if (sender.GetType() == PrimaryWindow.GetType())
            {
                while (nick == "" || nick == "Enter Nick" || (nick.IndexOf(':') != -1) || (nick.IndexOf('<') != -1) || (nick.IndexOf('>') != -1) || nick.Length > 30)
                {
                    Dialogs.InputNickWindow _dialog = new Dialogs.InputNickWindow();
                    _dialog.ShowInTaskbar = false;
                    _dialog.Owner         = this;
                    if (_dialog.ShowDialog() == true)
                    {
                        nick = _dialog.ResponseText.Trim();
                    }
                }

                WriteToLogbox("Starting Status Broadcasts");
                broadcastTimer = new Timer(Broadcast, null, 0, Timeout.Infinite);
            }

            GridViewColumnHeader _column = SortHeader;

            if (listViewSortCol != null)
            {
                System.Windows.Documents.AdornerLayer.GetAdornerLayer(listViewSortCol).Remove(listViewSortAdorner);
            }

            System.ComponentModel.ListSortDirection newDir = System.ComponentModel.ListSortDirection.Descending;
            if (listViewSortCol == _column && listViewSortAdorner.Direction == newDir)
            {
                newDir = System.ComponentModel.ListSortDirection.Ascending;
            }

            listViewSortCol = _column;

            if (newDir == System.ComponentModel.ListSortDirection.Ascending)
            {
                broadcastingPeersList.Sort(Comparers.PeerContainerCompare.CompareAscending);
            }
            else
            {
                broadcastingPeersList.Sort(Comparers.PeerContainerCompare.CompareDescending);
            }

            listViewSortAdorner = new Graphics.Adorners.SortAdorner(listViewSortCol, newDir);
            System.Windows.Documents.AdornerLayer.GetAdornerLayer(listViewSortCol).Add(listViewSortAdorner);

            BroadcastingList.ItemsSource = broadcastingPeersList;
            BroadcastingList.Items.Refresh();
        }