/// <summary>
        /// Attach project editor to container control.
        /// </summary>
        public void AttachEditor()
        {
            _projectEditor    = this.DataContext as ProjectEditor;
            _containerControl = this.Find <ContainerViewControl>("containerControl");
            _zoomBorder       = this.Find <ZoomBorder>("zoomBorder");

            if (_projectEditor != null && _containerControl != null && _zoomBorder != null)
            {
                _projectEditor.Invalidate  = () => _containerControl.InvalidateVisual();
                _projectEditor.ResetZoom   = () => _zoomBorder.Reset();
                _projectEditor.AutoFitZoom = () => _zoomBorder.AutoFit();
                _projectEditor.LoadLayout  = () => { };
                _projectEditor.SaveLayout  = () => { };
                _projectEditor.ResetLayout = () => { };

                _zoomBorder.InvalidatedChild = InvalidateChild;

                _inputProcessor = new InputProcessor(
                    new AvaloniaInputSource(
                        _zoomBorder,
                        _containerControl,
                        _zoomBorder.FixInvalidPointPosition),
                    _projectEditor);
            }
        }
Beispiel #2
0
        /// <inheritdoc/>
        public override void Move(double x, double y)
        {
            base.Move(x, y);

            double sx = _editor.Project.Options.SnapToGrid ? ProjectEditor.Snap(x, _editor.Project.Options.SnapX) : x;
            double sy = _editor.Project.Options.SnapToGrid ? ProjectEditor.Snap(y, _editor.Project.Options.SnapY) : y;

            switch (_currentState)
            {
            case ToolState.None:
                if (_editor.Project.Options.TryToConnect)
                {
                    _editor.TryToHoverShape(sx, sy);
                }
                break;

            case ToolState.One:
            {
                if (_image != null)
                {
                    if (_editor.Project.Options.TryToConnect)
                    {
                        _editor.TryToHoverShape(sx, sy);
                    }
                    _image.BottomRight.X = sx;
                    _image.BottomRight.Y = sy;
                    _editor.Project.CurrentContainer.WorkingLayer.Invalidate();
                    Move(_image);
                }
            }
            break;
            }
        }
        public IActionResult ProjectEditor(int?id)
        {
            var model = new ProjectEditor
            {
                AllTeams = new SelectList(_context.Teams.OrderBy(t => t.Name).Select(t => t.Name))
            };

            if (id != null)
            {
                var project = _context.Projects
                              .Include(p => p.Teams)
                              .SingleOrDefault(p => p.Id == id);
                model.ProjectId            = project.Id;
                model.ProjectName          = project.Name;
                model.ShortDescription     = project.ShortDescription;
                model.Theme                = project.Theme;
                model.GoalDescription      = project.GoalDescription;
                model.ProblemDescription   = project.ProblemDescription;
                model.RolesDescription     = project.RolesDescription;
                model.ResultDescription    = project.ResultDescription;
                model.Curator              = project.Curator;
                model.CustomerOrganization = project.CustomerOrganization;
                model.CustomerContacts     = project.CustomerContacts;
                model.SelectedTeams        = project.Teams?.Select(t => t.Name).ToList();
            }
            return(View(model));
        }
Beispiel #4
0
        /// <summary>
        /// Attach project editor to container control.
        /// </summary>
        public void AttachEditor()
        {
            _projectEditor = this.DataContext as ProjectEditor;

            if (_projectEditor != null)
            {
                _projectEditor.Invalidate  = () => { };
                _projectEditor.ResetZoom   = () => zoomBorder.Reset();
                _projectEditor.AutoFitZoom = () => zoomBorder.AutoFit();
                _projectEditor.LoadLayout  = () => OnLoadLayout();
                _projectEditor.SaveLayout  = () => OnSaveLayout();
                _projectEditor.ResetLayout = () => OnResetLayout();

                zoomBorder.InvalidatedChild             = InvalidateChild;
                zoomBorder.PreviewMouseLeftButtonDown  += ZoomBorder_PreviewMouseLeftButtonDown;
                zoomBorder.PreviewMouseLeftButtonUp    += ZoomBorder_PreviewMouseLeftButtonUp;
                zoomBorder.PreviewMouseRightButtonDown += ZoomBorder_PreviewMouseRightButtonDown;
                zoomBorder.PreviewMouseRightButtonUp   += ZoomBorder_PreviewMouseRightButtonUp;
                zoomBorder.PreviewMouseMove            += ZoomBorder_PreviewMouseMove;

                zoomBorder.AllowDrop  = true;
                zoomBorder.DragEnter += ZoomBorder_DragEnter;
                zoomBorder.Drop      += ZoomBorder_Drop;
            }
        }
Beispiel #5
0
        /// <inheritdoc/>
        public override void LeftDown(double x, double y)
        {
            base.LeftDown(x, y);

            double sx = _editor.Project.Options.SnapToGrid ? ProjectEditor.Snap(x, _editor.Project.Options.SnapX) : x;
            double sy = _editor.Project.Options.SnapToGrid ? ProjectEditor.Snap(y, _editor.Project.Options.SnapY) : y;

            switch (_currentState)
            {
            case ToolState.None:
            {
                _shape = XLine.Create(
                    sx, sy,
                    _editor.Project.CurrentStyleLibrary.Selected,
                    _editor.Project.Options.PointShape,
                    _editor.Project.Options.DefaultIsStroked);
                if (_editor.Project.Options.TryToConnect)
                {
                    var result = TryToConnectStart(_shape as XLine, sx, sy);
                    if (!result)
                    {
                        _editor.TryToSplitLine(x, y, _shape.Start);
                    }
                }
                _editor.Project.CurrentContainer.WorkingLayer.Shapes = _editor.Project.CurrentContainer.WorkingLayer.Shapes.Add(_shape);
                _editor.Project.CurrentContainer.WorkingLayer.Invalidate();
                ToStateOne();
                Move(_shape);
                _editor.Project.CurrentContainer.HelperLayer.Invalidate();
                _currentState           = ToolState.One;
                _editor.CancelAvailable = true;
            }
            break;

            case ToolState.One:
            {
                var line = _shape as XLine;
                if (line != null)
                {
                    line.End.X = sx;
                    line.End.Y = sy;
                    if (_editor.Project.Options.TryToConnect)
                    {
                        var result = TryToConnectEnd(_shape as XLine, sx, sy);
                        if (!result)
                        {
                            _editor.TryToSplitLine(x, y, _shape.End);
                        }
                    }
                    _editor.Project.CurrentContainer.WorkingLayer.Shapes = _editor.Project.CurrentContainer.WorkingLayer.Shapes.Remove(_shape);
                    Remove();
                    Finalize(_shape);
                    _editor.Project.AddShape(_editor.Project.CurrentContainer.CurrentLayer, _shape);
                    _currentState           = ToolState.None;
                    _editor.CancelAvailable = false;
                }
            }
            break;
            }
        }
Beispiel #6
0
        /// <summary>
        /// Attach project editor to container control.
        /// </summary>
        public void AttachEditor()
        {
            _projectEditor = DataContext as ProjectEditor;

            if (_projectEditor != null)
            {
                _projectEditor.CanvasPlatform.Invalidate  = () => { };
                _projectEditor.CanvasPlatform.ResetZoom   = () => zoomBorder.Reset();
                _projectEditor.CanvasPlatform.AutoFitZoom = () => zoomBorder.AutoFit();

                _projectEditor.LayoutPlatform.LoadLayout  = () => OnLoadLayout();
                _projectEditor.LayoutPlatform.SaveLayout  = () => OnSaveLayout();
                _projectEditor.LayoutPlatform.ResetLayout = () => OnResetLayout();

                zoomBorder.InvalidatedChild = InvalidateChild;

                _inputProcessor = new InputProcessor(
                    new WpfInputSource(
                        zoomBorder,
                        drawableControl,
                        (point) => point),
                    _projectEditor);

                zoomBorder.AllowDrop  = true;
                zoomBorder.DragEnter += ZoomBorder_DragEnter;
                zoomBorder.Drop      += ZoomBorder_Drop;
            }
        }
Beispiel #7
0
        /// <inheritdoc/>
        public override void LeftDown(double x, double y)
        {
            base.LeftDown(x, y);

            double sx = _editor.Project.Options.SnapToGrid ? ProjectEditor.Snap(x, _editor.Project.Options.SnapX) : x;
            double sy = _editor.Project.Options.SnapToGrid ? ProjectEditor.Snap(y, _editor.Project.Options.SnapY) : y;

            switch (_currentState)
            {
            case ToolState.None:
            {
                _point = XPoint.Create(sx, sy, _editor.Project.Options.PointShape);

                if (_editor.Project.Options.TryToConnect)
                {
                    if (!_editor.TryToSplitLine(x, y, _point, true))
                    {
                        _editor.Project.AddShape(_editor.Project.CurrentContainer.CurrentLayer, _point);
                    }
                }
                else
                {
                    _editor.Project.AddShape(_editor.Project.CurrentContainer.CurrentLayer, _point);
                }
            }
            break;
            }
        }
Beispiel #8
0
        /// <summary>
        /// Detach project editor from container control.
        /// </summary>
        public void DetachEditor()
        {
            if (_projectEditor != null)
            {
                _projectEditor.CanvasPlatform.Invalidate  = null;
                _projectEditor.CanvasPlatform.ResetZoom   = null;
                _projectEditor.CanvasPlatform.AutoFitZoom = null;

                _projectEditor.LayoutPlatform.LoadLayout  = null;
                _projectEditor.LayoutPlatform.SaveLayout  = null;
                _projectEditor.LayoutPlatform.ResetLayout = null;

                zoomBorder.InvalidatedChild = null;

                _inputProcessor.Dispose();
                _inputProcessor = null;
                _inputSource    = null;

                zoomBorder.AllowDrop  = false;
                zoomBorder.DragEnter -= ZoomBorder_DragEnter;
                zoomBorder.Drop      -= ZoomBorder_Drop;
            }

            _projectEditor = null;
        }
Beispiel #9
0
    public static ProjectEditor ShowWindow()
    {
        ProjectEditor window = GetWindow <ProjectEditor>("Blueprint Editor");

        window.minSize = new Vector2(600, 400);
        return(window);
    }
Beispiel #10
0
        private void CreateEditor(string domainName)
        {
            if (Database.ProjectEditors.Any(pe => pe.Project == Project && pe.Editor == domainName))
            {
                MessageBox.Show("The editor is already on the project.  Try again", "Database Error", MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
                EditorTextBox.Focus();
                CreateButton.Enabled = false;
                return;
            }
            var editor = new ProjectEditor
            {
                Project = Project,
                Editor  = domainName,
            };

            Database.ProjectEditors.InsertOnSubmit(editor);
            if (!SubmitChanges())
            {
                Database.ProjectEditors.DeleteOnSubmit(editor);
                EditorTextBox.Focus();
                CreateButton.Enabled = false;
                return;
            }
            OnDatabaseChanged();
            Close();
        }
Beispiel #11
0
        /// <summary>
        /// Detach project editor from container control.
        /// </summary>
        public void DetachEditor()
        {
            if (_projectEditor != null)
            {
                _projectEditor.Invalidate  = null;
                _projectEditor.ResetZoom   = null;
                _projectEditor.AutoFitZoom = null;
                _projectEditor.LoadLayout  = null;
                _projectEditor.SaveLayout  = null;
                _projectEditor.ResetLayout = null;

                zoomBorder.InvalidatedChild             = null;
                zoomBorder.PreviewMouseLeftButtonDown  -= ZoomBorder_PreviewMouseLeftButtonDown;
                zoomBorder.PreviewMouseLeftButtonUp    -= ZoomBorder_PreviewMouseLeftButtonUp;
                zoomBorder.PreviewMouseRightButtonDown -= ZoomBorder_PreviewMouseRightButtonDown;
                zoomBorder.PreviewMouseRightButtonUp   -= ZoomBorder_PreviewMouseRightButtonUp;
                zoomBorder.PreviewMouseMove            -= ZoomBorder_PreviewMouseMove;

                zoomBorder.AllowDrop  = false;
                zoomBorder.DragEnter -= ZoomBorder_DragEnter;
                zoomBorder.Drop      -= ZoomBorder_Drop;
            }

            _projectEditor = null;
        }
Beispiel #12
0
        void ContentTreeView_AfterSelect(object sender, TreeViewEventArgs e)
        {
            if (e.Node.Tag != null)
            {
                //显示项目信息
                if (e.Node.Tag is Project)
                {
                    #region 显示数据
                    plContent.Controls.Clear();
                    ProjectEditor pe = new ProjectEditor();
                    pe.loadData((Project)e.Node.Tag);
                    pe.Dock = DockStyle.Fill;
                    plContent.Controls.Add(pe);
                    #endregion

                    lblHint.Text = "数量:1,金额:" + ((Project)e.Node.Tag).TotalMoney;
                }
            }
            else
            {
                plContent.Controls.Clear();
                plContent2.Controls.Clear();

                //显示数量及金额
                int     projCount      = 0;
                decimal projMoneyCount = 0;

                //统计数量
                countMoneyAndCount(e.Node, ref projCount, ref projMoneyCount);

                lblHint.Text = "数量:" + projCount + ",金额:" + projMoneyCount;
            }
        }
Beispiel #13
0
        /// <inheritdoc/>
        public override void LeftDown(double x, double y)
        {
            base.LeftDown(x, y);

            double sx = _editor.Project.Options.SnapToGrid ? ProjectEditor.Snap(x, _editor.Project.Options.SnapX) : x;
            double sy = _editor.Project.Options.SnapToGrid ? ProjectEditor.Snap(y, _editor.Project.Options.SnapY) : y;

            switch (_currentState)
            {
            case ToolState.None:
            {
                var style = _editor.Project.CurrentStyleLibrary.Selected;
                _text = XText.Create(
                    sx, sy,
                    _editor.Project.Options.CloneStyle ? style.Clone() : style,
                    _editor.Project.Options.PointShape,
                    "Text",
                    _editor.Project.Options.DefaultIsStroked);

                var result = _editor.TryToGetConnectionPoint(sx, sy);
                if (result != null)
                {
                    _text.TopLeft = result;
                }

                _editor.Project.CurrentContainer.WorkingLayer.Shapes = _editor.Project.CurrentContainer.WorkingLayer.Shapes.Add(_text);
                _editor.Project.CurrentContainer.WorkingLayer.Invalidate();
                ToStateOne();
                Move(_text);
                _currentState           = ToolState.One;
                _editor.CancelAvailable = true;
            }
            break;

            case ToolState.One:
            {
                if (_text != null)
                {
                    _text.BottomRight.X = sx;
                    _text.BottomRight.Y = sy;

                    var result = _editor.TryToGetConnectionPoint(sx, sy);
                    if (result != null)
                    {
                        _text.BottomRight = result;
                    }

                    _editor.Project.CurrentContainer.WorkingLayer.Shapes = _editor.Project.CurrentContainer.WorkingLayer.Shapes.Remove(_text);
                    Remove();
                    Finalize(_text);
                    _editor.Project.AddShape(_editor.Project.CurrentContainer.CurrentLayer, _text);
                    _currentState           = ToolState.None;
                    _editor.CancelAvailable = false;
                }
            }
            break;
            }
        }
Beispiel #14
0
 private void load(ProjectEditor editor)
 {
     Child = mainContent = new ContainedImage(true, 0)
     {
         RelativeSizeAxes = Axes.Both,
     };
     currentEditing.BindTo(editor.CurrentEditingElement);
     currentEditing.BindValueChanged(_ => RecreatePreview());
 }
 private void load(ProjectEditor editor)
 {
     Action += () => editor.SelectElement(Element);
     currentEditing.BindTo(editor.CurrentEditingElement);
     currentEditing.BindValueChanged(_ =>
     {
         FadeBorder(selected || IsHovered, golden: selected);
     });
     FadeBorder(selected, true, selected);
 }
Beispiel #16
0
        public void editProject()
        {
            UndoService.Current[GetUndoRoot()].BeginChangeSetBatch("EditProject", false);
            var           Vm     = (new ViewModelLocator()).ProjectEditor;
            ProjectEditor dialog = new ProjectEditor();

            Vm.Project = Project;
            dialog.ShowDialog();
            UndoService.Current[GetUndoRoot()].EndChangeSetBatch();
        }
Beispiel #17
0
        public void CreateFixtureObjects()
        {
            project = new NUnitProject( "temp.nunit" );
            project.Configs.Add( "Debug" );
            project.Configs.Add( "Release" );

            editor = new ProjectEditor( project );

            this.Form = editor;
        }
Beispiel #18
0
        private void load(ProjectEditor editor, ImagePickerOverlay imagePicker)
        {
            Action = () => imagePicker.QueryImage(imageName);
            Editing.BindTo(editor.CurrentEditingElement.Value.Images[imageName]);

            TextureChanged = newTexture =>
            {
                changeImageText.Text = newTexture == null ? @"Añadir Imagen" : @"Cambiar Imagen";
            };
        }
Beispiel #19
0
 /// <summary>
 /// Initialize new instance of <see cref="ToolPath"/> class.
 /// </summary>
 /// <param name="editor">The current <see cref="ProjectEditor"/> object.</param>
 public ToolPath(ProjectEditor editor)
     : base()
 {
     _editor                  = editor;
     _isInitialized           = false;
     _toolPathLine            = new ToolPathLine(_editor, this);
     _toolPathArc             = new ToolPathArc(_editor, this);
     _toolPathCubicBezier     = new ToolPathCubicBezier(_editor, this);
     _toolPathQuadraticBezier = new ToolPathQuadraticBezier(_editor, this);
 }
Beispiel #20
0
        public void CreateFixtureObjects()
        {
            project = new NUnitProject("temp.nunit");
            project.Configs.Add("Debug");
            project.Configs.Add("Release");

            editor = new ProjectEditor(project);

            this.Form = editor;
        }
        public IActionResult AddProject(ProjectEditor model)
        {
            var teams = new List <Team>();

            model.SelectedTeams?.ForEach(t => teams.Add(_context.Teams.Include(p => p.Project).Include(u => u.Members).SingleOrDefault(i => i.Name == t)));
            var members = new List <User>();

            foreach (var team in teams)
            {
                foreach (var student in team.Members)
                {
                    members.Add(student);
                }
            }
            if (model.ProjectId == null)
            {
                var newProject = new Project
                {
                    Name                 = model.ProjectName,
                    ShortDescription     = model.ShortDescription,
                    Teams                = teams,
                    Theme                = model.Theme,
                    GoalDescription      = model.GoalDescription,
                    ProblemDescription   = model.ProblemDescription,
                    RolesDescription     = model.RolesDescription,
                    ResultDescription    = model.ResultDescription,
                    Curator              = model.Curator,
                    CustomerOrganization = model.CustomerOrganization,
                    CustomerContacts     = model.CustomerContacts,
                    Participants         = members
                };
                _context.Projects.Add(newProject);
                _context.SaveChanges();
                return(RedirectToAction("AllProjects", "Projects"));
            }
            else
            {
                var projectToUpdate = _context.Projects.Include(p => p.Teams).SingleOrDefault(p => p.Id == model.ProjectId);
                projectToUpdate.Name                 = model.ProjectName;
                projectToUpdate.ShortDescription     = model.ShortDescription;
                projectToUpdate.Teams                = teams;
                projectToUpdate.Theme                = model.Theme;
                projectToUpdate.GoalDescription      = model.GoalDescription;
                projectToUpdate.ProblemDescription   = model.ProblemDescription;
                projectToUpdate.RolesDescription     = model.RolesDescription;
                projectToUpdate.ResultDescription    = model.ResultDescription;
                projectToUpdate.Curator              = model.Curator;
                projectToUpdate.CustomerOrganization = model.CustomerOrganization;
                projectToUpdate.CustomerContacts     = model.CustomerContacts;
                projectToUpdate.Participants         = members;
                _context.Update(projectToUpdate);
                _context.SaveChanges();
                return(RedirectToAction("ProjectPage", "Projects", new { id = model.ProjectId }));
            }
        }
Beispiel #22
0
        /// <inheritdoc/>
        public override void LeftDown(double x, double y)
        {
            base.LeftDown(x, y);

            if (_isInitialized && _editor.CurrentPathTool != _previousPathTool)
            {
                SwitchPathTool(x, y);
                return;
            }

            switch (_editor.CurrentPathTool)
            {
            case PathTool.Line:
            {
                _toolPathLine.LeftDown(x, y);
            }
            break;

            case PathTool.Arc:
            {
                _toolPathArc.LeftDown(x, y);
            }
            break;

            case PathTool.CubicBezier:
            {
                _toolPathCubicBezier.LeftDown(x, y);
            }
            break;

            case PathTool.QuadraticBezier:
            {
                _toolPathQuadraticBezier.LeftDown(x, y);
            }
            break;

            case PathTool.Move:
            {
                double sx = _editor.Project.Options.SnapToGrid ? ProjectEditor.Snap(x, _editor.Project.Options.SnapX) : x;
                double sy = _editor.Project.Options.SnapToGrid ? ProjectEditor.Snap(y, _editor.Project.Options.SnapY) : y;

                // Start new figure.
                var start = _editor.TryToGetConnectionPoint(sx, sy) ?? XPoint.Create(sx, sy, _editor.Project.Options.PointShape);
                _context.BeginFigure(
                    start,
                    _editor.Project.Options.DefaultIsFilled,
                    _editor.Project.Options.DefaultIsClosed);

                // Switch to path tool before Move tool.
                _editor.CurrentPathTool = _movePathTool;
                SwitchPathTool(x, y);
            }
            break;
            }
        }
        private void Bt_ProjectAdd_OnClick(object sender, RoutedEventArgs e)
        {
            var project = new ProjectListing();
            var diag    = new ProjectEditor();

            diag.Open(project);
            var view = new ProjectViewModel(project);

            Config.Projects.Add(view);
            SaveConfig();
        }
Beispiel #24
0
        private bool Validate(ProjectEditor editor, object sender, DragEventArgs e, bool bExecute)
        {
            var point = DropHelper.GetPosition(sender, e);

            switch (sender)
            {
            case ListBox list:
                return(ValidateListBox(editor, e, bExecute, list));
            }

            return(false);
        }
Beispiel #25
0
        private bool Validate(ProjectEditor editor, object sender, DragEventArgs e, bool bExecute)
        {
            var point = DropHelper.GetPosition(sender, e);

            switch (sender)
            {
            case TreeView tree:
                return(ValidateTreeView(editor, e, bExecute, tree));
            }

            return(false);
        }
Beispiel #26
0
        public frmSelectType(clsApplyRecord vo)
        {
            InitializeComponent();
            printer       = new FormPrinter();
            objProEdit    = new ProjectEditor(this);
            objAR_VO      = vo;
            objChargeItem = (clsChargeItemSvc)com.digitalwave.iCare.common.clsObjectGenerator.objCreatorObjectByType(typeof(clsChargeItemSvc));
            //new clsChargeItemSvc();

            this.cmdTerm.Text = "编号";
            dataProc          = (DataProcess)com.digitalwave.iCare.common.clsObjectGenerator.objCreatorObjectByType(typeof(DataProcess));
        }
Beispiel #27
0
        /// <inheritdoc/>
        public override void Move(double x, double y)
        {
            base.Move(x, y);

            double sx = _editor.Project.Options.SnapToGrid ? ProjectEditor.Snap(x, _editor.Project.Options.SnapX) : x;
            double sy = _editor.Project.Options.SnapToGrid ? ProjectEditor.Snap(y, _editor.Project.Options.SnapY) : y;

            switch (_currentState)
            {
            case ToolState.None:
            {
                if (_editor.Project.Options.TryToConnect)
                {
                    _editor.TryToHoverShape(sx, sy);
                }
            }
            break;

            case ToolState.One:
            {
                if (_quadraticBezier != null)
                {
                    if (_editor.Project.Options.TryToConnect)
                    {
                        _editor.TryToHoverShape(sx, sy);
                    }
                    _quadraticBezier.Point2.X = sx;
                    _quadraticBezier.Point2.Y = sy;
                    _quadraticBezier.Point3.X = sx;
                    _quadraticBezier.Point3.Y = sy;
                    _editor.Project.CurrentContainer.WorkingLayer.Invalidate();
                    Move(_quadraticBezier);
                }
            }
            break;

            case ToolState.Two:
            {
                if (_quadraticBezier != null)
                {
                    if (_editor.Project.Options.TryToConnect)
                    {
                        _editor.TryToHoverShape(sx, sy);
                    }
                    _quadraticBezier.Point2.X = sx;
                    _quadraticBezier.Point2.Y = sy;
                    _editor.Project.CurrentContainer.WorkingLayer.Invalidate();
                    Move(_quadraticBezier);
                }
            }
            break;
            }
        }
        private void PL_ContextEdit(object sender, RoutedEventArgs e)
        {
            if (_current == null)
            {
                return;
            }

            var diag = new ProjectEditor();

            diag.Open(_current.Project);
            _current.RefreshModel();
            SaveConfig();
        }
Beispiel #29
0
        private bool Validate(ProjectEditor editor, object sender, DragEventArgs e, bool bExecute)
        {
            var point = DropHelper.GetPosition(sender, e);

            if (e.Data.Contains(DataFormats.Text))
            {
                var text = e.Data.GetText();

                if (bExecute)
                {
                    editor?.OnTryPaste(text);
                }

                return(true);
            }

            foreach (var format in e.Data.GetDataFormats())
            {
                var data = e.Data.Get(format);

                switch (data)
                {
                case BaseShape shape:
                    return(editor?.OnDropShape(shape, point.X, point.Y, bExecute) == true);

                case Record record:
                    return(editor?.OnDropRecord(record, point.X, point.Y, bExecute) == true);

                case ShapeStyle style:
                    return(editor?.OnDropStyle(style, point.X, point.Y, bExecute) == true);

                case PageContainer page:
                    return(editor?.OnDropTemplate(page, point.X, point.Y, bExecute) == true);

                default:
                    break;
                }
            }

            if (e.Data.Contains(DataFormats.FileNames))
            {
                var files = e.Data.GetFileNames().ToArray();
                if (bExecute)
                {
                    editor?.OnDropFiles(files);
                }
                return(true);
            }

            return(false);
        }
Beispiel #30
0
        protected override DialogResult showAddDialog(Project entity)
        {
            ProjectEditor projectEditor = new ProjectEditor((ProjectDao)this.dao);

            try
            {
                projectEditor.renderEntity();
                return(projectEditor.ShowDialog(this));
            }
            catch (Exception ex)
            {
                MyMessageBox msgBox = new MyMessageBox("Data error!", ex, MyConstants.BOX_TYPE_ERROR);
                msgBox.ShowDialog(this);
                return(DialogResult.Abort);
            }
        }
Beispiel #31
0
        private void load(ProjectEditor editor)
        {
            RelativeSizeAxes = Axes.Both;

            Child = new Container
            {
                Margin          = new MarginPadding(15),
                AutoSizeAxes    = Axes.Both,
                Masking         = true,
                CornerRadius    = 10,
                BorderColour    = Colour4.White,
                BorderThickness = 5,
                EdgeEffect      = new EdgeEffectParameters
                {
                    Type   = EdgeEffectType.Glow,
                    Colour = Colour4.White.Opacity(100),
                    Radius = 10,
                    Hollow = true,
                },
                Children = new Drawable[]
                {
                    new Box
                    {
                        RelativeSizeAxes = Axes.Both,
                        Colour           = Colour4.Black.Opacity(150),
                    },
                    new FillFlowContainer
                    {
                        Margin       = new MarginPadding(15),
                        AutoSizeAxes = Axes.Both,
                        Direction    = FillDirection.Vertical,
                        Spacing      = new Vector2(10),
                        Children     = new Drawable[]
                        {
                            new ActionButton(FontAwesome.Solid.Save, @"Guardar proyecto")
                            {
                                Action = () => editor.SaveProject(CommunityStatus.Saved),
                            },
                            new ActionButton(FontAwesome.Solid.Upload, @"Subir proyecto")
                            {
                                Action = editor.UploadProject,
                            },
                        },
                    },
                },
            };
        }
Beispiel #32
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ShapeFactory"/> class.
 /// </summary>
 /// <param name="editor">The current <see cref="ProjectEditor"/> instance.</param>
 public ShapeFactory(ProjectEditor editor)
 {
     _editor = editor;
 }
 private void CreateEditor(string domainName)
 {
     if (Database.ProjectEditors.Any(pe => pe.Project == Project && pe.Editor == domainName))
     {
         MessageBox.Show("The editor is already on the project.  Try again", "Database Error", MessageBoxButtons.OK,
                         MessageBoxIcon.Error);
         EditorTextBox.Focus();
         CreateButton.Enabled = false;
         return;
     }
     var editor = new ProjectEditor
     {
         Project = Project,
         Editor = domainName,
     };
     Database.ProjectEditors.InsertOnSubmit(editor);
     if (!SubmitChanges())
     {
         Database.ProjectEditors.DeleteOnSubmit(editor);
         EditorTextBox.Focus();
         CreateButton.Enabled = false;
         return;
     }
     OnDatabaseChanged();
     Close();
 }