Ejemplo n.º 1
0
        void listView1_ColumnClick(object sender, ColumnClickEventArgs e)
        {
            // Determine if clicked column is already the column that is being sorted.
            if (e.Column == lvwColumnSorter.SortColumn)
            {
                // Reverse the current sort direction for this column.
                if (lvwColumnSorter.Order == SortOrder.Ascending)
                {
                    lvwColumnSorter.Order = SortOrder.Descending;
                    ListViewExtensions.SetSortIcon(listView1, e.Column, SortOrder.Descending);
                }
                else
                {
                    lvwColumnSorter.Order = SortOrder.Ascending;
                    ListViewExtensions.SetSortIcon(listView1, e.Column, SortOrder.Ascending);
                }
            }
            else
            {
                // Set the column number that is to be sorted; default to ascending.
                lvwColumnSorter.SortColumn = e.Column;
                lvwColumnSorter.Order      = SortOrder.Ascending;
                ListViewExtensions.SetSortIcon(listView1, e.Column, SortOrder.Ascending);
            }

            // Perform the sort with these new sort options.
            this.listView1.Sort();
        }
Ejemplo n.º 2
0
        public frmMain()
        {
            XMLSettings.WriteDefaultSettings();

            XMLSettings.ListenPort = ushort.Parse(XMLSettings.ReadValue("ListenPort"));
            XMLSettings.AutoListen = bool.Parse(XMLSettings.ReadValue("AutoListen"));
            XMLSettings.ShowPopup  = bool.Parse(XMLSettings.ReadValue("ShowPopup"));
            XMLSettings.Password   = XMLSettings.ReadValue("Password");

            if (bool.Parse(XMLSettings.ReadValue("ShowToU")))
            {
                using (var frm = new frmTermsOfUse())
                {
                    frm.ShowDialog();
                }
                Thread.Sleep(300);
            }

            InitializeComponent();

            this.Menu = mainMenu;

            lvwColumnSorter = new ListViewColumnSorter();
            lstClients.ListViewItemSorter = lvwColumnSorter;

            ListViewExtensions.removeDots(lstClients);
            ListViewExtensions.changeTheme(lstClients);
        }
Ejemplo n.º 3
0
        public FrmMain()
        {
            ReadSettings();
            ShowTermsOfService(XMLSettings.ShowToU);

            InitializeComponent();

            this.Menu = mainMenu;

            _lvwColumnSorter = new ListViewColumnSorter();
            lstClients.ListViewItemSorter = _lvwColumnSorter;

            ListViewExtensions.removeDots(lstClients);
            ListViewExtensions.changeTheme(lstClients);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Sorts the list by the clicked column.
        /// </summary>
        /// <param name="e">EventArgs object</param>
        protected override void OnColumnClick(ColumnClickEventArgs e)
        {
            //locked = true;

            base.OnColumnClick(e);

            //using (new Hourglass(ShowHourglass))
            {
                ColumnHeader columnHeader = this.Columns[e.Column];

                // The comparer is stored in the Tag property
                FWCompareObject comparer = ((ColumnHeaderTag)columnHeader.Tag).compareObject;
                if (compareObjectComparersVal.FirstComparer == comparer)
                {
                    comparer.Ascending ^= true;
                }
                else
                {
                    compareObjectComparersVal.FirstComparer = comparer;
                }


                object     focusedObjectCache = FocusedObject;
                List <int> selectedObjectIDs  = new List <int>();

                BeforeSort(selectedObjectIDs);

                // Sort the cached objects.
                // The cache will ensure, that all objects are read.
                objectsCacheValue.Sort(compareObjectComparersVal);

                List <int> selectedIndizes = new List <int>();

                AfterSort(focusedObjectCache, selectedObjectIDs, selectedIndizes);

                // The current cache for ListViewItems is invalid now
                itemCache = null;

                // Redraw the list
                Refresh();

                // Set the sort icon (triangle in the column header)
                SortOrder sortOrder = comparer.Ascending ? SortOrder.Ascending : SortOrder.Descending;
                ListViewExtensions.SetSortIcon(this, e.Column, sortOrder);

                //locked = false;
            }
        }
Ejemplo n.º 5
0
        private bool LVColUserMenuClick(
            int ColIdx, 
            string ColText, 
            out ListViewExtensions.UserMenuItem[] Items)
        {
            Items = null;
            if (ColIdx == 0)
                return false;

            Items = new ListViewExtensions.UserMenuItem[]
            {
                new ListViewExtensions.UserMenuItem() { Text = "Exclude - " + ColText },
                new ListViewExtensions.UserMenuItem() { Text = "Include - " + ColText }
            };

            return true;
        }
Ejemplo n.º 6
0
        public static void HandleGetSystemInfoResponse(Client client, Core.Packets.ClientPackets.GetSystemInfoResponse packet)
        {
            if (client.Value.frmSI == null)
            {
                return;
            }

            ListViewItem[] lviCollection = new ListViewItem[packet.SystemInfos.Length / 2];
            int            j             = 0;

            for (int i = 0; i < packet.SystemInfos.Length; i += 2)
            {
                if (packet.SystemInfos[i] != null && packet.SystemInfos[i + 1] != null)
                {
                    lviCollection[j] = new ListViewItem(new string[] { packet.SystemInfos[i], packet.SystemInfos[i + 1] });
                    j++;
                }
            }

            if (client.Value.frmSI == null)
            {
                return;
            }

            try
            {
                client.Value.frmSI.Invoke((MethodInvoker) delegate
                {
                    client.Value.frmSI.lstSystem.Items.RemoveAt(2);                     // Loading... Information
                    foreach (var lviItem in lviCollection)
                    {
                        if (lviItem != null)
                        {
                            client.Value.frmSI.lstSystem.Items.Add(lviItem);
                        }
                    }
                });

                ListViewExtensions.autosizeColumns(client.Value.frmSI.lstSystem);
            }
            catch
            { }
        }
Ejemplo n.º 7
0
        public FrmMain()
        {
            Instance = this;

            ReadSettings();

#if !DEBUG
            ShowTermsOfService(XMLSettings.ShowToU);
#endif

            InitializeComponent();

            this.Menu = mainMenu;

            _lvwColumnSorter = new ListViewColumnSorter();
            lstClients.ListViewItemSorter = _lvwColumnSorter;

            ListViewExtensions.RemoveDots(lstClients);
            ListViewExtensions.ChangeTheme(lstClients);
        }
Ejemplo n.º 8
0
        public static void HandleGetSystemInfoResponse(Client client, Core.Packets.ClientPackets.GetSystemInfoResponse packet)
        {
            if (client.Value.frmSI == null)
            {
                return;
            }

            ListViewItem lviCPU = new ListViewItem(new string[] { "Processor (CPU)", packet.CPU });
            ListViewItem lviRAM = new ListViewItem(new string[] { "Memory (RAM)", packet.RAM + " MB" });
            ListViewItem lviGPU = new ListViewItem(new string[] { "Video Card (GPU)", packet.GPU });
            ListViewItem lviUN  = new ListViewItem(new string[] { "Username", packet.Username });
            ListViewItem lviPC  = new ListViewItem(new string[] { "PC Name", packet.PCName });
            ListViewItem lviUP  = new ListViewItem(new string[] { "Uptime", packet.Uptime });
            ListViewItem lviLAN = new ListViewItem(new string[] { "LAN IP Address", packet.LAN });
            ListViewItem lviWAN = new ListViewItem(new string[] { "WAN IP Address", packet.WAN });

            try
            {
                client.Value.frmSI.Invoke((MethodInvoker) delegate
                {
                    client.Value.frmSI.lstSystem.Items.RemoveAt(2);                     // Loading... Information
                    client.Value.frmSI.lstSystem.Items.Add(lviCPU);
                    client.Value.frmSI.lstSystem.Items.Add(lviRAM);
                    client.Value.frmSI.lstSystem.Items.Add(lviGPU);
                    client.Value.frmSI.lstSystem.Items.Add(lviUN);
                    client.Value.frmSI.lstSystem.Items.Add(lviPC);
                    client.Value.frmSI.lstSystem.Items.Add(lviUP);
                    client.Value.frmSI.lstSystem.Items.Add(lviLAN);
                    client.Value.frmSI.lstSystem.Items.Add(lviWAN);
                });

                ListViewExtensions.autosizeColumns(client.Value.frmSI.lstSystem);
            }
            catch
            { }
        }
Ejemplo n.º 9
0
 /// <summary>Limit the size of the <c>GridViewColumn</c> when it's being resized.</summary>
 /// <param name="sender">The object that called the event.</param>
 /// <param name="e">The <c>System.Windows.Controls.Primitives.DragDeltaEventArgs</c> instance containing the event data.</param>
 void RestrictColumn(object sender, DragDeltaEventArgs e)
 {
     ListViewExtensions.LimitColumnSize((Thumb)e.OriginalSource);
 }
Ejemplo n.º 10
0
        public static void HandleGetSystemInfoResponse(Client client, GetSystemInfoResponse packet)
        {
            if (XMLSettings.ShowToolTip)
            {
                try
                {
                    FrmMain.Instance.lstClients.Invoke((MethodInvoker) delegate
                    {
                        foreach (ListViewItem item in FrmMain.Instance.lstClients.Items)
                        {
                            if (item.Tag == client)
                            {
                                var builder = new StringBuilder();
                                for (int i = 0; i < packet.SystemInfos.Length; i += 2)
                                {
                                    if (packet.SystemInfos[i] != null && packet.SystemInfos[i + 1] != null)
                                    {
                                        builder.AppendFormat("{0}: {1}\r\n", packet.SystemInfos[i], packet.SystemInfos[i + 1]);
                                    }
                                }
                                item.ToolTipText = builder.ToString();
                            }
                        }
                    });
                }
                catch
                {
                }
            }

            if (client.Value.FrmSi == null)
            {
                return;
            }

            ListViewItem[] lviCollection = new ListViewItem[packet.SystemInfos.Length / 2];
            for (int i = 0, j = 0; i < packet.SystemInfos.Length; i += 2, j++)
            {
                if (packet.SystemInfos[i] != null && packet.SystemInfos[i + 1] != null)
                {
                    lviCollection[j] = new ListViewItem(new string[] { packet.SystemInfos[i], packet.SystemInfos[i + 1] });
                }
            }

            try
            {
                client.Value.FrmSi.Invoke((MethodInvoker) delegate
                {
                    client.Value.FrmSi.lstSystem.Items.RemoveAt(2); // Loading... Information
                    foreach (var lviItem in lviCollection)
                    {
                        if (lviItem != null)
                        {
                            client.Value.FrmSi.lstSystem.Items.Add(lviItem);
                        }
                    }

                    ListViewExtensions.AutosizeColumns(client.Value.FrmSi.lstSystem);
                });
            }
            catch
            {
            }
        }