Exemplo n.º 1
0
        /// <summary>Updates location offset.</summary>
        private void _UpdateLocationOffset()
        {
            WndMain wndMain = (WndMain)App.Current.MainWindow;

            _offsetX = this.Left - wndMain.Left;
            _offsetY = this.Top - wndMain.Top;
        }
Exemplo n.º 2
0
        /// <summary>Updates location offset.</summary>
        public void FollowMain()
        {
            WndMain wndMain = (WndMain)App.Current.MainWindow;

            this.Left = wndMain.Left + _offsetX;
            this.Top  = wndMain.Top + _offsetY;
        }
Exemplo n.º 3
0
        /// <summary>Constructor.</summary>
        /// <param name="title">Menu title.</param>
        /// <param name="mouseBtnEvtHandler">ex. new MouseButtonEventHandler(wndMain.infoItem_Click)</param>
        public MenuItemPanel(string title, MouseButtonEventHandler mouseBtnEvtHandler)
        {
            InitializeComponent();

            _bgBrushOn         = new SolidColorBrush(Color.FromArgb(255, 145, 255, 251));
            _bgBrushOn.Opacity = 0.5;

            _bgBrushOff         = new SolidColorBrush(Colors.Black);
            _bgBrushOff.Opacity = 0.25;

            _borderBrushSel         = new SolidColorBrush(Colors.Lime);
            _borderBrushSel.Opacity = 0.8;

            HorizontalAlignment = HorizontalAlignment.Stretch;

            txbMenuItem.Text = title;

            WndMain wndMain = (WndMain)App.Current.MainWindow;

            MouseDown  += mouseBtnEvtHandler;
            MouseEnter += new MouseEventHandler(flowDoc_MouseEnter);
            MouseLeave += new MouseEventHandler(flowDoc_MouseLeave);

            Cursor      = Cursors.Hand;
            ForceCursor = true;
            Background  = _bgBrushOff;
            Height      = 50;
        }
Exemplo n.º 4
0
        /// <summary>Closing event handler.</summary>
        /// <param name="sender">Sender Object.</param>
        /// <param name="e">Event parameters.</param>
        private void wndWing_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            WndMain wndMain = (WndMain)App.Current.MainWindow;

            wndMain.NaviConfig.WingWidth  = Width;
            wndMain.NaviConfig.WingHeight = Height;

            if (_infoItemPanel != null)
            {
                //_infoItemPanel.SetSelected(false);
                _infoItemPanel = null;
            }
        }
Exemplo n.º 5
0
        /// <summary>Constructor.</summary>
        /// <param name="item">Information Item related to this panel.</param>
        public InfoItemPanel_B(InfoItem item)
        {
            InitializeComponent();

            _bgBrushOn         = new SolidColorBrush(Color.FromArgb(255, 145, 255, 251));
            _bgBrushOn.Opacity = 0.5;

            _bgBrushOff         = new SolidColorBrush(Colors.Black);
            _bgBrushOff.Opacity = 0.25;

            _borderBrushSel         = new SolidColorBrush(Colors.Lime);
            _borderBrushSel.Opacity = 0.8;

            _item = item;
            HorizontalAlignment = HorizontalAlignment.Stretch;

            if (item.Images != null && item.Images.Length > 0)
            {
//              imgThumb.Source = WpfUtil.LoadImage(item.Images[0]);
            }
            else
            {
                GridLengthConverter gridConv = new GridLengthConverter();
                GridLength          imgWidth = (GridLength)gridConv.ConvertFromString("0px");
                colImg.Width = imgWidth;
            }
            txbItem.Text = item.SrcTitle + "\n" + item.Title;
            if (item.IsRead)
            {
                txbItem.Foreground = Brushes.White;
            }
            else
            {
                txbItem.Foreground = Brushes.Yellow;
            }

            WndMain wndMain = (WndMain)App.Current.MainWindow;

            MouseDown  += new MouseButtonEventHandler(wndMain.infoItem_Click);
            MouseEnter += new MouseEventHandler(flowDoc_MouseEnter);
            MouseLeave += new MouseEventHandler(flowDoc_MouseLeave);

            Cursor      = Cursors.Hand;
            ForceCursor = true;
            Background  = _bgBrushOff;
            Height      = 50;
        }
Exemplo n.º 6
0
        /// <summary>Click event handler of the Delete button.</summary>
        /// <param name="sender">Sender Object.</param>
        /// <param name="e">Event parameters.</param>
        private void btnDelete_Click(object sender, RoutedEventArgs e)
        {
            InfoItem item = _infoItemPanel.GetInfoItem();

            System.Windows.Forms.DialogResult ret =
                System.Windows.Forms.MessageBox.Show(
                    "\"" + item.Title + "\"" + Properties.Resources.CONFIRM_DELETE,
                    App.Current.MainWindow.Title,
                    System.Windows.Forms.MessageBoxButtons.OKCancel,
                    System.Windows.Forms.MessageBoxIcon.Question
                    );
            if (ret == System.Windows.Forms.DialogResult.OK)
            {
                WndMain wndMain = (WndMain)App.Current.MainWindow;
                wndMain.RemoveFeedChild(item);
                wndMain.InfoManager.RemoveItems(new int[1] {
                    item.Id
                });
                Close();
            }
        }
Exemplo n.º 7
0
        /// <summary>Constructor.</summary>
        /// <param name="item">Information Item related to this panel.</param>
        public InfoItemPanel_A(InfoItem item)
        {
            InitializeComponent();

            _bgBrushOn         = new SolidColorBrush(Color.FromArgb(255, 145, 255, 251));
            _bgBrushOn.Opacity = 0.5;

            _bgBrushOff         = new SolidColorBrush(Colors.Black);
            _bgBrushOff.Opacity = 0.25;

            _borderBrushSel         = new SolidColorBrush(Colors.Lime);
            _borderBrushSel.Opacity = 0.8;

            _item = item;
            HorizontalAlignment = HorizontalAlignment.Stretch;

            if (item.Images != null && item.Images.Length > 0)
            {
//              imgThumb.Source = WpfUtil.LoadImage(item.Images[0]);
            }
            else
            {
                GridLengthConverter gridConv = new GridLengthConverter();
                GridLength          imgWidth = (GridLength)gridConv.ConvertFromString("0px");
                colImg.Width = imgWidth;
            }
            txbItem.Text = item.SrcTitle + "\n" + item.Title;
            if (item.IsRead)
            {
                txbItem.Foreground = Brushes.White;
            }
            else
            {
                txbItem.Foreground = Brushes.Yellow;
            }

            WndMain wndMain = (WndMain)App.Current.MainWindow;

            MouseDown  += new MouseButtonEventHandler(wndMain.infoItem_Click);
            MouseEnter += new MouseEventHandler(flowDoc_MouseEnter);
            MouseLeave += new MouseEventHandler(flowDoc_MouseLeave);

            Cursor      = Cursors.Hand;
            ForceCursor = true;
            Background  = _bgBrushOff;
            Height      = 50;

/*
 *          Orientation = Orientation.Horizontal;
 *          Cursor = Cursors.Hand;
 *          ForceCursor = true;
 *          Background = _bgBrushOff;
 *          Height = 50;
 *          CanVerticallyScroll = false;
 *
 *          if (item.Images != null && item.Images.Length > 0)
 *          {
 *              Image image = new Image();
 *              image.Source = CommonUtil.LoadImage(item.Images[0]);
 *              image.Width = 45;
 *              image.Height = 35;
 *              image.HorizontalAlignment = HorizontalAlignment.Left;
 *              image.VerticalAlignment = VerticalAlignment.Center;
 *              Children.Add(image);
 *          }
 *
 *          WndMain wndMain = (WndMain)App.Current.MainWindow;
 *
 *          HorizontalAlignment = HorizontalAlignment.Stretch;
 *
 *          _txbContent = new TextBox();
 *          _txbContent.HorizontalAlignment = HorizontalAlignment.Stretch;
 *          _txbContent.TextWrapping = TextWrapping.Wrap;
 *          _txbContent.Text = item.SrcTitle + "\n" + item.Title;
 *          _txbContent.Background = Brushes.Transparent;
 *          _txbContent.BorderBrush = Brushes.Transparent;
 *          _txbContent.Foreground = Brushes.White;
 *          _txbContent.Focusable = false;
 *          _txbContent.FontSize = 12;
 *          Children.Add(_txbContent);
 *
 *          MouseDown += new MouseButtonEventHandler(wndMain.infoItem_Click);
 *          MouseEnter += new MouseEventHandler(flowDoc_MouseEnter);
 *          MouseLeave += new MouseEventHandler(flowDoc_MouseLeave);
 */
/*
 *          Table table = new Table();
 *          table.Padding = new Thickness(0.0, 2.5, 0.0, 2.5);
 *
 *          table.RowGroups.Add(new TableRowGroup());
 *          table.RowGroups[0].Rows.Add(new TableRow());
 *          table.RowGroups[0].Rows.Add(new TableRow());
 *
 *          Paragraph titlePara = new Paragraph(new Run(item.Title));
 *          Paragraph descPara = new Paragraph(new Run(item.Description));
 *
 *          if (item.Images != null && item.Images.Length > 0)
 *          {
 *              Image image = new Image();
 *              image.Source = CommonUtil.LoadImage(item.Images[0]);
 *              image.Width = 45;
 *              image.Height = 35;
 *              image.HorizontalAlignment = HorizontalAlignment.Left;
 *              image.VerticalAlignment = VerticalAlignment.Top;
 *              //image.Stretch = Stretch.Fill;
 *              //image.StretchDirection = StretchDirection.Both;
 *
 *              BlockUIContainer imgBlock = new BlockUIContainer(image);
 *              Figure imgFig = new Figure(imgBlock);
 *              imgFig.Width = new FigureLength(50);
 *              imgFig.Height = new FigureLength(40);
 *              imgFig.Padding = new Thickness(0.0);
 *              imgFig.Margin = new Thickness(0.0);
 *              Paragraph imgPara = new Paragraph(imgFig);
 *
 *              GridLengthConverter gridConv = new GridLengthConverter();
 *              GridLength glImage = (GridLength)gridConv.ConvertFromString("50px");
 *              TableColumn imageCol = new TableColumn();
 *              imageCol.Width = glImage;
 *
 *              table.Columns.Add(imageCol);   // Image
 *              table.Columns.Add(new TableColumn());   // Title / Description
 *
 *              TableCell imageCell = new TableCell(imgPara);
 *              imageCell.RowSpan = 2;
 *              table.RowGroups[0].Rows[0].Cells.Add(imageCell);
 *              table.RowGroups[0].Rows[0].Cells.Add(new TableCell(titlePara));
 *              table.RowGroups[0].Rows[1].Cells.Add(new TableCell(descPara));
 *          }
 *          else
 *          {
 *              table.Columns.Add(new TableColumn());   // Title / Description
 *
 *              table.RowGroups[0].Rows[0].Cells.Add(new TableCell(titlePara));
 *              table.RowGroups[0].Rows[1].Cells.Add(new TableCell(descPara));
 *          }
 *
 *          FlowDocument flowDoc = new FlowDocument(table);
 *          flowDoc.PagePadding = new Thickness(5.0, 5.0, 5.0, 5.0);
 *          flowDoc.FontSize = 10.0;
 *          if (_item.IsRead)
 *              flowDoc.Foreground = Brushes.White;
 *          else
 *              flowDoc.Foreground = Brushes.Yellow;
 *          flowDoc.Background = _bgBrushOff;
 *
 *          Cursor = Cursors.Hand;
 *          ForceCursor = true;
 *          Height = 50;
 *          Document = flowDoc;
 *          VerticalScrollBarVisibility = ScrollBarVisibility.Hidden;
 *
 *          WndMain wndMain = (WndMain)App.Current.MainWindow;
 *          flowDoc.MouseDown += new MouseButtonEventHandler(wndMain.infoItem_Click);
 *          flowDoc.MouseEnter += new MouseEventHandler(flowDoc_MouseEnter);
 *          flowDoc.MouseLeave += new MouseEventHandler(flowDoc_MouseLeave);
 */
        }
Exemplo n.º 8
0
        /// <summary>Closed event handler.</summary>
        /// <param name="sender">Sender Object.</param>
        /// <param name="e">Event parameters.</param>
        private void wndWing_Closed(object sender, EventArgs e)
        {
            WndMain wndMain = (WndMain)App.Current.MainWindow;

            wndMain.ClearWndWind();
        }