private void ScanFileImg_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            if (Params.CurrentPage != "")
            {
                switch (Params.CurrentPage)
                {
                case "ScanFile":
                    break;

                case "ScanURL":
                    var Animation1 = new DoubleAnimation();
                    Animation1.From       = 1;
                    Animation1.To         = 0.2;
                    Animation1.Duration   = TimeSpan.FromSeconds(2.5);
                    Animation1.Completed += new EventHandler(FromURLtoFileCompleted);
                    ScanURLGrid.BeginAnimation(OpacityProperty, Animation1);
                    break;

                case "IPInfo":
                    var Animation2 = new DoubleAnimation();
                    Animation2.From       = 1;
                    Animation2.To         = 0.2;
                    Animation2.Duration   = TimeSpan.FromSeconds(2.5);
                    Animation2.Completed += new EventHandler(FromIPtoFileCompleted);
                    IPInfoGrid.BeginAnimation(OpacityProperty, Animation2);
                    break;

                case "DomainInfo":
                    var Animation3 = new DoubleAnimation();
                    Animation3.From       = 1;
                    Animation3.To         = 0.2;
                    Animation3.Duration   = TimeSpan.FromSeconds(2.5);
                    Animation3.Completed += new EventHandler(FromDomaintoFileCompleted);
                    DomainInfoGrid.BeginAnimation(OpacityProperty, Animation3);
                    break;

                case "Settings":
                    var Animation4 = new DoubleAnimation();
                    Animation4.From       = 1;
                    Animation4.To         = 0.2;
                    Animation4.Duration   = TimeSpan.FromSeconds(2.5);
                    Animation4.Completed += new EventHandler(FromSettingstoFileCompleted);
                    SettingsGrid.BeginAnimation(OpacityProperty, Animation4);
                    break;
                }
            }
            else
            {
                var Animation = new ThicknessAnimation();
                Animation.From     = new Thickness(0, 0, 0, 0);
                Animation.To       = new Thickness(0, -400, 0, 31);
                Animation.Duration = TimeSpan.FromSeconds(0.7);
                MainImageGrid.BeginAnimation(MarginProperty, Animation);
                var Animation1 = new DoubleAnimation();
                Animation1.From       = 1;
                Animation1.To         = 0.1;
                Animation1.Duration   = TimeSpan.FromSeconds(0.7);
                Animation1.Completed += new EventHandler(FromMainImageToScanFile);
                MainImageGrid.BeginAnimation(OpacityProperty, Animation1);
                var Animation4 = new DoubleAnimation();
                Animation4.From     = 0.1;
                Animation4.To       = 1;
                Animation4.Duration = TimeSpan.FromSeconds(2.5);
                ScanFileGrid.BeginAnimation(OpacityProperty, Animation4);
                var Animation3 = new ThicknessAnimation();
                Animation3.From     = new Thickness(0, 264, 0, 0);
                Animation3.To       = new Thickness(0, 303, 0, 0);
                Animation3.Duration = TimeSpan.FromSeconds(0.4);
                ControlPanelGrid.BeginAnimation(MarginProperty, Animation3);
                Params.CurrentPage = "ScanFile";
            }
        }
Exemple #2
0
        public void InitializeCalendar()
        {
            //spliting mainGrid to two rows(for headerTable and eventTable grids) and two columns (headers+events and controlPanel)
            RowDefinition titleRow = new RowDefinition();
            RowDefinition eventRow = new RowDefinition();

            titleRow.Height = new GridLength(RowHeight * 2 + 3 * LineThicness);
            eventRow.Height = new GridLength(1, GridUnitType.Star);

            ColumnDefinition headerAndEventColumn = new ColumnDefinition();
            ColumnDefinition dashboardCloumn      = new ColumnDefinition();

            headerAndEventColumn.Width = new GridLength(1, GridUnitType.Star);
            dashboardCloumn.Width      = new GridLength(350, GridUnitType.Pixel);  //width of controlPanel - great in 1920x1080

            CalendarGrid.RowDefinitions.Add(titleRow);
            CalendarGrid.RowDefinitions.Add(eventRow);
            CalendarGrid.ColumnDefinitions.Add(headerAndEventColumn);
            CalendarGrid.ColumnDefinitions.Add(dashboardCloumn);

            //ScrollBar for event's table

            ScrollViewer calendarEventScrollViewer = new ScrollViewer
            {
                VerticalScrollBarVisibility = ScrollBarVisibility.Hidden,
                Content = EventTableGrid
            };

            //Setting rows and columns property and adding all children to main grid

            HeaderTableGrid.SetValue(Grid.RowProperty, 0);
            calendarEventScrollViewer.SetValue(Grid.RowProperty, 1);
            ControlPanelGrid.SetValue(Grid.RowProperty, 0);
            ControlPanelGrid.SetValue(Grid.RowSpanProperty, 2);

            HeaderTableGrid.SetValue(Grid.ColumnProperty, 0);
            calendarEventScrollViewer.SetValue(Grid.ColumnProperty, 0);
            ControlPanelGrid.SetValue(Grid.ColumnProperty, 1);
            ControlPanelGrid.SetValue(Grid.ColumnProperty, 1);

            CalendarGrid.Children.Add(HeaderTableGrid);
            CalendarGrid.Children.Add(ControlPanelGrid);
            CalendarGrid.Children.Add(calendarEventScrollViewer);

            //At this point we have 3 grids prepared and placed (headerTableGrid, controlPanelGrid and EventTableGrid(inside ScrollViewer))

            //Some math to get proper rows and columns numbers
            int eventTableRowsNumber = ((StopHour - StartHour) * 60) / MinutSlot;
            int columnsNumber        = 1 + RoomsList.Length * NumberOfDaysPerPage;

            DrawColumnsAndRows(HeaderTableGrid, 2, columnsNumber);
            DrawColumnsAndRows(EventTableGrid, eventTableRowsNumber, columnsNumber);

            //now we should have all lines of our tables prepared

            DrawCalendarHeaderLabels();
            DrawCalendarTimeLine();
            DrawCalendarEventControls();

            //our tables are filled with EventTiles and HeaderLabels

            CalendarDashboardControl = new CalendarControlPanel(this);
            //I guess passing reference like this is bad practise but my idea of using only delegates fails... but still it's first big TODO thing

            ControlPanelGrid.Children.Add(CalendarDashboardControl);

            //Calendar is ready to be filled with events

            CurrentShowDate = DateTime.Now;
            UpdateEventList();    //current events will be save in eventsList
        }