示例#1
0
        private static void GeneratedClassNamespaceChanged(DependencyObject dependencyObject,
                                                           DependencyPropertyChangedEventArgs dependencyPropertyChangedEventArgs)
        {
            var pane = dependencyObject as CompilerPane;

            var newValue = dependencyPropertyChangedEventArgs.NewValue as string;

            if (pane != null)
            {
                if (string.IsNullOrWhiteSpace(newValue))
                {
                    pane.CurrentCompilerConfiguration.OpenSimCompilerSettings.GeneratedClassNamespace = null;
                    return;
                }

                var validation = CSharpNamespaceNameValidator.Validate(newValue);
                if (!validation.Success)
                {
                    throw new Exception(validation.ErrorDescription);
                }

                pane.CurrentCompilerConfiguration.OpenSimCompilerSettings.GeneratedClassNamespace =
                    new CSharpNamespace(newValue);
            }
        }
示例#2
0
        private static void NamespaceImportAddTextChangedCallback(DependencyObject dependencyObject,
                                                                  DependencyPropertyChangedEventArgs dependencyPropertyChangedEventArgs)
        {
            var pane = (CompilerPane)dependencyObject;


            var val = dependencyPropertyChangedEventArgs.NewValue as string;

            if (val == null)
            {
                return;
            }

            var validation = CSharpNamespaceNameValidator.Validate(val);

            if (!validation.Success)
            {
                throw new Exception(validation.ErrorDescription);
            }
        }