//This method handle the event raised by the click on the remove configuration button
        private void Remove_Configuration_button_Click(object sender, RoutedEventArgs e)
        {
            this.button_grid.Visibility = Visibility.Hidden;
            this.select_grid.Visibility = Visibility.Visible;

            this.mode = Features.Window_Mode.Remove;
        }
        //-------------------- CONSTRUCTOR ----------------------------------------------------------------------------------------
        //This constructor is used when we have to manage a request from the Main Window and we don't know
        //what configuration the user want to select
        public Setup_Window(Features.Window_Mode mode)
        {
            Features.openedWindow = Features.Window_type.Setup;
            InitializeComponent();

            this.mode = mode;
            if (mode != Features.Window_Mode.Create)
            {
                MessageBox.Show("An unknown mode has been specified!");
                this.insertConfiguration.IsEnabled = false;
                this.Close();
                return;
            }
            this.countBoards = 0;
            this.blinking    = false;

            //Disable sava and start button but not the cancel button
            this.save_data_button.IsEnabled = false;
            this.start_button.IsEnabled     = false;

            //Inserting the first 4 grid rows
            Add_some_TextBox_rows(4);

            //Initialize the boards and the starting list of boards
            boards[0].x.Text   = "-1";
            boards[0].y.Text   = "-1";
            boards[0].MAC.Text = "aa:aa:aa:aa:aa:aa";
            inserted_boards.Add(new Board("aa:aa:aa:aa:aa:aa", -1, -1));
            boards[1].x.Text   = "1";
            boards[1].y.Text   = "-1";
            boards[1].MAC.Text = "bb:bb:bb:bb:bb:bb";
            inserted_boards.Add(new Board("bb:bb:bb:bb:bb:bb", 1, -1));
            boards[2].x.Text   = "1";
            boards[2].y.Text   = "1";
            boards[2].MAC.Text = "cc:cc:cc:cc:cc:cc";
            inserted_boards.Add(new Board("cc:cc:cc:cc:cc:cc", 1, 1));
            boards[3].x.Text   = "-1";
            boards[3].y.Text   = "1";
            boards[3].MAC.Text = "dd:dd:dd:dd:dd:dd";
            inserted_boards.Add(new Board("dd:dd:dd:dd:dd:dd", -1, 1));

            //Initilize the graph properties
            Axis_Initialize();
            LineSeries_Initialize();
            polygon.Values = new ChartValues <ObservablePoint> {
                new ObservablePoint(-1, -1), new ObservablePoint(1, -1),
                new ObservablePoint(1, 1), new ObservablePoint(-1, 1),
                new ObservablePoint(-1, -1)
            };
            Axis_Focus_Point();

            call_event = true;
        }
Пример #3
0
        //-------------------- CONSTRUCTOR --------------------------------------------------------------------------------------
        public Statistic_Window(Configuration configuration, Features.Window_Mode opening_mode)
        {
            Features.openedWindow = Features.Window_type.Statistic;
            InitializeComponent();

            no_detection                = true;
            DM_realtime                 = true;
            CoT_realtime                = true;
            this.opening_mode           = opening_mode;
            this.configuration          = configuration;
            this.configurationName.Text = configuration.ConfigurationID;
            update_Graph                = new DispatcherTimer();
            update_Stats                = new DispatcherTimer();
            timeout = new DispatcherTimer();
            configuration_boards = configuration.Boards;
            devices_position     = new List <Position>();
            frequentMACs         = new List <FrequentMAC>();
            activity_timeline    = new Dictionary <DateTime, TimeSpan>();
            dataCaching          = new DataCaching(configuration.ConfigurationID);
            _lockObject          = new object();
        }
        //This costructor is made for calling this window with all the specifications yet showed up, when we know the
        //configuration we will go to use
        public Setup_Window(Features.Window_Mode mode, Configuration configuration)
        {
            Features.openedWindow = Features.Window_type.Setup;
            InitializeComponent();

            if (mode != Features.Window_Mode.Create && mode != Features.Window_Mode.Modify)
            {
                MessageBox.Show("An unknown mode has been specified!");
                this.insertConfiguration.IsEnabled = false;
                this.Close();
                return;
            }
            else
            {
                this.mode = mode;
            }

            this.configuration            = configuration;
            this.insertConfiguration.Text = configuration.ConfigurationID;
            this.countBoards = 0;

            if (configuration == null)
            {
                MessageBox.Show("This operation is not possible because there isn't a configuration with this name associated!");
                this.Close();
                return;
            }
            else
            {
                int numberBoards = configuration.BoardCount();

                //Control if we are in the auto-setup mode or not
                if (mode == Features.Window_Mode.Create)
                {
                    this.blinking = true;
                }
                else
                {
                    this.blinking = false;
                }

                //Here i initialize the graph
                Axis_Initialize();
                LineSeries_Initialize();

                //Inserting the needed rows' grid, initializing their elements and update the map
                Add_some_TextBox_rows(numberBoards);

                //Initializing the list of elements and displaying the points on the graph
                for (int i = 0; i < numberBoards; i++)
                {
                    Board board = configuration.BoardElementAt(i);
                    boards[i].x.Text   = board.X.ToString("N2");
                    boards[i].y.Text   = board.Y.ToString("N2");
                    boards[i].MAC.Text = board.BoardID;

                    inserted_boards.Add(board);
                    polygon.Values.Add(new ObservablePoint(board.X, board.Y));
                }
                if (polygon.Values.Count > Features.leastBoardNumber)
                {
                    Board start_board = configuration.BoardElementAt(0);
                    polygon.Values.Add(new ObservablePoint(start_board.X, start_board.Y));
                }
                Axis_Focus_Point();
                call_event = true;

                //Checking what button have to be enabled and what not
                this.save_data_button.IsEnabled = false;
                if (this.mode.Equals(Features.Window_Mode.Modify))
                {
                    this.start_button.IsEnabled = true;
                }
                else
                {
                    this.start_button.IsEnabled = false;
                }
            }
        }