Example #1
0
 public void InitializeComponent() {
     if (_contentLoaded) {
         return;
     }
     _contentLoaded = true;
     System.Windows.Application.LoadComponent(this, new System.Uri("/Segator.Loms.Modules.Common.Silverlight;component/Silverlight/QuoteControls/Quot" +
                 "eControl.xaml", System.UriKind.Relative));
     this.PageLoadEvent = ((System.Windows.Interactivity.InvokeCommandAction)(this.FindName("PageLoadEvent")));
     this.LayoutRoot = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot")));
     this.brdContent = ((System.Windows.Controls.Border)(this.FindName("brdContent")));
     this.dragDockPanelHost = ((DragDockControl.DragDockPanelHost)(this.FindName("dragDockPanelHost")));
     this.drackDockTripDetails = ((DragDockControl.DragDockPanel)(this.FindName("drackDockTripDetails")));
     this.drackDockPayment = ((DragDockControl.DragDockPanel)(this.FindName("drackDockPayment")));
     this.drackDockPanelPassenger = ((DragDockControl.DragDockPanel)(this.FindName("drackDockPanelPassenger")));
     this.brdTripDetails = ((System.Windows.Controls.Border)(this.FindName("brdTripDetails")));
     this.tripAssistControl = ((Segator.Loms.Modules.Common.Silverlight.QuoteControls.TripAssist)(this.FindName("tripAssistControl")));
 }
Example #2
0
        /// <summary>
        /// Maximises a panel.
        /// </summary>
        /// <param name="sender">the panel to maximise.</param>
        /// <param name="e">Event args.</param>
        private void DragDockPanel_Maximized ( object sender, EventArgs e ) {
            DragDockPanel maximizedPanel =
                sender as DragDockPanel;
            maximizedPanel.Visibility = Visibility.Visible;

            // Store max'ed panel
            this.maximizedPanel = maximizedPanel;

            // Loop through children to disable dragging
            foreach ( UIElement child in this.Children ) {
                DragDockPanel panel =
                    child as DragDockPanel;

                panel.DraggingEnabled = false;

                if ( panel != this.maximizedPanel ) {
                    panel.PanelMaximized = false;
                }
            }

            // Update sizes and layout
            this.AnimatePanelSizes ();
            this.AnimatePanelLayout ();

            if ( this.maximizedPanel != null ) {
                var mi = this.maximizedPanel.Content.GetType ().GetMethod ( "RefreshChartOnResize" );

                var args = new object[2];
                args[0] = this.ActualWidth;
                args[1] = this.Children.Count;

                if ( mi != null )
                    mi.Invoke ( this.maximizedPanel.Content, args );
            }
        }
Example #3
0
        /// <summary>
        /// Puts all of the panel back to a grid view.
        /// </summary>
        /// <param name="sender">The minimising panel.</param>
        /// <param name="e">Event args.</param>
        private void DragDockPanel_Minimized ( object sender, EventArgs e ) {
            // Set max'ed panel to null
            this.maximizedPanel = null;

            // Loop through children to disable dragging
            foreach ( UIElement child in this.Children ) {
                DragDockPanel panel =
                    child as DragDockPanel;
                panel.DraggingEnabled = true;
                panel.Visibility = Visibility.Visible;
            }

            // Update sizes and layout
            this.AnimatePanelSizes ();
            this.AnimatePanelLayout ();
        }
Example #4
0
        /// <summary>
        /// Drops the dragging panel.
        /// </summary>
        /// <param name="sender">The dragging panel.</param>
        /// <param name="args">Drag event args.</param>
        private void DragDockPanel_DragFinished ( object sender, DragEventArgs args ) {
            // Set dragging panel back to null
            this.draggingPanel = null;

            // Update the layout (to reset all panel positions)
            this.UpdatePanelLayout ();
        }
Example #5
0
        /// <summary>
        /// Keeps a reference to the dragging panel.
        /// </summary>
        /// <param name="sender">The dragging panel.</param>
        /// <param name="args">Drag event args.</param>
        private void DragDockPanel_DragStarted ( object sender, DragEventArgs args ) {
            DragDockPanel panel = sender as DragDockPanel;

            // Keep reference to dragging panel
            this.draggingPanel = panel;
        }
Example #6
0
        /// <summary>
        /// Prepares a panel for the UI. Override for hooking custom events.
        /// </summary>
        /// <param name="panel">The panel to prepare.</param>
        protected virtual void PreparePanel ( DragDockPanel panel ) {
            // Hook up panel events
            panel.DragStarted +=
                new DragEventHander ( this.DragDockPanel_DragStarted );
            panel.DragFinished +=
                new DragEventHander ( this.DragDockPanel_DragFinished );
            panel.DragMoved +=
                new DragEventHander ( this.DragDockPanel_DragMoved );
            panel.Maximized +=
                new EventHandler ( this.DragDockPanel_Maximized );
            panel.Minimized +=
                new EventHandler ( this.DragDockPanel_Minimized );

            if ( panel.PanelMaximized ) {
                this.maximizedPanel = panel;
            }
        }
Example #7
0
        /// <summary>
        /// Removes a panel from the host.
        /// </summary>
        /// <param name="panel">The panel to remove.</param>
        public void RemovePanel ( DragDockPanel panel ) {
            Dictionary<int, DragDockPanel> orderedPanels = new Dictionary<int, DragDockPanel> ();
            List<int> indexes = new List<int> ();

            // Loop through children to order them according to their
            // current row and column...
            foreach ( UIElement child in this.Children ) {
                DragDockPanel childPanel = ( DragDockPanel ) child;

                Type t = childPanel.Content.GetType ();


                orderedPanels.Add (
                    ( Grid.GetRow ( childPanel ) * this.columns ) + Grid.GetColumn ( childPanel ),
                    childPanel );

                indexes.Add ( ( Grid.GetRow ( childPanel ) * this.columns ) + Grid.GetColumn ( childPanel ) );
            }

            orderedPanels.Remove ( ( Grid.GetRow ( panel ) * this.columns ) + Grid.GetColumn ( panel ) );
            indexes.Remove ( ( Grid.GetRow ( panel ) * this.columns ) + Grid.GetColumn ( panel ) );
            this.Children.Remove ( panel );

            Dictionary<int, DragDockPanel> reorderedPanels = new Dictionary<int, DragDockPanel> ();

            for ( int i = 0; i < indexes.Count; i++ ) {
                reorderedPanels.Add ( i, orderedPanels[indexes[i]] );
            }

            this.SetRowsAndColumns ( reorderedPanels );

            if ( this.maximizedPanel == panel || reorderedPanels.Count == 1 ) {
                if ( reorderedPanels.Count > 0 )
                    reorderedPanels[0].PanelMaximized = false;
                this.maximizedPanel = null;

                foreach ( UIElement child in this.Children ) {
                    DragDockPanel childPanel = ( DragDockPanel ) child;
                    childPanel.DraggingEnabled = true;
                    childPanel.Visibility = Visibility.Visible;
                }
            }

            this.AnimatePanelSizes ();
            this.AnimatePanelLayout ();

            panel.ClosePanel ();
        }
Example #8
0
        /// <summary>
        /// Adds a panel to the host.
        /// </summary>
        /// <param name="panel">The panel to add.</param>
        public void AddPanel ( DragDockPanel panel ) {
            Dictionary<int, DragDockPanel> orderedPanels = this.GetOrderedPanels ();
            if (orderedPanels.Values.ToList().Cast<DragDockPanel>().Where(op => op.PanelMaximized).Count() > 0)
                panel.PanelMaximized = true;

            orderedPanels.Add ( this.Children.Count, panel );
            this.Children.Add ( panel );
            this.PreparePanel ( panel );
            this.SetRowsAndColumns ( orderedPanels );

            this.AnimatePanelSizes ();
            this.AnimatePanelLayout ();
        }
Example #9
0
 public void InitializeComponent() {
     if (_contentLoaded) {
         return;
     }
     _contentLoaded = true;
     System.Windows.Application.LoadComponent(this, new System.Uri("/Segator.Loms.Modules.Dispatcher.Silverlight;component/Silverlight/Quotations/Quo" +
                 "tationsView.xaml", System.UriKind.Relative));
     this.PageLoadEvent = ((System.Windows.Interactivity.InvokeCommandAction)(this.FindName("PageLoadEvent")));
     this.LayoutRoot = ((System.Windows.Controls.Border)(this.FindName("LayoutRoot")));
     this.panelHost = ((DragDockControl.DragDockPanelHost)(this.FindName("panelHost")));
     this.drackDockPanelPending = ((DragDockControl.DragDockPanel)(this.FindName("drackDockPanelPending")));
     this.PendingBookings = ((Segator.Loms.Modules.Dispatcher.Silverlight.Quotations.BookingControls.BookingControl)(this.FindName("PendingBookings")));
     this.drackDockPanelProcessing = ((DragDockControl.DragDockPanel)(this.FindName("drackDockPanelProcessing")));
     this.ProcessingBookings = ((Segator.Loms.Modules.Dispatcher.Silverlight.Quotations.BookingControls.BookingControl)(this.FindName("ProcessingBookings")));
     this.drackDockPanelReceived = ((DragDockControl.DragDockPanel)(this.FindName("drackDockPanelReceived")));
     this.ReceivedBookings = ((Segator.Loms.Modules.Dispatcher.Silverlight.Quotations.BookingControls.BookingControl)(this.FindName("ReceivedBookings")));
     this.drackDockPanelSent = ((DragDockControl.DragDockPanel)(this.FindName("drackDockPanelSent")));
     this.SentBookings = ((Segator.Loms.Modules.Dispatcher.Silverlight.Quotations.BookingControls.BookingControl)(this.FindName("SentBookings")));
     this.drackDockPanelHistory = ((DragDockControl.DragDockPanel)(this.FindName("drackDockPanelHistory")));
     this.HistoryBookings = ((Segator.Loms.Modules.Dispatcher.Silverlight.Quotations.BookingControls.BookingControl)(this.FindName("HistoryBookings")));
     this.btnCancelQuote = ((System.Windows.Controls.Button)(this.FindName("btnCancelQuote")));
     this.btnQuoteControl = ((System.Windows.Controls.Button)(this.FindName("btnQuoteControl")));
 }