public void Show(string message, bool isError)
        {
            if (string.IsNullOrEmpty(message))
            {
                Hide();
                return;
            }

            ImageIcon       = isError ? ActiveQueryBuilder.View.WPF.Images.Common.Exclamation.Value : ActiveQueryBuilder.View.WPF.Images.Common.AlertExclamation.Value;
            BoxMessage.Text = message;

            if (isError)
            {
                var link = new Hyperlink(
                    new Run(Helpers.Localizer.GetString("StrFixIssue", Helpers.ConvertLanguageFromNative(Language), LocalizableConstantsUI.strFixIssue)));

                link.Click += delegate
                {
                    OnFixIssue();
                };

                BoxMessage.Inlines.Add(" ");
                BoxMessage.Inlines.Add(link);
            }

            Visibility = Visibility.Visible;
        }
Example #2
0
        private void Separator_OnMouseRightButtonUp(object sender, MouseButtonEventArgs e)
        {
            if (_separatorContextMenu != null)
            {
                _separatorContextMenu.IsOpen = false;
                _separatorContextMenu        = null;
            }

            var point = e.GetPosition(this);

            _separatorContextMenu = new ContextMenu()
            {
                Placement        = PlacementMode.RelativePoint,
                PlacementTarget  = this,
                HorizontalOffset = point.X,
                VerticalOffset   = point.Y
            };
            var menuItem = new MenuItem()
            {
                Header = Helpers.Localizer.GetString("strMetadataStructureTreeVisibility",
                                                     Helpers.ConvertLanguageFromNative(Language),
                                                     LocalizableConstantsUI.strMetadataStructureTreeVisibility),
                IsChecked = StructureTreeVisible
            };

            menuItem.Click += MenuItem_Click;
            _separatorContextMenu.IsOpen = true;
        }
        private void UpdateLocalization()
        {
            Title = Helpers.Localizer.GetString("strMetadataEditor", Helpers.ConvertLanguageFromNative(Language), LocalizableConstantsInternal.strMetadataEditor);

            tsmiLoadFromDatabase.Header = Helpers.Localizer.GetString("strLoadFromDatabase", Helpers.ConvertLanguageFromNative(Language),
                                                                      LocalizableConstantsInternal.strLoadFromDatabase);
            containerToolStripMenuItem.Header = Helpers.Localizer.GetString("strMetadataContainer", Helpers.ConvertLanguageFromNative(Language),
                                                                            LocalizableConstantsInternal.strMetadataContainer);
            structureToolStripMenuItem.Header = Helpers.Localizer.GetString("strMetadataStructure", Helpers.ConvertLanguageFromNative(Language),
                                                                            LocalizableConstantsInternal.strMetadataStructure);
            toolStripLabel.Text =
                Helpers.Localizer.GetString("strSyntaxProvider", Helpers.ConvertLanguageFromNative(Language), LocalizableConstantsInternal.strSyntaxProvider);
        }
        private void btnExportMetadataToXml_Click()
        {
            SaveFileDialog saveDialog = new SaveFileDialog
            {
                Title = Helpers.Localizer.GetString("strContainerExportDescr", Helpers.ConvertLanguageFromNative(Language),
                                                    LocalizableConstantsInternal.strContainerExportDescr),
                Filter = @"XML files (*.xml)|*.xml|All files (*.*)|*.*"
            };

            if (saveDialog.ShowDialog() == true)
            {
                _sqlContext.MetadataContainer.ExportToXML(saveDialog.FileName);
            }
        }
        private void UpdateLocalization()
        {
            tsmiLoadFromDatabase.Header = Helpers.Localizer.GetString("strLoadFromDatabase", Helpers.ConvertLanguageFromNative(Language),
                                                                      LocalizableConstantsInternal.strLoadFromDatabase);
            containerToolStripMenuItem.Header = Helpers.Localizer.GetString("strMetadataContainer", Helpers.ConvertLanguageFromNative(Language),
                                                                            LocalizableConstantsInternal.strMetadataContainer);
            structureToolStripMenuItem.Header = Helpers.Localizer.GetString("strMetadataStructure", Helpers.ConvertLanguageFromNative(Language),
                                                                            LocalizableConstantsInternal.strMetadataStructure);
            toolStripLabel.Text =
                Helpers.Localizer.GetString("strSyntaxProvider", Helpers.ConvertLanguageFromNative(Language), LocalizableConstantsInternal.strSyntaxProvider);

            if (_aboutMenuItem != null)
            {
                _aboutMenuItem.Header =
                    Helpers.Localizer.GetString("strAboutShort", Helpers.ConvertLanguageFromNative(Language), LocalizableConstantsUI.strAboutShort);
            }
        }
        private void btnImportStructureFromXml_Click()
        {
            OpenFileDialog openDialog = new OpenFileDialog
            {
                Title = Helpers.Localizer.GetString("strStructureImportDescr", Helpers.ConvertLanguageFromNative(Language),
                                                    LocalizableConstantsInternal.strStructureImportDescr),
                Filter = @"XML files (*.xml)|*.xml|All files (*.*)|*.*"
            };


            if (openDialog.ShowDialog() != true)
            {
                return;
            }

            _sqlContext.MetadataStructure.ImportFromXML(openDialog.FileName);
            _sqlContext.MetadataStructure.Refresh();

            MetadataEditor.IsChanged = false;
        }
        private void btnCancel_Click()
        {
            if (MetadataEditor.IsChanged)
            {
                var result = MessageBox.Show(
                    Helpers.Localizer.GetString("strAllChangesWillLost", Helpers.ConvertLanguageFromNative(Language),
                                                LocalizableConstantsInternal.strAllChangesWillLost),
                    Helpers.Localizer.GetString("strWarning", Helpers.ConvertLanguageFromNative(Language), LocalizableConstantsUI.strWarning),
                    MessageBoxButton.OKCancel,
                    MessageBoxImage.Warning);

                if (result == MessageBoxResult.Cancel)
                {
                    DialogResult = false;
                }
            }
            else
            {
                DialogResult = false;
            }
        }
Example #8
0
        public void AppendStructureFilterControl(object control, bool isExpanded)
        {
            var c = control as FrameworkElement;

            if (c == null)
            {
                return;
            }

            var filterControl = new GroupContainer
            {
                CanCollapse = true,
                Text        = Helpers.Localizer.GetString("strMetadataStructureFilter", Helpers.ConvertLanguageFromNative(Language),
                                                          LocalizableConstantsInternal.strMetadataStructureFilter),
                VerticalAlignment = VerticalAlignment.Top,
                IsExpanded        = isExpanded
            };

            var row = 0;

            ((Grid)PropertiesBar).RowDefinitions.Clear();

            foreach (FrameworkElement child in ((Grid)PropertiesBar).Children)
            {
                child.SetValue(Grid.RowProperty, row);
                ((Grid)PropertiesBar).RowDefinitions.Add(new RowDefinition {
                    Height = GridLength.Auto
                });
                row++;
            }

            ((Grid)PropertiesBar).RowDefinitions.Add(new RowDefinition());

            filterControl.AddSecondaryControl(c);

            filterControl.SetValue(Grid.RowProperty, row);

            ((Grid)PropertiesBar).Children.Add(filterControl);
        }
        private void btnOK_Click()
        {
            var errorList = MetadataEditor.ValidateBeforeApply();

            if (errorList.Count == 0)
            {
                ApplyChanges();
                DialogResult = true;
                return;
            }

            var form   = new ErrorListForm("Warning", Helpers.Localizer.GetString("strErrorsFound", Helpers.ConvertLanguageFromNative(Language), LocalizableConstantsInternal.strErrorsFound), errorList, true);
            var result = form.ShowDialog();

            if (result != true)
            {
                return;
            }

            ApplyChanges();
            DialogResult = true;
        }
        private void btnImportMetadataFromXml_Click()
        {
            OpenFileDialog openDialog = new OpenFileDialog();

            openDialog.Title = Helpers.Localizer.GetString("strContainerExportDescr", Helpers.ConvertLanguageFromNative(Language),
                                                           LocalizableConstantsInternal.strContainerImportDescr);
            openDialog.Filter = @"XML files (*.xml)|*.xml|All files (*.*)|*.*";

            if (openDialog.ShowDialog() != true)
            {
                return;
            }

            var errorList = new List <string>();
            var log       = new MetadataEditorControl.ListLog(errorList);

            _sqlContext.MetadataContainer.SQLContext.Logger.Log = log;
            _sqlContext.MetadataContainer.ImportFromXML(openDialog.FileName);

            if (errorList.Count > 1)
            {
                var errorForm = new ErrorListForm("Warning",
                                                  Helpers.Localizer.GetString("strErrorWhileImport", Helpers.ConvertLanguageFromNative(Language),
                                                                              LocalizableConstantsInternal.strErrorWhileImport) + ":", errorList);
                errorForm.ShowDialog();
            }

            MetadataEditor.RefreshContainerTree();
            MetadataEditor.IsChanged = false;
        }