Exemplo n.º 1
0
        protected override void OnExecuted(EventArgs e)
        {
            var dialog = new AttributeDialog(handler, handler.CurrentPage.Palette, handler.DrawAttribute, handler.CharacterDocument.ICEColours);

            if (dialog.ShowModal(handler.Viewer as Control))
            {
                handler.DrawAttribute = dialog.Attribute;
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Handles displaying of AttributeDialog after double click on an attribute.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void OnAttributeDoubleClick(object sender, MouseButtonEventArgs e)
 {
     if ((sender as TreeViewItem).DataContext is Property)
     {
         Property property       = (sender as TreeViewItem).DataContext as Property;
         var      propertyDialog = new AttributeDialog(
             property, new ClassController(property.Class as PIMClass, null), project.GetModelController());
         propertyDialog.ShowDialog();
     }
 }
Exemplo n.º 3
0
 private void OnAttributeEditClick(object sender, RoutedEventArgs e)
 {
     if ((sender as MenuItem).DataContext is Property)
     {
         Property property       = (sender as MenuItem).DataContext as Property;
         var      propertyDialog = new AttributeDialog(
             property, new ClassController(property.Class as PIMClass, null), project.GetModelController());
         propertyDialog.ShowDialog();
     }
 }
        public void Execute(object parameter)
        {
            int id = (int)parameter;

            if (id == -1)
            {
                EntityDialog dialog = new EntityDialog();
                dialog.DataContext = VM;
                dialog.ShowDialog();
            }
            else
            {
                VM.SelectedEntityRecord = (EntityRecord)VM.EntityRecords.Where(item => item.Entity.Id == id).FirstOrDefault();
                AttributeDialog dialog = new AttributeDialog();
                dialog.DataContext = VM;
                dialog.ShowDialog();
            }
        }
        /// <summary>
        /// <c>EA_MenuClick</c> events are received by an Add-In in response to user selection of a menu option.
        /// The event is raised when the user clicks on a particular menu option. When a user clicks on one of your non-parent menu options, your Add-In receives a <c>MenuClick</c> event.
        /// Notice that your code can directly access Enterprise Architect data and UI elements using Repository methods.
        /// </summary>
        /// <param name="repository"><c>An EA.Repository</c> object representing the currently open Enterprise Architect model. Poll its members to retrieve model data and user interface status information.</param>
        /// <param name="location">Not used</param>
        /// <param name="menuName">The name of the parent menu for which sub-items are to be defined.
        /// In the case of the top-level menu this is an empty string.</param>
        /// <param name="itemName">The name of the option actually clicked.</param>
        public void EA_MenuClick(Repository repository, string location, string menuName, string itemName)
        {
            var itemType = repository.GetContextItemType();

            switch (itemType)
            {
            case ObjectType.otElement:
                _window    = new ElementDialog();
                _viewModel = new ElementDialogViewModel
                {
                    Repository = repository
                };
                break;

            case ObjectType.otPackage:
                _window    = new PackageDialog();
                _viewModel = new PackageDialogViewModel
                {
                    Repository = repository
                };
                break;

            case ObjectType.otAttribute:
                _window    = new AttributeDialog();
                _viewModel = new AttributeDialogViewModel
                {
                    Repository = repository
                };
                break;

            case ObjectType.otConnector:
                _window    = new ConnectorDialog();
                _viewModel = new ConnectorDialogViewModel
                {
                    Repository = repository
                };
                break;
            }

            //Create new ResourceDictionary and set source for language matching the selected menu option
            var dict = new ResourceDictionary();

            switch (itemName)
            {
            case DanishMenuOption:
                dict.Source = new Uri("pack://application:,,,/PlusprofilAddin;component/Resources/StringResources.da-DK.xaml",
                                      UriKind.Absolute);
                break;

            case EnglishMenuOption:
                dict.Source = new Uri("pack://application:,,,/PlusprofilAddin;component/Resources/StringResources.en-US.xaml",
                                      UriKind.Absolute);
                break;

            default:
                throw new ArgumentException("Invalid Menu Option selected");
            }
            _window.Resources.MergedDictionaries.Add(dict);
            _viewModel.ResourceDictionary = dict;
            _viewModel.Initialize();
            _window.DataContext = _viewModel;

            // Set window size
            _window.MinHeight = _window.Height = 512;
            _window.MinWidth  = _window.Width = 576;

            // Increase size for Connector dialogs
            if (_window is ConnectorDialog)
            {
                _window.MinHeight = _window.Height = 512;
                _window.MinWidth  = _window.Width = 768;
            }

            _window.Closing += _viewModel.OnWindowClosing;

            _window.ShowDialog();
        }
Exemplo n.º 6
0
        public void ShowAttributeDialog(PSMAttribute attribute)
        {
            AttributeDialog attributeDialog = new AttributeDialog(attribute, this, DiagramController.ModelController);

            attributeDialog.ShowDialog();
        }