Ejemplo n.º 1
0
        /// <summary>
        ///    Called when the user clicks the "Add RAMvaderTestTarget addresses" context menu item (from
        ///    the <see cref="DataGrid"/> that keeps the registered memory addresses).
        /// </summary>
        /// <param name="sender">The object which sent the event.</param>
        /// <param name="e">Holds data about the event.</param>
        private void MenuItemAddRAMvaderTestTargetAddresses(object sender, RoutedEventArgs e)
        {
            AddRAMvaderTestTargetAddressesDialog dialog = new AddRAMvaderTestTargetAddressesDialog();

            if (dialog.ShowDialog() == true)
            {
                // Calculate the addresses to be added
                AddressData [] addressesToAdd = new AddressData[]
                {
                    new AddressData("Var Byte", dialog.RetrieveTypedAddress(typeof(Byte)), (Byte)0, false),
                    new AddressData("Var Int16", dialog.RetrieveTypedAddress(typeof(Int16)), (Int16)0, false),
                    new AddressData("Var Int32", dialog.RetrieveTypedAddress(typeof(Int32)), (Int32)0, false),
                    new AddressData("Var Int64", dialog.RetrieveTypedAddress(typeof(Int64)), (Int64)0, false),
                    new AddressData("Var UInt16", dialog.RetrieveTypedAddress(typeof(UInt16)), (UInt16)0, false),
                    new AddressData("Var UInt32", dialog.RetrieveTypedAddress(typeof(UInt32)), (UInt32)0, false),
                    new AddressData("Var UInt64", dialog.RetrieveTypedAddress(typeof(UInt64)), (UInt64)0, false),
                    new AddressData("Var Single", dialog.RetrieveTypedAddress(typeof(Single)), (Single)0, false),
                    new AddressData("Var Double", dialog.RetrieveTypedAddress(typeof(Double)), (Double)0, false),
                    new AddressData("Var IntPtr", dialog.RetrieveTypedAddress(typeof(IntPtr)), IntPtr.Zero, false),
                };

                // Add the addresses to the list
                foreach (AddressData curAddr in addressesToAdd)
                {
                    RegisteredAddresses.Add(curAddr);
                }

                // Output for the user
                this.PrintLineToConsole(Properties.Resources.strConsoleMsgRAMvaderTestTargetAddressesAdded);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        ///    Called when the user clicks the "Add New Address" context menu item (from
        ///    the <see cref="DataGrid"/> that keeps the registered memory addresses).
        /// </summary>
        /// <param name="sender">The object which sent the event.</param>
        /// <param name="e">Holds data about the event.</param>
        private void MenuItemAddAddress(object sender, RoutedEventArgs e)
        {
            // Create a dummy AddressData object and add it to the list
            AddressData newEntry = new AddressData(Properties.Resources.strNewAddressId, IntPtr.Zero,
                                                   (Int32)0, false);

            RegisteredAddresses.Add(newEntry);

            // Output for the user
            this.PrintLineToConsole(Properties.Resources.strConsoleMsgRegisteredNewEntry);
        }
Ejemplo n.º 3
0
        /// <summary>
        ///    Called when the user clicks the "Delete address(es)" context menu item (from
        ///    the <see cref="DataGrid"/> that keeps the registered memory addresses).
        /// </summary>
        /// <param name="sender">The object which sent the event.</param>
        /// <param name="e">Holds data about the event.</param>
        private void MenuItemDeleteAddress(object sender, RoutedEventArgs e)
        {
            // Copy the list of selected items to a buffer (as we might not acess the "SelectedItems" and remove elements
            // from it at the same time in a foreach loop)
            List <AddressData> selectedItems = new List <AddressData>(m_dataGridAddresses.SelectedItems.Count);

            foreach (object curSelectionRaw in m_dataGridAddresses.SelectedItems)
            {
                selectedItems.Add((AddressData)curSelectionRaw);
            }

            // Remove the elements from the list
            foreach (AddressData curSelectedObj in selectedItems)
            {
                RegisteredAddresses.Remove(curSelectedObj);
            }

            // Output for the user
            this.PrintLineToConsole(Properties.Resources.strConsoleMsgDeletedEntries);
        }