コード例 #1
0
        private void C1MenuItem_Click(object sender, object e)
        {
            C1MenuItem menu = sender as C1MenuItem;

            if (SelectedItemChanged != null)
            {
                SelectedItemChanged(this, new EventArgs());
            }
        }
コード例 #2
0
 private void UpdateWindowMenuItem()
 {
     if (WindowMenuItem == null | docs == null)
     {
         return;
     }
     WindowMenuItem.Items.Clear();
     foreach (var item in docs.Items)
     {
         var tabItem  = (C1DockTabItem)item; // must be fresh each loop iteration because of the delegate
         var menuItem = new C1MenuItem();
         menuItem.Header = tabItem.Header;
         menuItem.Click += delegate
         {
             tabItem.IsSelected = true;
         };
         WindowMenuItem.Items.Add(menuItem);
     }
 }
コード例 #3
0
        private void dockControl_ViewChanged(object sender, EventArgs e)
        {
            var list = new List <C1MenuItem>();

            foreach (var nestedTabControl in dockControl.NestedItems)
            {
                var tabControl = nestedTabControl; // must be fresh each loop iteration because of the delegate
                if (tabControl == docs)
                {
                    continue;
                }
                foreach (var item in tabControl.Items)
                {
                    var tabItem  = (C1DockTabItem)item; // must be fresh each loop iteration because of the delegate
                    var menuItem = new C1MenuItem();
                    menuItem.Header = tabItem.Header;
                    menuItem.Click += delegate
                    {
                        switch (tabControl.DockMode)
                        {
                        case DockMode.Hidden:
                            tabControl.DockMode = DockMode.Docked;
                            break;

                        case DockMode.Sliding:
                            tabControl.SlideOpen();
                            break;
                        }
                        tabItem.IsSelected = true;
                    };
                    list.Add(menuItem);
                }
            }

            ViewMenuItem.Items.Clear();
            foreach (var menuItem in list.OrderBy(mi => mi.Header))
            {
                ViewMenuItem.Items.Add(menuItem);
            }
        }
コード例 #4
0
        private void dockControl_ViewChanged(object sender, EventArgs e)
        {
            var list = new List<C1MenuItem>();
            foreach (var nestedTabControl in dockControl.NestedItems)
            {
                var tabControl = nestedTabControl; // must be fresh each loop iteration because of the delegate
                if (tabControl == MainArea)
                    continue;
                foreach (var item in tabControl.Items)
                {
                    var tabItem = (C1DockTabItem)item; // must be fresh each loop iteration because of the delegate
                    var menuItem = new C1MenuItem();
                    menuItem.Header = tabItem.Header;
                    menuItem.Click += delegate
                    {
                        switch (tabControl.DockMode)
                        {
                            case DockMode.Hidden:
                                tabControl.DockMode = DockMode.Docked;
                                break;
                            case DockMode.Sliding:
                                tabControl.SlideOpen();
                                break;
                        }
                        tabItem.IsSelected = true;
                    };
                    list.Add(menuItem);
                }
            }

            ViewMenuItem.Items.Clear();
            foreach (var menuItem in list.OrderBy(mi => mi.Header))
            {
                ViewMenuItem.Items.Add(menuItem);
            }
        }
コード例 #5
0
 private void UpdateWindowMenuItem()
 {
     if (WindowMenuItem == null | MainArea == null)
         return;
     WindowMenuItem.Items.Clear();
     foreach (var item in MainArea.Items)
     {
         var tabItem = (C1DockTabItem)item; // must be fresh each loop iteration because of the delegate
         var menuItem = new C1MenuItem();
         menuItem.Header = tabItem.Header;
         menuItem.Click += delegate
         {
             tabItem.IsSelected = true;
         };
         WindowMenuItem.Items.Add(menuItem);
     }
 }
コード例 #6
0
        void MainPage_Loaded(object sender, RoutedEventArgs e)
        {
            // load data from embedded zip resource
            var ds = new DataSet();
            var asm = Assembly.GetExecutingAssembly();
            using (var s = asm.GetManifestResourceStream("CustomizePage.Resources.nwind.zip"))
            {
                var zip = new C1ZipFile(s);
                using (var zr = zip.Entries[0].OpenReader())
                {
                    // load data
                    ds.ReadXml(zr);
                }
            }

            // bind olap page to data
            _c1OlapPage.DataSource = ds.Tables[0].DefaultView;

            // view not found in storage, use default
            var olap = _c1OlapPage.OlapPanel.OlapEngine;
            olap.DataSource = ds.Tables[0].DefaultView;
            olap.BeginUpdate();
            olap.RowFields.Add("Country");
            olap.ColumnFields.Add("Category");
            olap.ValueFields.Add("Sales");
            olap.Fields["Sales"].Format = "n0";
            olap.EndUpdate();

            // get predefined views from XML resource
            var views = new Dictionary<string, string>();
            using (var s = asm.GetManifestResourceStream("CustomizePage.Resources.OlapViews.xml"))
            using (var reader = XmlReader.Create(s))
            {
                // read predefined view definitions
                while (reader.Read())
                {
                    if (reader.NodeType == XmlNodeType.Element && reader.Name == "C1OlapPage")
                    {
                        var id = reader.GetAttribute("id");
                        var def = reader.ReadOuterXml();
                        views[id] = def;
                    }
                }
            }

            // build new menu with predefined views
            var menuViews = new C1MenuItem();
            menuViews.Header = "View";
            menuViews.Icon = GetImage("Resources/views.png");
            menuViews.VerticalAlignment = VerticalAlignment.Center;
            ToolTipService.SetToolTip(menuViews, "Select a predefined Olap view.");
            foreach (var id in views.Keys)
            {
                var mi = new C1MenuItem();
                mi.Header = id;
                mi.Tag = views[id];
                mi.Click += mi_Click;
                menuViews.Items.Add(mi);
            }

            // add new menu to the page's main menu
            _c1OlapPage.MainMenu.Items.Insert(6, menuViews);
        }
コード例 #7
0
 private void C1MenuItem_Click(object sender, SourcedEventArgs e)
 {
     C1MenuItem menu = sender as C1MenuItem;
 }
コード例 #8
0
        private void Init()
        {
            _lsAttachmentGroup = new List <CustomButton> {
                cbAbsolute, cbDataCoordinate, cbRelative
            };

            _lsAnnotationGroup = new List <CustomButton> {
                cbText, cbCircle, cbEllipse, cbRectangle, cbSquare, cbLine, cbPolygon
            };

            tbTitle.Text = Localizer.GetItem("introduction", "title");

            ToolTipService.SetToolTip(cbAbsolute, Localizer.GetItem("Absolute", "description"));
            ToolTipService.SetPlacement(cbAbsolute, Windows.UI.Xaml.Controls.Primitives.PlacementMode.Bottom);
            ToolTipService.SetToolTip(cbRelative, Localizer.GetItem("Relative", "description"));
            ToolTipService.SetPlacement(cbRelative, Windows.UI.Xaml.Controls.Primitives.PlacementMode.Bottom);
            ToolTipService.SetToolTip(cbDataCoordinate, Localizer.GetItem("DataCoordinate", "description"));
            ToolTipService.SetPlacement(cbDataCoordinate, Windows.UI.Xaml.Controls.Primitives.PlacementMode.Bottom);
            ToolTipService.SetToolTip(cbAllowMove, Localizer.GetItem("allowMove", "description"));
            ToolTipService.SetPlacement(cbAllowMove, Windows.UI.Xaml.Controls.Primitives.PlacementMode.Bottom);
            ToolTipService.SetToolTip(cbText, Localizer.GetItem("textAnno", "description"));
            ToolTipService.SetPlacement(cbText, Windows.UI.Xaml.Controls.Primitives.PlacementMode.Bottom);
            ToolTipService.SetToolTip(cbLine, Localizer.GetItem("lineAnno", "description"));
            ToolTipService.SetPlacement(cbLine, Windows.UI.Xaml.Controls.Primitives.PlacementMode.Bottom);
            ToolTipService.SetToolTip(cbCircle, Localizer.GetItem("circleAnno", "description"));
            ToolTipService.SetPlacement(cbCircle, Windows.UI.Xaml.Controls.Primitives.PlacementMode.Bottom);
            ToolTipService.SetToolTip(cbEllipse, Localizer.GetItem("ellipseAnno", "description"));
            ToolTipService.SetPlacement(cbEllipse, Windows.UI.Xaml.Controls.Primitives.PlacementMode.Bottom);
            ToolTipService.SetToolTip(cbRectangle, Localizer.GetItem("rectAnno", "description"));
            ToolTipService.SetPlacement(cbRectangle, Windows.UI.Xaml.Controls.Primitives.PlacementMode.Bottom);
            ToolTipService.SetToolTip(cbSquare, Localizer.GetItem("squareAnno", "description"));
            ToolTipService.SetPlacement(cbSquare, Windows.UI.Xaml.Controls.Primitives.PlacementMode.Bottom);
            ToolTipService.SetToolTip(cbPolygon, Localizer.GetItem("polygonAnno", "description"));
            ToolTipService.SetPlacement(cbPolygon, Windows.UI.Xaml.Controls.Primitives.PlacementMode.Bottom);

            cbAbsolute.Tag       = AnnotationAttachment.Absolute;
            cbRelative.Tag       = AnnotationAttachment.Relative;
            cbDataCoordinate.Tag = AnnotationAttachment.DataCoordinate;
            cbAllowMove.Tag      = "AllowMove";
            cbText.Tag           = "Text";
            cbLine.Tag           = "Line";
            cbCircle.Tag         = "Circle";
            cbEllipse.Tag        = "Ellipse";
            cbRectangle.Tag      = "Rectangle";
            cbSquare.Tag         = "Square";
            cbPolygon.Tag        = "Polygon";

            txtDescription.Text = Localizer.GetItem("introduction", "description");

            InitChart();

            _flexChartContextMenu = new C1ContextMenu()
            {
                Background = new SolidColorBrush(Colors.DarkGray)
            };
            C1MenuItem item = new C1MenuItem();

            Windows.UI.Xaml.Controls.Image img = new Windows.UI.Xaml.Controls.Image();
            string url = "ms-appx:///Resources/cross.png";

            img.Source = new BitmapImage()
            {
                UriSource = new Uri(url)
            };                                                            //RandomAccessStreamReference.CreateFromUri(new Uri(url));

            item.Icon = new BitmapIcon()
            {
                UriSource = new Uri(url)
            };
            item.HeaderBackground = new SolidColorBrush(Colors.DarkGray);
            item.Header           = "Delete";
            _flexChartContextMenu.Items.Add(item);

            _flexChartContextMenu.ItemClick += _flexChartContextMenu_ItemClick;

            cbAbsolute.Checked  = true;
            cbAllowMove.Checked = true;
        }
コード例 #9
0
        void OlapDemo_Loaded(object sender, RoutedEventArgs e)
        {
            // load data from embedded zip resource
            var ds  = new DataSet();
            var asm = Assembly.GetExecutingAssembly();

            using (var s = asm.GetManifestResourceStream("OlapSamples.Resources.nwind.zip"))
            {
                var zip = new C1ZipFile(s);
                using (var zr = zip.Entries[0].OpenReader())
                {
                    // load data
                    ds.ReadXml(zr);
                }
            }

            // bind olap page to data
            olapPage.DataSource = ds.Tables[0].DefaultView;

            // view not found in storage, use default
            var olap = olapPage.OlapPanel.OlapEngine;

            olap.DataSource = ds.Tables[0].DefaultView;

            // set value field limit to 4 (**default is 1)
            olap.ValueFields.MaxItems = 4;

            // create conditional formatting
            olap.Fields["ExtendedPrice"].StyleHigh.ForeColor     = Colors.Green;
            olap.Fields["ExtendedPrice"].StyleHigh.ConditionType = C1.Olap.ConditionType.Percentage;
            olap.Fields["ExtendedPrice"].StyleHigh.Value         = 0.8;
            olap.Fields["ExtendedPrice"].StyleLow.ForeColor      = Colors.Red;
            olap.Fields["ExtendedPrice"].StyleLow.ConditionType  = C1.Olap.ConditionType.Percentage;
            olap.Fields["ExtendedPrice"].StyleLow.Value          = 0.1;

            // apply update to view
            olap.BeginUpdate();
            olap.Fields["ExtendedPrice"].Caption = "Sales";
            olap.RowFields.Add("Country");
            olap.ColumnFields.Add("Salesperson");
            olap.ValueFields.Add("ExtendedPrice");
            olap.Fields["ExtendedPrice"].Format = "c0";
            olap.EndUpdate();

            // get predefined views from XML resource
            var views = new Dictionary <string, string>();

            using (var s = asm.GetManifestResourceStream("OlapSamples.Resources.OlapViews.xml"))
                using (var reader = XmlReader.Create(s))
                {
                    // read predefined view definitions
                    while (reader.Read())
                    {
                        if (reader.NodeType == XmlNodeType.Element && reader.Name == "C1OlapPage")
                        {
                            var id  = reader.GetAttribute("id");
                            var def = reader.ReadOuterXml();
                            views[id] = def;
                        }
                    }
                }

            // build new menu with predefined views
            var menuViews = new C1MenuItem();

            menuViews.Header            = "Views";
            menuViews.Icon              = GetImage("/Resources/Views.png");
            menuViews.VerticalAlignment = VerticalAlignment.Center;
            ToolTipService.SetToolTip(menuViews, "Select a predefined Olap view.");
            foreach (var id in views.Keys)
            {
                var mi = new C1MenuItem();
                mi.Header  = id;
                mi.Padding = new Thickness(5);
                mi.Tag     = views[id];
                mi.Click  += mi_Click;
                menuViews.Items.Add(mi);
            }

            // add new menu to the page's main menu
            olapPage.MainMenu.Items.Insert(6, menuViews);
        }
コード例 #10
0
        void OlapDemo_Loaded(object sender, RoutedEventArgs e)
        {
            // load data from embedded zip resource
            var ds = new DataSet();
            var asm = Assembly.GetExecutingAssembly();
            using (var s = asm.GetManifestResourceStream("OlapSamples.Resources.nwind.zip"))
            {
                var zip = new C1ZipFile(s);
                using (var zr = zip.Entries[0].OpenReader())
                {
                    // load data
                    ds.ReadXml(zr);
                }
            }

            // bind olap page to data
            olapPage.DataSource = ds.Tables[0].DefaultView;

            // view not found in storage, use default
            var olap = olapPage.OlapPanel.OlapEngine;
            olap.DataSource = ds.Tables[0].DefaultView;

            // set value field limit to 4 (**default is 1)
            olap.ValueFields.MaxItems = 4;

            // create conditional formatting
            olap.Fields["ExtendedPrice"].StyleHigh.ForeColor = Colors.Green;
            olap.Fields["ExtendedPrice"].StyleHigh.ConditionType = C1.Olap.ConditionType.Percentage;
            olap.Fields["ExtendedPrice"].StyleHigh.Value = 0.8;
            olap.Fields["ExtendedPrice"].StyleLow.ForeColor = Colors.Red;
            olap.Fields["ExtendedPrice"].StyleLow.ConditionType = C1.Olap.ConditionType.Percentage;
            olap.Fields["ExtendedPrice"].StyleLow.Value = 0.1;

            // apply update to view
            olap.BeginUpdate();
            olap.Fields["ExtendedPrice"].Caption = "Sales";
            olap.RowFields.Add("Country");
            olap.ColumnFields.Add("Salesperson");
            olap.ValueFields.Add("ExtendedPrice");
            olap.Fields["ExtendedPrice"].Format = "c0";
            olap.EndUpdate();

            // get predefined views from XML resource
            var views = new Dictionary<string, string>();
            using (var s = asm.GetManifestResourceStream("OlapSamples.Resources.OlapViews.xml"))
            using (var reader = XmlReader.Create(s))
            {
                // read predefined view definitions
                while (reader.Read())
                {
                    if (reader.NodeType == XmlNodeType.Element && reader.Name == "C1OlapPage")
                    {
                        var id = reader.GetAttribute("id");
                        var def = reader.ReadOuterXml();
                        views[id] = def;
                    }
                }
            }

            // build new menu with predefined views
            var menuViews = new C1MenuItem();
            menuViews.Header = "Views";
            menuViews.Icon = GetImage("/Resources/Views.png");
            menuViews.VerticalAlignment = VerticalAlignment.Center;
            ToolTipService.SetToolTip(menuViews, "Select a predefined Olap view.");
            foreach (var id in views.Keys)
            {
                var mi = new C1MenuItem();
                mi.Header = id;
                mi.Padding = new Thickness(5);
                mi.Tag = views[id];
                mi.Click += mi_Click;
                menuViews.Items.Add(mi);
            }

            // add new menu to the page's main menu
            olapPage.MainMenu.Items.Insert(6, menuViews);
        }
コード例 #11
0
        void MainPage_Loaded(object sender, RoutedEventArgs e)
        {
            // load data from embedded zip resource
            var ds  = new DataSet();
            var asm = Assembly.GetExecutingAssembly();

            using (var s = asm.GetManifestResourceStream("CustomizePage.Resources.nwind.zip"))
            {
                var zip = new C1ZipFile(s);
                using (var zr = zip.Entries[0].OpenReader())
                {
                    // load data
                    ds.ReadXml(zr);
                }
            }

            // bind olap page to data
            _c1OlapPage.DataSource = ds.Tables[0].DefaultView;

            // view not found in storage, use default
            var olap = _c1OlapPage.OlapPanel.OlapEngine;

            olap.DataSource = ds.Tables[0].DefaultView;
            olap.BeginUpdate();
            olap.RowFields.Add("Country");
            olap.ColumnFields.Add("Category");
            olap.ValueFields.Add("Sales");
            olap.Fields["Sales"].Format = "n0";
            olap.EndUpdate();

            // get predefined views from XML resource
            var views = new Dictionary <string, string>();

            using (var s = asm.GetManifestResourceStream("CustomizePage.Resources.OlapViews.xml"))
                using (var reader = XmlReader.Create(s))
                {
                    // read predefined view definitions
                    while (reader.Read())
                    {
                        if (reader.NodeType == XmlNodeType.Element && reader.Name == "C1OlapPage")
                        {
                            var id  = reader.GetAttribute("id");
                            var def = reader.ReadOuterXml();
                            views[id] = def;
                        }
                    }
                }

            // build new menu with predefined views
            var menuViews = new C1MenuItem();

            menuViews.Header            = "View";
            menuViews.Icon              = GetImage("Resources/views.png");
            menuViews.VerticalAlignment = VerticalAlignment.Center;
            ToolTipService.SetToolTip(menuViews, "Select a predefined Olap view.");
            foreach (var id in views.Keys)
            {
                var mi = new C1MenuItem();
                mi.Header = id;
                mi.Tag    = views[id];
                mi.Click += mi_Click;
                menuViews.Items.Add(mi);
            }

            // add new menu to the page's main menu
            _c1OlapPage.MainMenu.Items.Insert(6, menuViews);

            _c1OlapPage.Updated += c1OlapPage1_Updated;

            // add collapseall menu to page's main menu
            collapseAllView.Header            = "CollapseAll";
            collapseAllView.Icon              = GetImage("Resources/collapseAll.png");
            collapseAllView.VerticalAlignment = VerticalAlignment.Center;
            ToolTipService.SetToolTip(collapseAllView, "Collapse all the subtotals rows and columns.");
            collapseAllView.Click += collapseAllView_Click;
            _c1OlapPage.MainMenu.Items.Insert(11, collapseAllView);
        }