コード例 #1
0
ファイル: BPAManager.cs プロジェクト: yzwbrian/TabularEditor
 private void txtDefinition_ValueNeeded(object sender, Aga.Controls.Tree.NodeControls.NodeControlValueEventArgs e)
 {
     if (e.Node.Tag is BestPracticeRule rule)
     {
         e.Value = CurrentCollection?.Name ?? Analyzer.EffectiveCollectionForRule(rule.ID).Name;
     }
 }
コード例 #2
0
 private void nodeTextBox7_ValueNeeded(object sender, Aga.Controls.Tree.NodeControls.NodeControlValueEventArgs e)
 {
     e.Value = (e.Node.Tag is TOMWrapper.Model) ? "" : (e.Node.Tag as TOMWrapper.KPI)?.MeasureName ??
               (e.Node.Tag as TOMWrapper.Level)?.Hierarchy?.Name ??
               (e.Node.Tag as TOMWrapper.ITabularTableObject)?.Table?.DaxTableName ??
               "Model";
 }
コード例 #3
0
ファイル: BPAManager.cs プロジェクト: yzwbrian/TabularEditor
 private void chkRuleEnabled_IsEditEnabledValueNeeded(object sender, Aga.Controls.Tree.NodeControls.NodeControlValueEventArgs e)
 {
     if (e.Node.Tag is BestPracticeRule rule)
     {
         e.Value = EffectiveRules.Contains(rule);
     }
 }
コード例 #4
0
ファイル: FormMain.cs プロジェクト: yzwbrian/TabularEditor
 private void nodeTextBox5_ValueNeeded(object sender, Aga.Controls.Tree.NodeControls.NodeControlValueEventArgs e)
 {
     e.Value = (e.Node.Tag as TOMWrapper.Table)?.Source ??
               (e.Node.Tag as TOMWrapper.Partition)?.Expression ??
               (e.Node.Tag as TOMWrapper.DataColumn)?.SourceColumn ??
               (e.Node.Tag as TOMWrapper.CalculatedTableColumn)?.SourceColumn ??
               (e.Node.Tag as TOMWrapper.Level)?.Column?.DaxObjectName ??
               (e.Node.Tag as TOMWrapper.IExpressionObject)?.Expression;
 }
コード例 #5
0
        private void nodeCheckBox1_IsVisibleValueNeeded(object sender, Aga.Controls.Tree.NodeControls.NodeControlValueEventArgs e)
        {
            var schemaNode = (e.Node.Tag as SchemaNode);

            if (schemaNode == null)
            {
                return;
            }
            e.Value = schemaNode.Type == SchemaNodeType.Table || schemaNode.Type == SchemaNodeType.View;
        }
コード例 #6
0
        private void nodeTextBox5_ValueNeeded(object sender, Aga.Controls.Tree.NodeControls.NodeControlValueEventArgs e)
        {
            var value = (e.Node.Tag as TOMWrapper.Table)?.Source ??
                        (e.Node.Tag as TOMWrapper.Partition)?.Expression ??
                        (e.Node.Tag as TOMWrapper.DataColumn)?.SourceColumn ??
                        (e.Node.Tag as TOMWrapper.CalculatedTableColumn)?.SourceColumn ??
                        (e.Node.Tag as TOMWrapper.Level)?.Column?.DaxObjectName ??
                        (e.Node.Tag as TOMWrapper.IExpressionObject)?.Expression;

            e.Value = (value ?? string.Empty).Replace('\n', ' ').Trim();
        }
コード例 #7
0
ファイル: BPAForm.cs プロジェクト: yzwbrian/TabularEditor
        /*
         * private void btnDelete_Click(object sender, EventArgs e)
         * {
         *  if(listView1.SelectedItems.Count == 1 && listView1.SelectedItems[0].Group == lvgLocal)
         *  {
         *      var item = listView1.SelectedItems[0];
         *      var res = MessageBox.Show("Are you sure you want to delete this rule from the model?", "Delete rule?", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
         *      if (res == DialogResult.Cancel) return;
         *
         *      analyzer.LocalRules.Remove(item.Tag as BestPracticeRule);
         *      analyzer.SaveLocalRulesToModel();
         *      item.Remove();
         *  }
         * }
         *
         * private void LocalToGlobal()
         * {
         *  // Convert a rule from local to global:
         *  var item = listView1.SelectedItems[0];
         *  var rule = item.Tag as BestPracticeRule;
         *  analyzer.LocalRules.Remove(rule);
         *  analyzer.GlobalRules.Add(rule);
         *  item.Group = lvgGlobal;
         *
         *  analyzer.SaveLocalRulesToModel();
         *
         *  // Save global rules (adding the newly promoted rule):
         *  var bpc = new BestPracticeCollection();
         *  bpc.Add(rule);
         *
         *  var globalRulesFile = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\TabularEditor\BPARules.json";
         *
         *  bpc.AddFromJsonFile(globalRulesFile);
         *  bpc.SaveToFile(globalRulesFile);
         * }
         *
         * private void GlobalToLocal()
         * {
         *  // Convert a rule from global to local:
         *  var item = listView1.SelectedItems[0];
         *  var rule = item.Tag as BestPracticeRule;
         *  analyzer.GlobalRules.Remove(rule);
         *  analyzer.LocalRules.Add(rule);
         *  item.Group = lvgLocal;
         *
         *  analyzer.SaveLocalRulesToModel();
         *
         *  // Save global rules (less the newly demoted rule):
         *  var bpc = new BestPracticeCollection();
         *  var globalRulesFile = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\TabularEditor\BPARules.json";
         *  bpc.AddFromJsonFile(globalRulesFile);
         *  var deleteRule = bpc.FirstOrDefault(r => r.ID.Equals(rule.ID, StringComparison.InvariantCultureIgnoreCase));
         *  if (deleteRule != null)
         *  {
         *      bpc.Remove(deleteRule);
         *      bpc.SaveToFile(globalRulesFile);
         *  }
         * }*/

        private void txtObjectName_ValueNeeded(object sender, Aga.Controls.Tree.NodeControls.NodeControlValueEventArgs e)
        {
            if (e.Node.Tag is BestPracticeRule rule)
            {
                var objCount = AnalyzerResultsTreeModel.ObjectCountByRule(rule);
                e.Value = rule.Name + " (" + objCount + " object" + (objCount == 1 ? "" : "s") + ")";
            }
            else if (e.Node.Tag is AnalyzerResult result)
            {
                e.Value = result.ObjectName;
            }
        }
コード例 #8
0
        private void nodeIcon1_ValueNeeded(object sender, Aga.Controls.Tree.NodeControls.NodeControlValueEventArgs e)
        {
            var change = e.Node.Tag as Change;

            switch (change.ChangeType)
            {
            case ChangeType.Table: e.Value = UIController.Current.Elements.FormMain.tabularTreeImages.Images[2]; break;     // Table icon

            case ChangeType.AddColumn: e.Value = Resources.add; break;

            case ChangeType.RemoveColumn: e.Value = Resources.remove; break;

            case ChangeType.EditDataType: e.Value = Resources.editdatatype; break;
            }
        }
コード例 #9
0
        /*
         * private void btnDelete_Click(object sender, EventArgs e)
         * {
         *  if(listView1.SelectedItems.Count == 1 && listView1.SelectedItems[0].Group == lvgLocal)
         *  {
         *      var item = listView1.SelectedItems[0];
         *      var res = MessageBox.Show("Are you sure you want to delete this rule from the model?", "Delete rule?", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
         *      if (res == DialogResult.Cancel) return;
         *
         *      analyzer.LocalRules.Remove(item.Tag as BestPracticeRule);
         *      analyzer.SaveLocalRulesToModel();
         *      item.Remove();
         *  }
         * }
         *
         * private void LocalToGlobal()
         * {
         *  // Convert a rule from local to global:
         *  var item = listView1.SelectedItems[0];
         *  var rule = item.Tag as BestPracticeRule;
         *  analyzer.LocalRules.Remove(rule);
         *  analyzer.GlobalRules.Add(rule);
         *  item.Group = lvgGlobal;
         *
         *  analyzer.SaveLocalRulesToModel();
         *
         *  // Save global rules (adding the newly promoted rule):
         *  var bpc = new BestPracticeCollection();
         *  bpc.Add(rule);
         *
         *  var globalRulesFile = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\TabularEditor\BPARules.json";
         *
         *  bpc.AddFromJsonFile(globalRulesFile);
         *  bpc.SaveToFile(globalRulesFile);
         * }
         *
         * private void GlobalToLocal()
         * {
         *  // Convert a rule from global to local:
         *  var item = listView1.SelectedItems[0];
         *  var rule = item.Tag as BestPracticeRule;
         *  analyzer.GlobalRules.Remove(rule);
         *  analyzer.LocalRules.Add(rule);
         *  item.Group = lvgLocal;
         *
         *  analyzer.SaveLocalRulesToModel();
         *
         *  // Save global rules (less the newly demoted rule):
         *  var bpc = new BestPracticeCollection();
         *  var globalRulesFile = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\TabularEditor\BPARules.json";
         *  bpc.AddFromJsonFile(globalRulesFile);
         *  var deleteRule = bpc.FirstOrDefault(r => r.ID.Equals(rule.ID, StringComparison.InvariantCultureIgnoreCase));
         *  if (deleteRule != null)
         *  {
         *      bpc.Remove(deleteRule);
         *      bpc.SaveToFile(globalRulesFile);
         *  }
         * }*/

        private void txtObjectName_ValueNeeded(object sender, Aga.Controls.Tree.NodeControls.NodeControlValueEventArgs e)
        {
            if (e.Node.Tag is BestPracticeRule rule)
            {
                var objCount = AnalyzerResultsTreeModel.ObjectCountByRule(rule);
                e.Value = rule.Name + (rule.HasError ? "" : " (" + objCount + " object" + (objCount == 1 ? "" : "s") + ")");
            }
            else if (e.Node.Tag is AnalyzerResult result)
            {
                if (!string.IsNullOrEmpty(result.RuleError))
                {
                    e.Value = result.RuleError.Replace("\r", "").Replace("\n", " ");
                }
                else
                {
                    e.Value = result.ObjectName;
                }
            }
        }
コード例 #10
0
        private void nodeIcon1_IsVisibleValueNeeded(object sender, Aga.Controls.Tree.NodeControls.NodeControlValueEventArgs e)
        {
            var schemaNode = (e.Node.Tag as SchemaNode);

            if (schemaNode == null)
            {
                return;
            }
            switch (schemaNode.Type)
            {
            case SchemaNodeType.Database:
            case SchemaNodeType.Table:
            case SchemaNodeType.View:
            case SchemaNodeType.Root:
                e.Value = true; break;

            default:
                e.Value = false; break;
            }
        }
コード例 #11
0
        private void nodeIcon1_ValueNeeded(object sender, Aga.Controls.Tree.NodeControls.NodeControlValueEventArgs e)
        {
            var schemaNode = (e.Node.Tag as SchemaNode);

            if (schemaNode == null)
            {
                return;
            }
            int imageIndex = 0;

            switch (schemaNode.Type)
            {
            case SchemaNodeType.Database: imageIndex = 43; break;

            case SchemaNodeType.Table: imageIndex = 2; break;

            case SchemaNodeType.View: imageIndex = 44; break;

            case SchemaNodeType.Root: imageIndex = 36; break;
            }
            e.Value = UIController.Current.Elements.FormMain.tabularTreeImages.Images[imageIndex];
        }
コード例 #12
0
 private void watchKey_IsEditEnabledValueNeeded(object sender, Aga.Controls.Tree.NodeControls.NodeControlValueEventArgs e)
 {
     e.Value = e.Node.Tag is LuaWatchVariable;
 }
コード例 #13
0
ファイル: BPAManager.cs プロジェクト: yzwbrian/TabularEditor
 private void chkRuleEnabled_IsVisibleValueNeeded(object sender, Aga.Controls.Tree.NodeControls.NodeControlValueEventArgs e)
 {
     e.Value = e.Node.Tag is BestPracticeRule;
 }