예제 #1
0
        public void ContextMenuStrip_HydraulicBoundaryDatabaseNotLinked_ContextMenuItemValidateAllDisabledAndTooltipSet()
        {
            // Setup
            var failureMechanism = new GrassCoverErosionInwardsFailureMechanism();

            failureMechanism.CalculationsGroup.Children.Add(new GrassCoverErosionInwardsCalculation());

            IAssessmentSection assessmentSection = AssessmentSectionTestHelper.CreateAssessmentSectionStub(mocksRepository);

            var nodeData    = new GrassCoverErosionInwardsFailureMechanismContext(failureMechanism, assessmentSection);
            var menuBuilder = new CustomItemsOnlyContextMenuBuilder();

            using (var treeViewControl = new TreeViewControl())
            {
                var gui = mocksRepository.Stub <IGui>();
                gui.Stub(g => g.Get(nodeData, treeViewControl)).Return(menuBuilder);
                gui.Stub(g => g.MainWindow).Return(mocksRepository.Stub <IMainWindow>());
                mocksRepository.ReplayAll();

                plugin.Gui = gui;

                // Call
                using (ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, null, treeViewControl))
                {
                    // Assert
                    TestHelper.AssertContextMenuStripContainsItem(contextMenu, contextMenuValidateAllIndex,
                                                                  "Alles &valideren",
                                                                  "Er is geen hydraulische belastingendatabase geïmporteerd.",
                                                                  RiskeerCommonFormsResources.ValidateAllIcon,
                                                                  false);
                }
            }
        }
        public void GivenCalculationWithOutput_WhenClearingOutputFromContextMenu_ThenCalculationOutputClearedAndNotified(bool confirm)
        {
            // Given
            using (var treeViewControl = new TreeViewControl())
            {
                var calculation       = new MacroStabilityInwardsCalculationScenario();
                var failureMechanism  = new MacroStabilityInwardsFailureMechanism();
                var assessmentSection = mocks.Stub <IAssessmentSection>();

                var calculationContext = new MacroStabilityInwardsCalculationScenarioContext(calculation,
                                                                                             new CalculationGroup(),
                                                                                             Enumerable.Empty <MacroStabilityInwardsSurfaceLine>(),
                                                                                             Enumerable.Empty <MacroStabilityInwardsStochasticSoilModel>(),
                                                                                             failureMechanism,
                                                                                             assessmentSection);

                var gui = mocks.Stub <IGui>();
                gui.Stub(cmp => cmp.Get(calculationContext, treeViewControl)).Return(new CustomItemsOnlyContextMenuBuilder());

                var observer = mocks.StrictMock <IObserver>();
                if (confirm)
                {
                    observer.Expect(o => o.UpdateObserver());
                }

                mocks.ReplayAll();

                plugin.Gui = gui;

                calculation.Output = MacroStabilityInwardsOutputTestFactory.CreateOutput();
                calculation.Attach(observer);

                string messageBoxText = null, messageBoxTitle = null;
                DialogBoxHandler = (name, wnd) =>
                {
                    var messageBox = new MessageBoxTester(wnd);
                    messageBoxText  = messageBox.Text;
                    messageBoxTitle = messageBox.Title;
                    if (confirm)
                    {
                        messageBox.ClickOk();
                    }
                    else
                    {
                        messageBox.ClickCancel();
                    }
                };

                using (ContextMenuStrip contextMenuStrip = info.ContextMenuStrip(calculationContext, null, treeViewControl))
                {
                    // When
                    contextMenuStrip.Items[contextMenuClearIndex].PerformClick();

                    // Then
                    Assert.AreNotEqual(confirm, calculation.HasOutput);
                    Assert.AreEqual("Bevestigen", messageBoxTitle);
                    Assert.AreEqual("Weet u zeker dat u de uitvoer van deze berekening wilt wissen?", messageBoxText);
                }
            }
        }
예제 #3
0
        public void ContextMenuStrip_Always_CallsBuilder()
        {
            // Setup
            using (var treeViewControl = new TreeViewControl())
            {
                var context = new GrassCoverErosionInwardsScenariosContext(new CalculationGroup(), new GrassCoverErosionInwardsFailureMechanism());

                var mocks       = new MockRepository();
                var menuBuilder = mocks.StrictMock <IContextMenuBuilder>();
                menuBuilder.Expect(mb => mb.AddOpenItem()).Return(menuBuilder);
                menuBuilder.Expect(mb => mb.Build()).Return(null);

                var gui = mocks.Stub <IGui>();
                gui.Stub(g => g.Get(context, treeViewControl)).Return(menuBuilder);
                mocks.ReplayAll();

                plugin.Gui = gui;

                // Call
                info.ContextMenuStrip(context, null, treeViewControl);

                // Assert
                mocks.VerifyAll();
            }
        }
예제 #4
0
        public void GivenCalculationsWithIllustrationPoints_WhenClearIllustrationPointsClickedAndContinue_ThenInquiryAndIllustrationPointsCleared(
            Func <IAssessmentSection, HydraulicBoundaryLocationCalculation> getHydraulicLocationCalculationFunc)
        {
            // Given
            var random = new Random(21);
            IAssessmentSection assessmentSection             = GetConfiguredAssessmentSectionWithHydraulicBoundaryLocationCalculations();
            HydraulicBoundaryLocationCalculation calculation = getHydraulicLocationCalculationFunc(assessmentSection);

            calculation.Output = new TestHydraulicBoundaryLocationCalculationOutput(random.NextDouble(), new TestGeneralResultSubMechanismIllustrationPoint());

            HydraulicBoundaryLocationCalculation[] calculationsWithOutput = GetAllWaterLevelCalculationsWithOutput(assessmentSection).ToArray();

            var messageBoxText = "";

            DialogBoxHandler = (name, wnd) =>
            {
                var helper = new MessageBoxTester(wnd);
                messageBoxText = helper.Text;

                helper.ClickOk();
            };

            var context = new WaterLevelCalculationsForNormTargetProbabilitiesGroupContext(new ObservableList <HydraulicBoundaryLocation>(), assessmentSection);

            var mockRepository = new MockRepository();

            using (var treeViewControl = new TreeViewControl())
            {
                var calculationObserver = mockRepository.StrictMock <IObserver>();
                calculationObserver.Expect(o => o.UpdateObserver());

                IGui gui = StubFactory.CreateGuiStub(mockRepository);
                gui.Stub(cmp => cmp.MainWindow).Return(mockRepository.Stub <IMainWindow>());
                gui.Stub(cmp => cmp.Get(context, treeViewControl)).Return(new CustomItemsOnlyContextMenuBuilder());
                mockRepository.ReplayAll();

                calculation.Attach(calculationObserver);

                using (var plugin = new RiskeerPlugin())
                {
                    TreeNodeInfo info = GetInfo(plugin);
                    plugin.Gui = gui;

                    using (ContextMenuStrip contextMenuAdapter = info.ContextMenuStrip(context, null, treeViewControl))
                    {
                        // When
                        contextMenuAdapter.Items[contextMenuClearIllustrationPointsIndex].PerformClick();

                        // Then
                        const string expectedMessage = "Weet u zeker dat u alle berekende illustratiepunten bij 'Waterstanden bij vaste doelkans' wilt wissen?";
                        Assert.AreEqual(expectedMessage, messageBoxText);

                        Assert.IsTrue(calculationsWithOutput.All(calc => calc.HasOutput));
                        Assert.IsFalse(calculation.Output.HasGeneralResult);
                    }
                }
            }

            mockRepository.VerifyAll();
        }
        public void ContextMenuStrip_MacroStabilityInwardsCalculationWithoutOutput_ContextMenuItemClearOutputDisabledAndTooltipSet()
        {
            // Setup
            using (var treeViewControl = new TreeViewControl())
            {
                var calculation       = new MacroStabilityInwardsCalculationScenario();
                var failureMechanism  = new MacroStabilityInwardsFailureMechanism();
                var assessmentSection = mocks.Stub <IAssessmentSection>();
                var nodeData          = new MacroStabilityInwardsCalculationScenarioContext(calculation,
                                                                                            new CalculationGroup(),
                                                                                            Enumerable.Empty <MacroStabilityInwardsSurfaceLine>(),
                                                                                            Enumerable.Empty <MacroStabilityInwardsStochasticSoilModel>(),
                                                                                            failureMechanism,
                                                                                            assessmentSection);

                var gui = mocks.Stub <IGui>();
                gui.Stub(cmp => cmp.Get(nodeData, treeViewControl)).Return(new CustomItemsOnlyContextMenuBuilder());
                mocks.ReplayAll();

                plugin.Gui = gui;

                // Call
                using (ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, null, treeViewControl))
                {
                    // Assert
                    TestHelper.AssertContextMenuStripContainsItem(contextMenu,
                                                                  contextMenuClearIndex,
                                                                  "&Wis uitvoer...",
                                                                  "Deze berekening heeft geen uitvoer om te wissen.",
                                                                  RiskeerCommonFormsResources.ClearIcon,
                                                                  false);
                }
            }
        }
        public void ContextMenuStrip_WithChartDataCollection_CallsContextMenuBuilderMethods()
        {
            // Setup
            var chartDataCollection = new ChartDataCollection("test data");

            using (var treeViewControl = new TreeViewControl())
            {
                var menuBuilder = mocks.StrictMock <IContextMenuBuilder>();
                using (mocks.Ordered())
                {
                    menuBuilder.Expect(mb => mb.AddCustomItem(null)).IgnoreArguments().Return(menuBuilder);
                    menuBuilder.Expect(mb => mb.AddSeparator()).Return(menuBuilder);
                    menuBuilder.Expect(mb => mb.AddPropertiesItem()).Return(menuBuilder);
                    menuBuilder.Expect(mb => mb.Build()).Return(null);
                }

                contextMenuBuilderProvider.Expect(cmbp => cmbp.Get(null, null))
                .IgnoreArguments()
                .Return(menuBuilder);
                mocks.ReplayAll();

                // Call
                info.ContextMenuStrip(chartDataCollection, null, treeViewControl);

                // Assert
                // Asserts done in TearDown
            }
        }
예제 #7
0
        public void ContextMenuStrip_WaterLevelCalculationsWithoutIllustrationPoints_ContextMenuItemClearAllIllustrationPointsDisabled()
        {
            // Setup
            IAssessmentSection assessmentSection = GetConfiguredAssessmentSectionWithHydraulicBoundaryLocationCalculations();

            var nodeData = new WaterLevelCalculationsForNormTargetProbabilitiesGroupContext(new ObservableList <HydraulicBoundaryLocation>(), assessmentSection);

            var mockRepository = new MockRepository();

            using (var treeViewControl = new TreeViewControl())
            {
                IGui gui = StubFactory.CreateGuiStub(mockRepository);
                gui.Stub(cmp => cmp.Get(nodeData, treeViewControl)).Return(new CustomItemsOnlyContextMenuBuilder());
                gui.Stub(cmp => cmp.MainWindow).Return(mockRepository.Stub <IMainWindow>());
                mockRepository.ReplayAll();

                using (var plugin = new RiskeerPlugin())
                {
                    TreeNodeInfo info = GetInfo(plugin);

                    plugin.Gui = gui;

                    // Call
                    using (ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, null, treeViewControl))
                    {
                        // Assert
                        ToolStripItem contextMenuItem = contextMenu.Items[contextMenuClearIllustrationPointsIndex];
                        Assert.IsFalse(contextMenuItem.Enabled);
                    }
                }
            }

            mockRepository.VerifyAll(); // Expect no calls on arguments
        }
        public void OnDrop_ChartDataMovedToPositionOutsideRange_ThrowsException(int position)
        {
            // Setup
            var observer = mocks.StrictMock <IObserver>();

            mocks.ReplayAll();

            var chartData1          = new ChartLineData("line");
            var chartData2          = new ChartAreaData("area");
            var chartData3          = new ChartPointData("point");
            var chartData4          = new ChartMultipleAreaData("multiple area");
            var chartDataCollection = new ChartDataCollection("test data");

            chartDataCollection.Add(chartData1);
            chartDataCollection.Add(chartData2);
            chartDataCollection.Add(chartData3);
            chartDataCollection.Add(chartData4);

            chartDataCollection.Attach(observer);
            chartLegendView.Data = chartDataCollection;

            ChartDataContext context1 = GetContext(chartData1);

            chartDataCollection.Attach(observer);

            using (var treeViewControl = new TreeViewControl())
            {
                // Call
                void Call() => info.OnDrop(context1, chartDataCollection, chartDataCollection, position, treeViewControl);

                // Assert
                Assert.Throws <ArgumentOutOfRangeException>(Call);
            }
        }
예제 #9
0
        public void ContextMenuStrip_HydraulicBoundaryDatabaseNotLinked_CalculateAllDisabled()
        {
            // Setup
            using (var treeViewControl = new TreeViewControl())
            {
                var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism();
                failureMechanism.CalculationsGroup.Children.Add(new WaveImpactAsphaltCoverWaveConditionsCalculation());

                IAssessmentSection assessmentSection = AssessmentSectionTestHelper.CreateAssessmentSectionStub(mocks);
                var nodeData = new WaveImpactAsphaltCoverFailureMechanismContext(failureMechanism, assessmentSection);

                var menuBuilder = new CustomItemsOnlyContextMenuBuilder();
                var gui         = mocks.Stub <IGui>();
                gui.Stub(g => g.Get(nodeData, treeViewControl)).Return(menuBuilder);
                gui.Stub(g => g.MainWindow).Return(mocks.Stub <IMainWindow>());
                mocks.ReplayAll();

                plugin.Gui = gui;

                // Call
                using (ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, null, treeViewControl))
                {
                    // Assert
                    ToolStripItem calculateItem = contextMenu.Items[contextMenuCalculateAllIndex];
                    Assert.IsFalse(calculateItem.Enabled);
                    Assert.AreEqual("Er is geen hydraulische belastingendatabase geïmporteerd.", calculateItem.ToolTipText);
                }
            }
        }
예제 #10
0
        public void ContextMenuStrip_WithContext_AddCustomItems()
        {
            // Setup
            using (var treeView = new TreeViewControl())
            {
                var assessmentSection = mocks.Stub <IAssessmentSection>();
                var failureMechanism  = new WaveImpactAsphaltCoverFailureMechanism();
                var context           = new WaveImpactAsphaltCoverFailureMechanismContext(failureMechanism, assessmentSection);
                var menuBuilder       = new CustomItemsOnlyContextMenuBuilder();

                var gui = mocks.Stub <IGui>();
                gui.Stub(cmp => cmp.Get(context, treeView)).Return(menuBuilder);
                gui.Stub(g => g.ProjectOpened += null).IgnoreArguments();
                gui.Stub(g => g.ProjectOpened -= null).IgnoreArguments();
                mocks.ReplayAll();

                plugin.Gui = gui;

                // Call
                using (ContextMenuStrip menu = info.ContextMenuStrip(context, assessmentSection, treeView))
                {
                    // Assert
                    Assert.AreEqual(8, menu.Items.Count);

                    TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuCalculateAllIndex,
                                                                  "Alles be&rekenen",
                                                                  "Er zijn geen berekeningen om uit te voeren.",
                                                                  RiskeerCommonFormsResources.CalculateAllIcon,
                                                                  false);
                }
            }
        }
예제 #11
0
        public void ContextMenuStrip_HydraulicBoundaryDatabaseLinkedToInvalidFile_ContextMenuItemValidateAllDisabledAndTooltipSet()
        {
            // Setup
            var failureMechanism = new GrassCoverErosionInwardsFailureMechanism();

            failureMechanism.CalculationsGroup.Children.Add(new GrassCoverErosionInwardsCalculation());

            IAssessmentSection assessmentSection = AssessmentSectionTestHelper.CreateAssessmentSectionStub(null, mocksRepository, "invalidFilePath");

            var nodeData    = new GrassCoverErosionInwardsFailureMechanismContext(failureMechanism, assessmentSection);
            var menuBuilder = new CustomItemsOnlyContextMenuBuilder();

            using (var treeViewControl = new TreeViewControl())
            {
                var gui = mocksRepository.Stub <IGui>();
                gui.Stub(g => g.Get(nodeData, treeViewControl)).Return(menuBuilder);
                gui.Stub(g => g.MainWindow).Return(mocksRepository.Stub <IMainWindow>());
                mocksRepository.ReplayAll();

                plugin.Gui = gui;

                // Call
                using (ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, null, treeViewControl))
                {
                    // Assert
                    ToolStripItem contextMenuItem = contextMenu.Items[contextMenuValidateAllIndex];

                    Assert.AreEqual("Alles &valideren", contextMenuItem.Text);
                    StringAssert.Contains("Herstellen van de verbinding met de hydraulische belastingendatabase is mislukt.", contextMenuItem.ToolTipText);
                    TestHelper.AssertImagesAreEqual(RiskeerCommonFormsResources.ValidateAllIcon, contextMenuItem.Image);
                    Assert.IsFalse(contextMenuItem.Enabled);
                }
            }
        }
예제 #12
0
        public void ContextMenuStrip_Always_CallsContextMenuBuilderMethods()
        {
            // Setup
            var mocks = new MockRepository();

            using (var treeViewControl = new TreeViewControl())
            {
                var menuBuilder = mocks.StrictMock <IContextMenuBuilder>();
                using (mocks.Ordered())
                {
                    menuBuilder.Expect(mb => mb.AddOpenItem()).Return(menuBuilder);
                    menuBuilder.Expect(mb => mb.AddSeparator()).Return(menuBuilder);
                    menuBuilder.Expect(mb => mb.AddPropertiesItem()).Return(menuBuilder);
                    menuBuilder.Expect(mb => mb.Build()).Return(null);
                }

                var gui = mocks.Stub <IGui>();
                gui.Stub(cmp => cmp.Get(null, treeViewControl)).Return(menuBuilder);
                mocks.ReplayAll();

                using (var plugin = new GrassCoverErosionOutwardsPlugin())
                {
                    TreeNodeInfo info = GetInfo(plugin);
                    plugin.Gui = gui;

                    // Call
                    info.ContextMenuStrip(null, null, treeViewControl);
                }
            }

            // Assert
            mocks.VerifyAll();
        }
예제 #13
0
        public void ContextMenuStrip_Always_CallsContextMenuBuilderMethods()
        {
            // Setup
            var menuBuilder = mocks.StrictMock <IContextMenuBuilder>();

            using (mocks.Ordered())
            {
                menuBuilder.Expect(mb => mb.AddOpenItem()).Return(menuBuilder);
                menuBuilder.Expect(mb => mb.AddSeparator()).Return(menuBuilder);
                menuBuilder.Expect(mb => mb.AddPropertiesItem()).Return(menuBuilder);
                menuBuilder.Expect(mb => mb.Build()).Return(null);
            }

            using (var treeViewControl = new TreeViewControl())
            {
                var gui = mocks.Stub <IGui>();
                gui.Stub(cmp => cmp.Get(null, treeViewControl)).Return(menuBuilder);
                mocks.ReplayAll();

                plugin.Gui = gui;

                // Call
                info.ContextMenuStrip(null, null, treeViewControl);
            }

            // Assert
            // Assert expectancies called in TearDown()
        }
예제 #14
0
        public void ContextMenuStrip_Always_CallsBuilder()
        {
            // Setup
            var mocks       = new MockRepository();
            var menuBuilder = mocks.StrictMock <IContextMenuBuilder>();

            using (mocks.Ordered())
            {
                menuBuilder.Expect(mb => mb.AddCollapseAllItem()).Return(menuBuilder);
                menuBuilder.Expect(mb => mb.AddExpandAllItem()).Return(menuBuilder);
                menuBuilder.Expect(mb => mb.Build()).Return(null);
            }

            using (var treeViewControl = new TreeViewControl())
            {
                IGui gui = StubFactory.CreateGuiStub(mocks);
                gui.Stub(g => g.Get(null, treeViewControl)).Return(menuBuilder);
                mocks.ReplayAll();

                using (var plugin = new RiskeerPlugin())
                {
                    TreeNodeInfo info = GetInfo(plugin);
                    plugin.Gui = gui;

                    // Call
                    info.ContextMenuStrip(null, null, treeViewControl);
                }
            }

            // Assert
            mocks.VerifyAll();
        }
        public void ContextMenuStrip_Always_CallsContextMenuBuilderMethods()
        {
            // Setup
            var mocks = new MockRepository();

            using (var treeViewControl = new TreeViewControl())
            {
                var output = new EmptyWaveImpactAsphaltCoverOutput();

                var menuBuilder = mocks.StrictMock <IContextMenuBuilder>();
                using (mocks.Ordered())
                {
                    menuBuilder.Expect(mb => mb.AddPropertiesItem()).Return(menuBuilder);
                    menuBuilder.Expect(mb => mb.Build()).Return(null);
                }

                var gui = mocks.Stub <IGui>();
                gui.Stub(cmp => cmp.Get(output, treeViewControl)).Return(menuBuilder);
                mocks.ReplayAll();

                using (var plugin = new WaveImpactAsphaltCoverPlugin())
                {
                    TreeNodeInfo info = GetInfo(plugin);
                    plugin.Gui = gui;

                    // Call
                    info.ContextMenuStrip(output, null, treeViewControl);
                }
            }

            // Assert
            mocks.VerifyAll();
        }
예제 #16
0
        private ContextMenuStrip CalculationsStateFailureMechanismContextMenuStrip(CalculationsStateFailureMechanismContext context,
                                                                                   object parentData,
                                                                                   TreeViewControl treeViewControl)
        {
            IEnumerable <StructuresCalculation <ClosingStructuresInput> > calculations = context.WrappedData
                                                                                         .Calculations
                                                                                         .Cast <StructuresCalculation <ClosingStructuresInput> >();
            IInquiryHelper inquiryHelper = GetInquiryHelper();

            var builder = new RiskeerContextMenuBuilder(Gui.Get(context, treeViewControl));

            return(builder.AddOpenItem()
                   .AddSeparator()
                   .AddValidateAllCalculationsInFailureMechanismItem(
                       context,
                       ValidateAllInFailureMechanism,
                       EnableValidateAndCalculateMenuItemForFailureMechanism)
                   .AddPerformAllCalculationsInFailureMechanismItem(
                       context,
                       CalculateAllInFailureMechanism,
                       EnableValidateAndCalculateMenuItemForFailureMechanism)
                   .AddSeparator()
                   .AddClearAllCalculationOutputInFailureMechanismItem(context.WrappedData)
                   .AddClearIllustrationPointsOfCalculationsInFailureMechanismItem(() => IllustrationPointsHelper.HasIllustrationPoints(calculations),
                                                                                   CreateChangeHandler(inquiryHelper, calculations))
                   .AddSeparator()
                   .AddCollapseAllItem()
                   .AddExpandAllItem()
                   .AddSeparator()
                   .AddPropertiesItem()
                   .Build());
        }
예제 #17
0
        /// <summary>
        /// 初始化部门树
        /// </summary>
        private void LoadTreeView_StaHead(TreeViewControl tvc, bool blIsAll)
        {
            DataTable dt;

            using (ds = new DataSet())
            {
                if (blIsAll)    //主节点是“所有”
                {
                    ds = sbll.GetStaHeadInfo();
                }
                else            //无主节点
                {
                    ds = sbll.GetStaHeadInfo_Binding();
                }

                if (ds != null && ds.Tables.Count > 0)
                {
                    dt = ds.Tables[0];
                }
                else
                {
                    dt = tvc.BuildMenusEntity();
                }

                if (blIsAll)
                {
                    DataRow dr = dt.NewRow();
                    SetDataRow(ref dr, "0", "所有", "-1", false, false, 0);
                    dt.Rows.Add(dr);
                }

                tvc.DataSouce = dt;
                tvc.LoadNode("人");
            }
        }
        public void OnDrop_ChartDataMovedToPositionInsideRange_SetsNewReverseOrder(int position)
        {
            // Setup
            var observer = mocks.StrictMock <IObserver>();

            observer.Expect(o => o.UpdateObserver());
            mocks.ReplayAll();

            var chartData1          = new TestChartData();
            var chartData2          = new TestChartData();
            var chartData3          = new TestChartData();
            var chartDataCollection = new ChartDataCollection("test");

            chartDataCollection.Add(chartData1);
            chartDataCollection.Add(chartData2);
            chartDataCollection.Add(chartData3);

            ChartDataContext context1          = GetContext(chartData1);
            ChartDataContext collectionContext = GetContext(chartDataCollection);

            chartDataCollection.Attach(observer);

            using (var treeViewControl = new TreeViewControl())
            {
                // Call
                info.OnDrop(context1, collectionContext, collectionContext, position, treeViewControl);

                // Assert
                int reversedIndex         = 2 - position;
                var wrappedCollectionData = (ChartDataCollection)collectionContext.WrappedData;
                Assert.AreSame(context1.WrappedData, wrappedCollectionData.Collection.ElementAt(reversedIndex));
            }
        }
예제 #19
0
        public void ContextMenuStrip_WithSpecificAssessmentSectionConfiguration_CalculateAllMenuItemStateAsExpected(AssessmentSection assessmentSection, bool expectedEnabledState)
        {
            // Setup
            using (var treeView = new TreeViewControl())
            {
                var context     = new CalculationsStateRootContext(assessmentSection);
                var menuBuilder = new CustomItemsOnlyContextMenuBuilder();

                var  mocks = new MockRepository();
                IGui gui   = StubFactory.CreateGuiStub(mocks);
                gui.Stub(cmp => cmp.Get(context, treeView)).Return(menuBuilder);
                mocks.ReplayAll();

                using (var plugin = new RiskeerPlugin())
                {
                    plugin.Gui = gui;

                    // Call
                    using (ContextMenuStrip menu = GetInfo(plugin).ContextMenuStrip(context, null, treeView))
                    {
                        // Assert
                        Assert.AreEqual(10, menu.Items.Count);

                        TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuCalculateAllIndex,
                                                                      "Alles be&rekenen",
                                                                      expectedEnabledState
                                                                          ? "Voer alle berekeningen binnen dit traject uit."
                                                                          : "Er zijn geen berekeningen om uit te voeren.",
                                                                      RiskeerCommonFormsResources.CalculateAllIcon,
                                                                      expectedEnabledState);
                    }
                }
            }
        }
        public void ContextMenuStrip_Always_CallsBuilder()
        {
            // Setup
            MacroStabilityInwardsStochasticSoilModel model = MacroStabilityInwardsStochasticSoilModelTestFactory.CreateValidStochasticSoilModel();

            var mocks = new MockRepository();

            var menuBuilder = mocks.StrictMock <IContextMenuBuilder>();

            using (mocks.Ordered())
            {
                menuBuilder.Expect(mb => mb.AddCollapseAllItem()).Return(menuBuilder);
                menuBuilder.Expect(mb => mb.AddExpandAllItem()).Return(menuBuilder);
                menuBuilder.Expect(mb => mb.AddSeparator()).Return(menuBuilder);
                menuBuilder.Expect(mb => mb.AddPropertiesItem()).Return(menuBuilder);
                menuBuilder.Expect(mb => mb.Build()).Return(null);
            }

            using (var treeViewControl = new TreeViewControl())
            {
                var gui = mocks.Stub <IGui>();
                gui.Stub(g => g.Get(model, treeViewControl)).Return(menuBuilder);
                mocks.ReplayAll();

                plugin.Gui = gui;

                // Call
                info.ContextMenuStrip(model, null, treeViewControl);
            }

            // Assert
            mocks.VerifyAll();
        }
        public void ContextMenuStrip_Always_CallsBuilder()
        {
            // Setup
            var mocks       = new MockRepository();
            var menuBuilder = mocks.StrictMock <IContextMenuBuilder>();

            menuBuilder.Expect(mb => mb.AddPropertiesItem()).Return(menuBuilder);
            menuBuilder.Expect(mb => mb.Build()).Return(null);

            IGui gui = StubFactory.CreateGuiStub(mocks);

            using (var treeViewControl = new TreeViewControl())
            {
                gui.Stub(g => g.Get(null, treeViewControl)).Return(menuBuilder);

                mocks.ReplayAll();

                using (var p = new RiskeerPlugin())
                {
                    p.Gui = gui;
                    TreeNodeInfo i = p.GetTreeNodeInfos().First(tni => tni.TagType == typeof(DikeProfile));

                    // Call
                    i.ContextMenuStrip(null, null, treeViewControl);
                }
            }

            // Assert
            mocks.VerifyAll();
        }
예제 #22
0
        public void ContextMenuStrip_Always_CallsBuilder()
        {
            // Setup
            var mocks       = new MockRepository();
            var menuBuilder = mocks.StrictMock <IContextMenuBuilder>();

            menuBuilder.Expect(mb => mb.AddOpenItem()).Return(menuBuilder);
            menuBuilder.Expect(mb => mb.Build()).Return(null);

            using (var treeViewControl = new TreeViewControl())
            {
                var gui = mocks.Stub <IGui>();
                gui.Stub(g => g.Get(null, treeViewControl)).Return(menuBuilder);
                gui.Stub(g => g.ProjectOpened += null).IgnoreArguments();
                gui.Stub(g => g.ProjectOpened -= null).IgnoreArguments();

                mocks.ReplayAll();

                plugin.Gui = gui;

                // Call
                info.ContextMenuStrip(null, null, treeViewControl);
            }

            // Assert
            mocks.VerifyAll();
        }
예제 #23
0
        public void ContextMenuStrip_HydraulicBoundaryDatabaseLinkedToInvalidFile_ContextMenuItemCalculateAllDisabledAndTooltipSet()
        {
            // Setup
            using (var treeViewControl = new TreeViewControl())
            {
                IAssessmentSection assessmentSection = AssessmentSectionTestHelper.CreateAssessmentSectionStub(null, mocks, "invalidFilePath");

                var context = new DuneLocationCalculationsForUserDefinedTargetProbabilityContext(new DuneLocationCalculationsForTargetProbability(0.1),
                                                                                                 new DuneErosionFailureMechanism(),
                                                                                                 assessmentSection);

                var builder = new CustomItemsOnlyContextMenuBuilder();
                var gui     = mocks.Stub <IGui>();
                gui.Stub(cmp => cmp.Get(context, treeViewControl)).Return(builder);
                gui.Stub(g => g.ViewHost).Return(mocks.Stub <IViewHost>());

                mocks.ReplayAll();

                plugin.Gui = gui;

                // Call
                using (ContextMenuStrip menu = info.ContextMenuStrip(context, null, treeViewControl))
                {
                    // Assert
                    ToolStripItem contextMenuItem = menu.Items[contextMenuCalculateAllIndex];

                    Assert.AreEqual("Alles be&rekenen", contextMenuItem.Text);
                    StringAssert.Contains("Herstellen van de verbinding met de hydraulische belastingendatabase is mislukt.", contextMenuItem.ToolTipText);
                    TestHelper.AssertImagesAreEqual(RiskeerCommonFormsResources.CalculateAllIcon, contextMenuItem.Image);
                    Assert.IsFalse(contextMenuItem.Enabled);
                }
            }
        }
예제 #24
0
        public void ContextMenuStrip_Always_CallsBuilder()
        {
            // Setup
            var mocks       = new MockRepository();
            var menuBuilder = mocks.StrictMock <IContextMenuBuilder>();

            menuBuilder.Expect(mb => mb.AddOpenItem()).Return(menuBuilder);
            menuBuilder.Expect(mb => mb.Build()).Return(null);

            using (plugin)
                using (var treeViewControl = new TreeViewControl())
                {
                    IGui gui = StubFactory.CreateGuiStub(mocks);
                    gui.Stub(g => g.Get(null, treeViewControl)).Return(menuBuilder);

                    mocks.ReplayAll();

                    plugin.Gui = gui;

                    // Call
                    info.ContextMenuStrip(null, null, treeViewControl);
                }

            // Assert
            mocks.VerifyAll();
        }
예제 #25
0
        public void ContextMenuStrip_HydraulicBoundaryDatabaseNotLinked_ContextMenuItemCalculateAllDisabledAndTooltipSet()
        {
            // Setup
            var failureMechanism  = new GrassCoverErosionOutwardsFailureMechanism();
            var assessmentSection = new AssessmentSectionStub();

            var context = new GrassCoverErosionOutwardsFailureMechanismContext(failureMechanism, assessmentSection);

            using (var treeViewControl = new TreeViewControl())
            {
                var gui = mocks.Stub <IGui>();
                gui.Stub(g => g.ProjectOpened += null).IgnoreArguments();
                gui.Stub(g => g.ProjectOpened -= null).IgnoreArguments();
                gui.Stub(cmp => cmp.Get(context, treeViewControl)).Return(new CustomItemsOnlyContextMenuBuilder());
                mocks.ReplayAll();

                plugin.Gui = gui;

                // Call
                using (ContextMenuStrip contextMenu = info.ContextMenuStrip(context, null, treeViewControl))
                {
                    // Assert
                    ToolStripItem contextMenuItem = contextMenu.Items[contextMenuCalculateAllIndex];

                    Assert.AreEqual("Alles be&rekenen", contextMenuItem.Text);
                    StringAssert.Contains("Er is geen hydraulische belastingendatabase geïmporteerd.", contextMenuItem.ToolTipText);
                    TestHelper.AssertImagesAreEqual(RiskeerCommonFormsResources.CalculateAllIcon, contextMenuItem.Image);
                    Assert.IsFalse(contextMenuItem.Enabled);
                }
            }
        }
        public void ContextMenuStrip_Always_CallsBuilderMethods()
        {
            // Setup
            var mocksRepository = new MockRepository();

            var menuBuilder = mocksRepository.StrictMock <IContextMenuBuilder>();

            using (mocksRepository.Ordered())
            {
                menuBuilder.Expect(mb => mb.AddPropertiesItem()).Return(menuBuilder);
                menuBuilder.Expect(mb => mb.Build()).Return(null);
            }

            using (var plugin = new StabilityPointStructuresPlugin())
                using (var treeViewControl = new TreeViewControl())
                {
                    var gui = mocksRepository.Stub <IGui>();
                    gui.Stub(g => g.Get(null, treeViewControl)).Return(menuBuilder);
                    mocksRepository.ReplayAll();

                    plugin.Gui = gui;

                    TreeNodeInfo info = GetInfo(plugin);

                    // Call
                    info.ContextMenuStrip(null, null, treeViewControl);
                }

            // Assert
            mocksRepository.VerifyAll();
        }
예제 #27
0
        public void LoadTreeView()
        {
            TreeViewControl treeView = new TreeViewControl(radTreeView1);

            treeView.LoadTreeView();
            radTreeView1.NodeMouseClick += RadTreeView1_NodeMouseClick;
        }
예제 #28
0
        public void ContextMenuStrip_Always_AddCustomItems()
        {
            // Setup
            using (var treeView = new TreeViewControl())
            {
                var assessmentSection        = new AssessmentSection(AssessmentSectionComposition.Dike);
                var assessmentSectionContext = new AssessmentSectionStateRootContext(assessmentSection);
                var menuBuilder = new CustomItemsOnlyContextMenuBuilder();

                var  mocks = new MockRepository();
                IGui gui   = StubFactory.CreateGuiStub(mocks);
                gui.Stub(cmp => cmp.Get(assessmentSectionContext, treeView)).Return(menuBuilder);
                mocks.ReplayAll();

                using (var plugin = new RiskeerPlugin())
                {
                    plugin.Gui = gui;

                    // Call
                    using (ContextMenuStrip menu = GetInfo(plugin).ContextMenuStrip(assessmentSectionContext, null, treeView))
                    {
                        // Assert
                        Assert.AreEqual(10, menu.Items.Count);

                        TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuImportAssessmentSectionIndex,
                                                                      "&Importeren...",
                                                                      "Importeer de gegevens vanuit een bestand.",
                                                                      CoreGuiResources.ImportIcon);
                    }
                }
            }
        }
        public void ContextMenuStrip_HydraulicBoundaryDatabaseNotLinked_ContextMenuItemCalculateAllDisabled()
        {
            // Setup
            using (var treeView = new TreeViewControl())
            {
                var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike);
                var context           = new HydraulicLoadsStateRootContext(assessmentSection);
                var menuBuilder       = new CustomItemsOnlyContextMenuBuilder();

                var  mocks = new MockRepository();
                IGui gui   = StubFactory.CreateGuiStub(mocks);
                gui.Stub(cmp => cmp.Get(context, treeView)).Return(menuBuilder);
                mocks.ReplayAll();

                using (var plugin = new RiskeerPlugin())
                {
                    plugin.Gui = gui;

                    // Call
                    using (ContextMenuStrip menu = GetInfo(plugin).ContextMenuStrip(context, null, treeView))
                    {
                        // Assert
                        Assert.AreEqual(10, menu.Items.Count);

                        TestHelper.AssertContextMenuStripContainsItem(
                            menu, contextMenuCalculateAllIndex,
                            "Alles be&rekenen",
                            "Er is geen hydraulische belastingendatabase geïmporteerd.",
                            RiskeerCommonFormsResources.CalculateAllIcon,
                            false);
                    }
                }
            }
        }
예제 #30
0
        public void ContextMenuStrip_Always_CallsBuilder()
        {
            // Setup
            var mocks = new MockRepository();

            var menuBuilder = mocks.StrictMock <IContextMenuBuilder>();

            using (mocks.Ordered())
            {
                menuBuilder.Expect(mb => mb.AddImportItem()).Return(menuBuilder);
                menuBuilder.Expect(mb => mb.AddUpdateItem()).Return(menuBuilder);
                menuBuilder.Expect(mb => mb.AddSeparator()).Return(menuBuilder);
                menuBuilder.Expect(mb => mb.AddCollapseAllItem()).Return(menuBuilder);
                menuBuilder.Expect(mb => mb.AddExpandAllItem()).Return(menuBuilder);
                menuBuilder.Expect(mb => mb.AddSeparator()).Return(menuBuilder);
                menuBuilder.Expect(mb => mb.AddPropertiesItem()).Return(menuBuilder);
                menuBuilder.Expect(mb => mb.Build()).Return(null);
            }

            using (var treeViewControl = new TreeViewControl())
            {
                var gui = mocks.Stub <IGui>();
                gui.Stub(g => g.Get(null, treeViewControl)).Return(menuBuilder);

                mocks.ReplayAll();

                plugin.Gui = gui;

                // Call
                info.ContextMenuStrip(null, null, treeViewControl);
            }

            // Assert
            mocks.VerifyAll();
        }
예제 #31
0
 static void CreateTreeView()
 {
     skillTree = TreeViewInspector.AddTreeView();
     skillTree.DisplayInInspector = false;
     skillTree.DisplayOnGame = false;
     skillTree.DisplayOnScene = false;
     Example.PopulateExampleData(skillTree);
 }
예제 #32
0
    public TreeViewItem(TreeViewControl parentControl, TreeViewItem parent)
    {
        ParentControl = parentControl;
        Parent = parent;

        if (null == parentControl)
        {
            return;
        }
    }
예제 #33
0
    public static void AssignDefaults(TreeViewControl item)
    {
        // create new skin instance
        GUISkin skinHover = ScriptableObject.CreateInstance<GUISkin>();
        GUISkin skinSelected = ScriptableObject.CreateInstance<GUISkin>();
        GUISkin skinUnselected = ScriptableObject.CreateInstance<GUISkin>();

        // name the skins
        skinHover.name = "Hover";
        skinSelected.name = "Selected";
        skinUnselected.name = "Unselected";

        item.m_textureBlank = GetTexture("Assets/TreeViewControl/blank.png");
        item.m_textureGuide = GetTexture("Assets/TreeViewControl/guide.png");
        item.m_textureLastSiblingCollapsed = GetTexture("Assets/TreeViewControl/last_sibling_collapsed.png");
        item.m_textureLastSiblingExpanded = GetTexture("Assets/TreeViewControl/last_sibling_expanded.png");
        item.m_textureLastSiblingNoChild = GetTexture("Assets/TreeViewControl/last_sibling_nochild.png");
        item.m_textureMiddleSiblingCollapsed = GetTexture("Assets/TreeViewControl/middle_sibling_collapsed.png");
        item.m_textureMiddleSiblingExpanded = GetTexture("Assets/TreeViewControl/middle_sibling_expanded.png");
        item.m_textureMiddleSiblingNoChild = GetTexture("Assets/TreeViewControl/middle_sibling_nochild.png");
        item.m_textureNormalChecked = GetTexture("Assets/TreeViewControl/normal_checked.png");
        item.m_textureNormalUnchecked = GetTexture("Assets/TreeViewControl/normal_unchecked.png");
        item.m_textureSelectedBackground = GetTexture("Assets/TreeViewControl/selected_background_color.png");
        item.m_skinHover = skinHover;
        item.m_skinSelected = skinSelected;
        item.m_skinUnselected = skinUnselected;

        SetBackground(item.m_skinHover.button, null);
        SetBackground(item.m_skinHover.toggle, null);
        SetButtonFontSize(item.m_skinHover.button);
        SetButtonFontSize(item.m_skinHover.toggle);
        RemoveMargins(item.m_skinHover.button);
        RemoveMargins(item.m_skinHover.toggle);
        SetTextColor(item.m_skinHover.button, Color.yellow);
        SetTextColor(item.m_skinHover.toggle, Color.yellow);

        SetBackground(item.m_skinSelected.button, item.m_textureSelectedBackground);
        SetBackground(item.m_skinSelected.toggle, item.m_textureSelectedBackground);
        SetButtonFontSize(item.m_skinSelected.button);
        SetButtonFontSize(item.m_skinSelected.toggle);
        RemoveMargins(item.m_skinSelected.button);
        RemoveMargins(item.m_skinSelected.toggle);
        SetTextColor(item.m_skinSelected.button, Color.yellow);
        SetTextColor(item.m_skinSelected.toggle, Color.yellow);

        SetBackground(item.m_skinUnselected.button, null);
        SetBackground(item.m_skinUnselected.toggle, null);
        SetButtonFontSize(item.m_skinUnselected.button);
        SetButtonFontSize(item.m_skinUnselected.toggle);
        RemoveMargins(item.m_skinUnselected.button);
        RemoveMargins(item.m_skinUnselected.toggle);
        SetTextColor(item.m_skinUnselected.button, Color.white);
        SetTextColor(item.m_skinUnselected.toggle, Color.white);
    }
예제 #34
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.IsPostBack)
        {
            //解决跨域嵌套时iFrame子页面的Session无法访问
            Response.AddHeader("P3P", "CP=CAO PSA OUR");

            AjaxPro.Utility.RegisterTypeForAjax(typeof(iMES_Frame));

            //Get customer
            String strCustomer = Request["customer"];
            userInfo.Customer = strCustomer;

            //Get token
            String strToken = Request["Token"];
            IToken token = (IToken)WebCommonMethod.deserialize(strToken);

            //Init logon user information
            AuthorityManager authorManager = new AuthorityManager();
            AccountInfo account = authorManager.getAccountByToken(token);

            //Modify: ITC-1103-0150
            if (account.Login.Contains("\\"))
                userInfo.UserId = (String)account.Login.Split(new Char[] { '\\' })[1]; //itcxxxxxx
            else
                userInfo.UserId = (String)account.Login;

            userInfo.UserName = (String)account.Name;
            userInfo.Department = (String)account.Department;
            userInfo.Domain = (String)account.Domain;
            userInfo.Company = (String)account.Company;
            userInfo.AccountId = (long)account.Id;
            userInfo.Login = (String)account.Login; //itc\itcxxxxxx
            //Vincent add application info
            userInfo.Application = account.Application;

            Session["UserId"] = userInfo.UserId;

            //Init treeview
            TreeViewControl treeVC = new TreeViewControl(userInfo);
            treeVC.TreeNodePopulate(treeFunction.Nodes, token);
            Session["iMES_treeNodes"] = treeVC.getTreeNodes();
        }
    }
예제 #35
0
 public static void PopulateExampleData(TreeViewControl item)
 {
     item.Width = 600;
     item.Height = 500;
     item.Header = "Example.cs populated this treeview control";
     AddEvents(item.RootItem);
     TreeViewItem item1 = item.RootItem.AddItem("You can also add a tree view control");
     AddEvents(item1);
     AddEvents(item1.AddItem("to any existing game object by"));
     AddEvents(item1.AddItem("selecting the game object and"));
     AddEvents(item1.AddItem("using the menu item"));
     TreeViewItem games = item1.AddItem("TreeView->Add Tree View to selected.", false);
     AddEvents(games);
     AddEvents(games.AddItem("You can also drag and drop the"));
     AddEvents(games.AddItem("TreeViewControl script onto a"));
     AddEvents(games.AddItem("game object."));
     AddEvents(games.AddItem("New checked and", false, true));
     AddEvents(games.AddItem("unchecked checkboxes", false, false));
 }
예제 #36
0
    protected void Page_Load(object sender, EventArgs e)
	{
        try
        {
            userInfo = Master.userInfo;
            hidEditorId.Value = Master.userInfo.AccountId.ToString();
            if (!Page.IsPostBack)
            {

                log.Debug("webroot_aspx_authorities_accountauthority");
                AjaxPro.Utility.RegisterTypeForAjax(typeof(webroot_aspx_authorities_accountauthority));
                bindUsersInSubSystemTable();
                bindGroupsTable();
                bindUsersInGroupTable();
            }

            TreeView1.Attributes.Add("onclick", "OnCheckBoxCheckChanged(event)");

            if (TreeView1.Nodes.Count == 0)
            {
                treeVC = new TreeViewControl();
                TreeView1.Nodes.Clear();
                treeVC.TreeNodePopulate(TreeView1.Nodes);
                TreeView1.PathSeparator = ("|").ToCharArray()[0];
            }
            TreeView1.ExpandAll();
        }
            /*
        catch (FisException ex)
        {
            showErrorMessage(ex.mErrmsg);
            return;
        }*/
        catch (Exception ex)
        {
            //show error
            showErrorMessage(ex.Message);
            return;
        }
    }
예제 #37
0
 public static TreeViewControl AddTreeView()
 {
     item = new TreeViewControl();
     AssignDefaults(item);
     return item;
 }
예제 #38
0
    /// <summary>
    /// Called from OnGUI or EditorWindow.OnGUI
    /// </summary>
    public void DisplayTreeView(TreeViewControl.DisplayTypes displayType)
    {
        if (!m_forceDefaultSkin)
        {
            GUI.skin = m_skinUnselected;
        }

        switch (displayType)
        {
            case TreeViewControl.DisplayTypes.USE_SCROLL_VIEW:
                m_scrollView = GUILayout.BeginScrollView(m_scrollView, GUILayout.MaxWidth(Width), GUILayout.MaxHeight(Height));
                break;
            case TreeViewControl.DisplayTypes.USE_SCROLL_AREA:
                GUILayout.BeginArea(new Rect(X, Y, Width, Height));
                m_scrollView = GUILayout.BeginScrollView(m_scrollView, GUILayout.MaxWidth(Width), GUILayout.MaxHeight(Height));
                break;
        }

        RootItem.DisplayItem(0, TreeViewItem.SiblingOrder.FIRST_CHILD);

        switch (displayType)
        {
            case TreeViewControl.DisplayTypes.USE_SCROLL_VIEW:
                GUILayout.EndScrollView();
                break;
            case TreeViewControl.DisplayTypes.USE_SCROLL_AREA:
                GUILayout.EndScrollView();
                GUILayout.EndArea();
                break;
        }

        GUI.skin = null;
    }
예제 #39
0
    protected void Page_Load(object sender, EventArgs e)
	{
        try
        {
            userInfo = new com.inventec.iMESWEB.UserInfo();
            userInfo.Login = StringUtil.decode_URL(Request.QueryString["logonUser"]);

            IAccountManager securityManager = null;
            securityManager = RBPCAgent.getRBPCManager<IAccountManager>();

            string application = "";

            if (userInfo.Login.Contains("\\"))
            {
                application = Constants.APPLICATION_ALL;
            }
            else
            {
                application = System.Configuration.ConfigurationManager.AppSettings.Get("RBPCApplication").ToString();
            }

            AccountInfo account = securityManager.findAccountByLogin(userInfo.Login, application);

            if (account.Login.Contains("\\"))
                userInfo.UserId = (String)account.Login.Split(new Char[] { '\\' })[1]; //itcxxxxxx
            else
                userInfo.UserId = (String)account.Login;

            userInfo.UserName = (String)account.Name;
            userInfo.Department = (String)account.Department;
            userInfo.Domain = (String)account.Domain;
            userInfo.Company = (String)account.Company;
            userInfo.AccountId = (long)account.Id;
            userInfo.Login = (String)account.Login; //itc\itcxxxxxx

            //userInfo = Master.userInfo;
            hidEditorId.Value = userInfo.AccountId.ToString();
                        
            if (!Page.IsPostBack)
            {

                log.Debug("webroot_aspx_authorities_accountauthority");
                AjaxPro.Utility.RegisterTypeForAjax(typeof(webroot_aspx_authorities_accountauthority));
                bindUsersInSubSystemTable();
                bindGroupsTable();
                bindUsersInGroupTable();
            }

            TreeView1.Attributes.Add("onclick", "OnCheckBoxCheckChanged(event)");

            if (TreeView1.Nodes.Count == 0)
            {
                treeVC = new TreeViewControl();
                TreeView1.Nodes.Clear();
                treeVC.TreeNodePopulate(TreeView1.Nodes);
                TreeView1.PathSeparator = ("|").ToCharArray()[0];
            }
            TreeView1.ExpandAll();
        }
            /*
        catch (FisException ex)
        {
            showErrorMessage(ex.mErrmsg);
            return;
        }*/
        catch (Exception ex)
        {
            //show error
            showErrorMessage(ex.Message);
            return;
        }

        this.Title = "Dashboard Authority";
    }
예제 #40
0
    static void InitSkillTree()
    {
        skillTree = TreeViewInspector.AddTreeView();
        skillTree.DisplayInInspector = false;
        skillTree.DisplayOnGame = false;
        skillTree.DisplayOnScene = false;

        curItem = skillTree.RootItem;
        curItem.Header = "所有技能";
        ItemData itemData = new ItemData();
        itemData.type = ItemType.Root;
        curItem.DataContext = itemData;
        AddEvents(curItem);

        AddTreeItem();
    }
    public override void DisplayTreeView(TreeViewControl.DisplayTypes displayType)
    {
        if( AkWwisePicker.WwiseProjectFound )
        {
            string filterString = m_filterString;

            if(m_filterBoxStyle == null)
            {
                m_filterBoxStyle = (ScriptableObject.Instantiate(EditorGUIUtility.GetBuiltinSkin(EditorSkin.Inspector)) as GUISkin).FindStyle ("SearchTextField");
                m_filterBoxCancelButtonStyle = (ScriptableObject.Instantiate (EditorGUIUtility.GetBuiltinSkin (EditorSkin.Inspector)) as GUISkin).FindStyle ("SearchCancelButton");
            }

            GUILayout.BeginHorizontal("Box");
            {
                m_filterString = GUILayout.TextField(m_filterString, m_filterBoxStyle);
                if(GUILayout.Button ("", m_filterBoxCancelButtonStyle))
                {
                    m_filterString = "";
                };
            }
            GUILayout.EndHorizontal ();

            if(!m_filterString.Equals(filterString))
            {
                if(filterString.Equals(string.Empty))
                {
                    SaveExpansionStatus();
                }

                FilterTreeview(RootItem);

                if(m_filterString.Equals(string.Empty))
                {
                    string path = "";
                    RestoreExpansionStatus(RootItem, ref path);
                }
            }

            base.DisplayTreeView(displayType);
        }
        else
        {
            GUILayout.Label ("Wwise Project not found at path:");
            GUILayout.Label (AkUtilities.GetFullPath(Application.dataPath, WwiseSetupWizard.Settings.WwiseProjectPath));
            GUILayout.Label ("Wwise Picker will not be usable.");
        }
    }
예제 #42
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.IsPostBack)
        {
            logger.Debug("Page_Load Begin");
            //解决跨域嵌套时iFrame子页面的Session无法访问
            Response.AddHeader("P3P", "CP=CAO PSA OUR");

            AjaxPro.Utility.RegisterTypeForAjax(typeof(iMES_Frame));

            //Get customer
            String strCustomer = Request["customer"];
            userInfo.Customer = strCustomer;

            //Get token
            String strToken = Request["Token"];
            IToken token = (IToken)WebCommonMethod.deserialize(strToken);

            //Init logon user information
            AuthorityManager authorManager = new AuthorityManager();
            AccountInfo account = null;
            try
            {
                account = authorManager.getAccountByToken(token);
            }
            catch (Exception ex)
            {
                logger.Error(ex);
                string strMsg = Resources.iMESGlobalMessage.ResourceManager.GetString(Pre + "SessionIsNull");
                Server.Transfer(Request.ApplicationPath + "/RedirectErrMsg.aspx?Message=" + HttpUtility.UrlEncode(strMsg));
            }
            logger.DebugFormat("IMES_Frame Token:{0}", strToken);
            //Modify: ITC-1103-0150
            if (account.Login.Contains("\\"))
                userInfo.UserId = (String)account.Login.Split(new Char[] { '\\' })[1]; //itcxxxxxx
            else
                userInfo.UserId = (String)account.Login;

            userInfo.UserName = (String)account.Name;
            userInfo.Department = (String)account.Department;
            userInfo.Domain = (String)account.Domain;
            userInfo.Company = (String)account.Company;
            userInfo.AccountId = (long)account.Id;
            userInfo.Login = (String)account.Login; //itc\itcxxxxxx
            //Vincent add application info
            userInfo.Application = account.Application;
           
            Session["UserId"] = userInfo.UserId;
            string SessionId = Request["SessionId"];

            logger.DebugFormat("IMES_Frame RBPC UserId:{0} AccountId:{1} UserName:{2} Login:{3} SessionId:{4}", 
                                            userInfo.UserId,
                                            account.Id.ToString(),
                                            account.Name,
                                            account.Login,
                                            SessionId);

            Session[SessionId] = SessionId;
            Session[SessionId + "-UserId"] = userInfo.UserId;
            //Session["Token"] = strToken;            
            //Init treeview
            TreeViewControl treeVC = new TreeViewControl(userInfo);
            treeVC.TreeNodePopulate(treeFunction.Nodes, token, SessionId);
            Session["iMES_treeNodes"] = treeVC.getTreeNodes();
            logger.Debug("Page_Load End");
        }
    }
예제 #43
0
    /// <summary>
    /// Called from OnGUI or EditorWindow.OnGUI
    /// </summary>
    public virtual void DisplayTreeView(TreeViewControl.DisplayTypes displayType)
    {
        GUILayout.BeginHorizontal("box");

        AssignDefaults();
        if (!m_forceDefaultSkin)
        {
            ApplySkinKeepingScrollbars();
        }

        switch (displayType)
        {
            case TreeViewControl.DisplayTypes.USE_SCROLL_VIEW:
                m_scrollView = GUILayout.BeginScrollView(m_scrollView);//, GUILayout.MaxWidth(Width), GUILayout.MaxHeight(Height));
                break;
            //case TreeViewControl.DisplayTypes.USE_SCROLL_AREA:
            //    GUILayout.BeginArea(new Rect(X, Y, Width, Height));
            //    m_scrollView = GUILayout.BeginScrollView(m_scrollView);//, GUILayout.MaxWidth(Width), GUILayout.MaxHeight(Height));
            //    break;
        }

        RootItem.DisplayItem(0, TreeViewItem.SiblingOrder.FIRST_CHILD);

        switch (displayType)
        {
            case TreeViewControl.DisplayTypes.USE_SCROLL_VIEW:
                GUILayout.EndScrollView();
                break;
            //case TreeViewControl.DisplayTypes.USE_SCROLL_AREA:
            //    GUILayout.EndScrollView();
            //    GUILayout.EndArea();
            //    break;
        }

        GUI.skin = null;

        GUILayout.EndHorizontal();
    }