Esempio n. 1
0
 private void DemoWindow_Unloaded(object sender, RoutedEventArgs e)
 {
     if (_wnd != null)
     {
         _wnd.Close();
         _wnd = null;
     }
 }
Esempio n. 2
0
 private void CreateWindow_Click(object sender, RoutedEventArgs e)
 {
     _wnd         = new C1Window();
     _wnd.Header  = "This is the header.";
     _wnd.Height  = 300;
     _wnd.Width   = 300;
     _wnd.Content = new WindowContent();
     _wnd.CenterOnScreen();
     _wnd.Show();
 }
        private void btnExportStyle_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                string style = string.Format(@"<Style x:Key=""MyGridStyle"" TargetType=""c1dg:C1DataGrid"">
    <Setter Property=""Background"" Value=""{0}""/>
    <Setter Property=""BorderBrush"" Value=""{1}""/>
    <Setter Property=""HorizontalGridLinesBrush"" Value=""{2}""/>
    <Setter Property=""MouseOverBrush"" Value=""{3}""/>
    <Setter Property=""PressedBrush"" Value=""{11}""/>
    <Setter Property=""RowBackground"" Value=""{4}""/>
    <Setter Property=""AlternatingRowBackground"" Value=""{5}""/>
    <Setter Property=""SelectedBackground"" Value=""{6}""/>
    <Setter Property=""VerticalGridLinesBrush"" Value=""{7}""/>
    <Setter Property=""Foreground"" Value=""{8}""/>
    <Setter Property=""RowForeground"" Value=""{9}""/>
    <Setter Property=""AlternatingRowForeground"" Value=""{10}""/>
    <Setter Property=""ValidationBackground"" Value=""{12}""/>
    <Setter Property=""ValidationForeground"" Value=""{13}""/>
    <Setter Property=""HeaderBackground"" Value=""{14}""/>
    <Setter Property=""HeaderForeground"" Value=""{15}""/>
    <Setter Property=""GroupingPanelBackground"" Value=""{16}""/>
    <Setter Property=""GroupingPanelForeground"" Value=""{17}""/>
</Style>",
                                             (grid.Background as SolidColorBrush).Color,
                                             (grid.BorderBrush as SolidColorBrush).Color,
                                             (grid.HorizontalGridLinesBrush as SolidColorBrush).Color,
                                             (grid.MouseOverBrush as SolidColorBrush).Color,
                                             (grid.RowBackground as SolidColorBrush).Color,
                                             (grid.AlternatingRowBackground as SolidColorBrush).Color,
                                             (grid.SelectedBackground as SolidColorBrush).Color,
                                             (grid.VerticalGridLinesBrush as SolidColorBrush).Color,
                                             (grid.Foreground as SolidColorBrush).Color,
                                             (grid.RowForeground as SolidColorBrush).Color,
                                             (grid.AlternatingRowForeground as SolidColorBrush).Color,
                                             (grid.PressedBrush as SolidColorBrush).Color,
                                             (grid.ValidationBackground as SolidColorBrush).Color,
                                             (grid.ValidationForeground as SolidColorBrush).Color,
                                             (grid.HeaderBackground as SolidColorBrush).Color,
                                             (grid.HeaderForeground as SolidColorBrush).Color,
                                             (grid.GroupingPanelBackground as SolidColorBrush).Color,
                                             (grid.GroupingPanelForeground as SolidColorBrush).Color);
                var window = new C1Window();
                window.Content = new System.Windows.Controls.TextBox()
                {
                    Text = style, FontSize = 16
                };
                window.ShowModal();
                window.CenterOnScreen();
            }
            catch
            {
            }
        }
 private void ShowWindow(bool showModal)
 {
     C1Window wnd = new C1Window();
     wnd.Header = "This is the header.";
     wnd.Height = 300;
     wnd.Width = 300;
     wnd.Content = new WindowContent();
     wnd.CenterOnScreen();
     if (showModal)
         wnd.ShowModal();
     else
         wnd.Show();
 }
        //------------------------------------------------------------
        #region ** modal spell-checking

        private void _btnModal_Click(object sender, RoutedEventArgs e)
        {
            // select control to spell-check
            object editor = null;

            switch (_cmbControl.SelectedIndex)
            {
            case 0:
                editor = _plainTextBox;
                break;

            case 1:
                editor = _richTextBox;
                break;

            case 2:
                editor = new DataGridSpellWrapper(_dataGrid);
                break;
            }

            // select type of modal dialog to use
            C1Window dialog = null;

            switch (_cmbDialog.SelectedIndex)
            {
            // C1SpellChecker built-in dialog
            case 0:
                dialog = new C1SpellDialog();
                break;

            // Customized C1SpellChecker built-in dialog
            case 1:
                dialog        = new C1SpellDialog();
                dialog.Header = "Customized Caption!";
                break;

            // Standard dialog
            case 2:
                dialog = new StandardSpellDialog();
                break;

            // Word-style dialog
            case 3:
                dialog = new WordSpellDialog();
                break;
            }

            // spell-check the control
            _c1SpellChecker.CheckControlAsync(editor, false, (ISpellDialog)dialog);
        }
Esempio n. 6
0
        private void btnPrintSettings_Click(object sender, RoutedEventArgs e)
        {
            // show editor in a dialog
            C1Window w = new C1Window();

            w.Header     = C1.WPF.Olap.Resources.Resources.DocumentOptions;
            w.FontFamily = FontFamily;
            w.FontSize   = FontSize;
            w.Content    = new C1OlapReportOptions(_reportOptions);
            w.Width      = 600;
            w.Height     = 350;
            w.CenterOnScreen();
            w.ModalBackground = new SolidColorBrush(Color.FromArgb(80, 80, 80, 80));
            w.ShowModal();
        }
 private void ShowImage(C1Window wnd, Image contImg, FrameworkElement lbl, string header)
 {
     if (lbl != null)
     {
         Image im = lbl.FindName("img") as Image;
         if (im != null)
         {
             contImg.Source = im.Source;
         }
         TextBlock tb = lbl.FindName("txt") as TextBlock;
         if (tb != null)
         {
             wnd.Header = header + tb.Text;
         }
     }
 }
        private void Border_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            Border   bdr = (Border)sender;
            C1Window wnd = new C1Window()
            {
                ShowMaximizeButton = false,
                ShowMinimizeButton = false,
                IsResizable        = false
            };
            Image contImg = new Image()
            {
                MaxWidth  = 400,
                MaxHeight = 400,
                Stretch   = Stretch.None
            };

            wnd.Content = contImg;
            ShowImage(wnd, contImg, bdr, "");
            wnd.ShowModal();

            // Find other images covered by the current images
            Point pt0 = e.GetPosition(bdr);

            Point pt = e.GetPosition(maps);
            Point pt1 = pt, pt2 = pt;

            pt1.X -= pt0.X;
            pt1.Y -= pt0.Y;
            pt2.X  = pt1.X + bdr.ActualWidth;
            pt2.Y  = pt1.Y + bdr.ActualWidth;

            pt1 = maps.ScreenToGeographic(pt1);
            pt2 = maps.ScreenToGeographic(pt2);

            Point min = new Point(Math.Min(pt1.X, pt2.X), Math.Min(pt1.Y, pt2.Y));
            Point max = new Point(Math.Max(pt1.X, pt2.X), Math.Max(pt1.Y, pt2.Y));

            List <C1VectorPlacemark> list = new List <C1VectorPlacemark>();

            foreach (C1VectorPlacemark pm in vl.Children)
            {
                if (pm.GeoPoint.X >= min.X && pm.GeoPoint.X <= max.X &&
                    pm.GeoPoint.Y >= min.Y && pm.GeoPoint.Y <= max.Y)
                {
                    list.Add(pm);
                }
            }

            // start "slideshow"
            if (list.Count > 1)
            {
                DispatcherTimer dp;
                int             tcnt = 0;

                dp = new DispatcherTimer()
                {
                    Interval = TimeSpan.FromSeconds(2)
                };
                dp.Tick += (se, ea) =>
                {
                    tcnt++;
                    if (tcnt >= list.Count)
                    {
                        tcnt = 0;
                    }

                    ShowImage(wnd, contImg, list[tcnt].LabelUI as FrameworkElement,
                              string.Format("{0}/{1} ", tcnt + 1, list.Count));
                };

                wnd.Closing += (s1, e1) =>
                {
                    dp.Stop();
                };

                dp.Start();
            }
        }
Esempio n. 9
0
 private void btnPrintSettings_Click(object sender, RoutedEventArgs e)
 {
     // show editor in a dialog
     C1Window w = new C1Window();
     w.Header = C1.WPF.Olap.Resources.Resources.DocumentOptions;
     w.FontFamily = FontFamily;
     w.FontSize = FontSize;
     w.Content = new C1OlapReportOptions(_reportOptions);
     w.Width = 600;
     w.Height = 350;
     w.CenterOnScreen();
     w.ModalBackground = new SolidColorBrush(Color.FromArgb(80, 80, 80, 80));
     w.ShowModal();
 }
 private void btnExportStyle_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         string style = string.Format(@"<Style x:Key=""MyGridStyle"" TargetType=""c1dg:C1DataGrid"">
     <Setter Property=""Background"" Value=""{0}""/>
     <Setter Property=""BorderBrush"" Value=""{1}""/>
     <Setter Property=""HorizontalGridLinesBrush"" Value=""{2}""/>
     <Setter Property=""MouseOverBrush"" Value=""{3}""/>
     <Setter Property=""PressedBrush"" Value=""{11}""/>
     <Setter Property=""RowBackground"" Value=""{4}""/>
     <Setter Property=""AlternatingRowBackground"" Value=""{5}""/>
     <Setter Property=""SelectedBackground"" Value=""{6}""/>
     <Setter Property=""VerticalGridLinesBrush"" Value=""{7}""/>
     <Setter Property=""Foreground"" Value=""{8}""/>
     <Setter Property=""RowForeground"" Value=""{9}""/>
     <Setter Property=""AlternatingRowForeground"" Value=""{10}""/>
     <Setter Property=""ValidationBackground"" Value=""{12}""/>
     <Setter Property=""ValidationForeground"" Value=""{13}""/>
     <Setter Property=""HeaderBackground"" Value=""{14}""/>
     <Setter Property=""HeaderForeground"" Value=""{15}""/>
     <Setter Property=""GroupingPanelBackground"" Value=""{16}""/>
     <Setter Property=""GroupingPanelForeground"" Value=""{17}""/>
     </Style>",
      (grid.Background as SolidColorBrush).Color,
      (grid.BorderBrush as SolidColorBrush).Color,
      (grid.HorizontalGridLinesBrush as SolidColorBrush).Color,
      (grid.MouseOverBrush as SolidColorBrush).Color,
      (grid.RowBackground as SolidColorBrush).Color,
      (grid.AlternatingRowBackground as SolidColorBrush).Color,
      (grid.SelectedBackground as SolidColorBrush).Color,
      (grid.VerticalGridLinesBrush as SolidColorBrush).Color,
      (grid.Foreground as SolidColorBrush).Color,
      (grid.RowForeground as SolidColorBrush).Color,
      (grid.AlternatingRowForeground as SolidColorBrush).Color,
      (grid.PressedBrush as SolidColorBrush).Color,
      (grid.ValidationBackground as SolidColorBrush).Color,
      (grid.ValidationForeground as SolidColorBrush).Color,
      (grid.HeaderBackground as SolidColorBrush).Color,
      (grid.HeaderForeground as SolidColorBrush).Color,
      (grid.GroupingPanelBackground as SolidColorBrush).Color,
      (grid.GroupingPanelForeground as SolidColorBrush).Color);
         var window = new C1Window();
         window.Content = new System.Windows.Controls.TextBox() { Text = style, FontSize = 16 };
         window.ShowModal();
         window.CenterOnScreen();
     }
     catch
     {
     }
 }
Esempio n. 11
0
        private void Border_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            Border bdr = (Border)sender;
              C1Window wnd = new C1Window()
              {
            ShowMaximizeButton = false,
            ShowMinimizeButton = false,
            IsResizable = false
              };
              Image contImg  = new Image()
              {
            MaxWidth = 400,
            MaxHeight = 400,
            Stretch = Stretch.None
              };
              wnd.Content = contImg;
              ShowImage(wnd, contImg, bdr, "");
              wnd.ShowModal();

              // Find other images covered by the current images
              Point pt0 = e.GetPosition(bdr);

              Point pt = e.GetPosition(maps);
              Point pt1 = pt, pt2 = pt;
              pt1.X -= pt0.X;
              pt1.Y -= pt0.Y;
              pt2.X = pt1.X + bdr.ActualWidth;
              pt2.Y = pt1.Y + bdr.ActualWidth;

              pt1 = maps.ScreenToGeographic(pt1);
              pt2 = maps.ScreenToGeographic(pt2);

              Point min = new Point(Math.Min(pt1.X, pt2.X), Math.Min(pt1.Y, pt2.Y));
              Point max = new Point(Math.Max(pt1.X, pt2.X), Math.Max(pt1.Y, pt2.Y));

              List<C1VectorPlacemark> list = new List<C1VectorPlacemark>();

              foreach (C1VectorPlacemark pm in vl.Children)
              {
            if (pm.GeoPoint.X >= min.X && pm.GeoPoint.X <= max.X &&
              pm.GeoPoint.Y >= min.Y && pm.GeoPoint.Y <= max.Y)
            {
              list.Add(pm);
            }
              }

              // start "slideshow"
              if (list.Count > 1)
              {
            DispatcherTimer dp;
            int tcnt = 0;

            dp = new DispatcherTimer() { Interval = TimeSpan.FromSeconds(2) };
            dp.Tick += (se, ea) =>
              {
            tcnt++;
            if( tcnt>= list.Count)
              tcnt = 0;

            ShowImage(wnd, contImg, list[tcnt].LabelUI as FrameworkElement,
              string.Format("{0}/{1} ", tcnt+1, list.Count));
              };

            wnd.Closing += (s1,e1) =>
              {
            dp.Stop();
              };

            dp.Start();
              }
        }
Esempio n. 12
0
 private void ShowImage(C1Window wnd, Image contImg, FrameworkElement lbl, string header)
 {
     if (lbl != null)
       {
     Image im = lbl.FindName("img") as Image;
     if (im != null)
       contImg.Source = im.Source;
     TextBlock tb = lbl.FindName("txt") as TextBlock;
     if (tb != null)
       wnd.Header = header + tb.Text;
       }
 }