Example #1
0
        private void ReadViewBeforeExiting()
        {
            using (new SessionScope(MetaManagerServices.GetSessionFactory(), MetaManagerServices.GetDomainInterceptor(), true, FlushMode.Never, true))
            {
                View = dialogService.GetViewById(View.Id);

                NHibernateUtil.Initialize(View.Application);
                NHibernateUtil.Initialize(View.RequestMap);
                NHibernateUtil.Initialize(View.ResponseMap);
            }
        }
Example #2
0
        private void EditView_Load(object sender, EventArgs e)
        {
            if (View != null)
            {
                // Read the dialog to get the latest info from database
                View = modelService.GetInitializedDomainObject <DataAccess.Domain.View>(View.Id);

                tbName.Text  = View.Name;
                tbTitle.Text = View.Title;
                LayoutManualyAdaptedcheckBox.Checked = View.LayoutManualyAdapted;
            }
        }
Example #3
0
        private void okBtn_Click(object sender, EventArgs e)
        {
            if (lvResult.SelectedItems.Count == 1)
            {
                View = lvResult.SelectedItems[0].Tag as Cdc.MetaManager.DataAccess.Domain.View;

                ReadViewBeforeExiting();

                DialogResult = DialogResult.OK;

                Close();
            }
        }
        private void EditViewNode_Load(object sender, EventArgs e)
        {
            // Read the ViewNode
            ViewNode = dialogService.GetViewNodeById(ViewNode.Id);

            tbViewNodeTitle.Text = ViewNode.Title;

            btnVisible.Checked = ViewNode.Visibility == UXVisibility.Visible;

            foreach (RenderMode type in Enum.GetValues(typeof(RenderMode)))
            {
                modeCbx.Items.Add(type.ToString());
            }

            foreach (UpdatePropagation type in Enum.GetValues(typeof(UpdatePropagation)))
            {
                propagationCbx.Items.Add(type.ToString());
            }

            propagationCbx.SelectedIndex = (int)ViewNode.UpdatePropagation;

            if (ViewNode.Parent != null)
            {
                propagationCbx.Enabled = true;
            }
            else
            {
                propagationCbx.Enabled = false;
            }

            bool enabled = false;

            modeCbx.SelectedIndex = (int)ViewNode.RenderMode;

            if ((ViewNode.Parent != null) && (ViewNode.Parent.View != null))
            {
                Cdc.MetaManager.DataAccess.Domain.View view = dialogService.GetViewById(ViewNode.Parent.View.Id);

                if (view.ServiceMethod != null &&
                    view.ServiceMethod.Id == ViewNode.View.ServiceMethod.Id)
                {
                    if (ViewHelper.GetAllComponents <UXDataGrid>(view.VisualTree).Count > 0)
                    {
                        enabled = true;
                    }
                }
            }

            modeCbx.Enabled = enabled;
        }
Example #5
0
        private string GenerateXaml(Cdc.MetaManager.DataAccess.Domain.View renderView)
        {
            string source = string.Empty;

            if (renderView != null)
            {
                ViewXamlTemplate viewXamlTemplate = new ViewXamlTemplate();
                viewXamlTemplate.view        = renderView;
                viewXamlTemplate.debugOutput = true;
                source = viewXamlTemplate.RenderToString();
            }

            return(source);
        }
Example #6
0
        private void btnSelectView_Click(object sender, EventArgs e)
        {
            using (FindViewForm findView = new FindViewForm())
            {
                findView.FrontendApplication = FrontendApplication;
                findView.BackendApplication  = BackendApplication;

                if (findView.ShowDialog() == DialogResult.OK)
                {
                    SelectedView = findView.View;
                    PopulateViewFields();
                    CheckEnableDisableOK();
                }
            }
        }
Example #7
0
        private void CreateView_Load(object sender, EventArgs e)
        {
            PopulateBusinessEntityCombobox();
            NewView = new Cdc.MetaManager.DataAccess.Domain.View();
            NewView.AlternateView    = null;
            NewView.Application      = FrontendApplication;
            NewView.BusinessEntity   = null;
            NewView.OriginalViewName = null;
            NewView.RequestMap       = null;
            NewView.ResponseMap      = null;
            NewView.ServiceMethod    = null;
            NewView.Type             = ViewType.Standard;
            EnableDisableButtons();

            Cursor.Current = Cursors.Default;
        }
Example #8
0
        private void btnCreateView_Click(object sender, EventArgs e)
        {
            using (CreateView createView = new CreateView())
            {
                createView.FrontendApplication = FrontendApplication;
                createView.BackendApplication  = BackendApplication;
                createView.Owner = this;

                if (createView.ShowDialog() == DialogResult.OK)
                {
                    SelectedView = createView.NewView;
                    PopulateViewFields();
                    CheckEnableDisableOK();
                }
            }
        }
Example #9
0
        private void CreateCustomView_Load(object sender, EventArgs e)
        {
            EditingView = false;

            if (EditView != null)
            {
                // Read the view
                EditView = dialogService.GetViewById(EditView.Id);

                IsEditable = EditView.IsLocked && EditView.LockedBy == Environment.UserName;

                this.Text   = "Edit Custom View";
                EditingView = true;
            }

            PopulateBusinessEntityCombobox();
            PopulateCustomDLLNameCombobox();

            if (EditView == null)
            {
                // Create the new View
                EditView = new Cdc.MetaManager.DataAccess.Domain.View();

                EditView.AlternateView    = null;
                EditView.Application      = FrontendApplication;
                EditView.BusinessEntity   = (BusinessEntity)cbBusinessEntity.SelectedItem;
                EditView.OriginalViewName = null;
                EditView.RequestMap       = new PropertyMap();
                EditView.ResponseMap      = new PropertyMap();
                EditView.ServiceMethod    = null;
                EditView.Type             = ViewType.Custom;
                IsEditable = true;
            }
            else
            {
                PopulateViewFields();
            }

            CheckEnableDisableOK();
        }
Example #10
0
        private void AddViewToViewNode_Load(object sender, EventArgs e)
        {
            if (SelectedView != null)
            {
                // Read the view
                SelectedView = dialogService.GetViewById(SelectedView.Id);
            }

            // Populate Viewfields
            PopulateViewFields();

            if (ParentViewNode != null)
            {
                // Read the viewnode
                ParentViewNode = dialogService.GetViewNodeById(ParentViewNode.Id);

                // Set connected information
                tbParentViewNode.Text = string.Format(@"{0}", ParentViewNode.Id.ToString());
                tbParentView.Text     = string.Format(@"{0} ({1})", ParentViewNode.View.Title, ParentViewNode.View.Name);
            }

            CheckEnableDisableOK();
        }
Example #11
0
        private void btnCreateCustomView_Click(object sender, EventArgs e)
        {
            using (CreateCustomView customView = new CreateCustomView())
            {
                customView.FrontendApplication = FrontendApplication;
                customView.BackendApplication  = BackendApplication;
                customView.EditView            = null;

                if (customView.ShowDialog() == DialogResult.OK)
                {
                    // Ask user if he also wants to connect the newly created node to the selected
                    // ViewNode as the parent node.
                    if (MessageBox.Show("Do you want to use the created Custom View as the selected View?", "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes)
                    {
                        View = customView.EditView;

                        ReadViewBeforeExiting();

                        DialogResult = DialogResult.OK;
                    }
                }
            }
        }
Example #12
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            string newViewName = tbName.Text.Trim();

            // Check name.
            if (!NamingGuidance.CheckViewName(newViewName, true))
            {
                return;
            }

            // Check Title
            if (!NamingGuidance.CheckCaptionFocus(tbTitle, "View Title", true))
            {
                return;
            }

            // Check unique name

            IList <Cdc.MetaManager.DataAccess.Domain.View> viewList = dialogService.GetViewsByNameAndApplicationId(tbName.Text, FrontendApplication.Id);

            if (viewList.Count > 0)
            {
                MessageBox.Show("The name of the view is not unique, please change the value for the view name!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                tbName.SelectAll();
                tbName.Focus();
                return;
            }

            Cursor.Current = Cursors.WaitCursor;

            // Create the view
            NewView.BusinessEntity = (BusinessEntity)cbBusinessEntity.SelectedItem;
            NewView.Name           = newViewName;
            NewView.Title          = tbTitle.Text.Trim();

            // Create VisualTree
            if (rbtnGroupbox.Checked)
            {
                NewView.VisualTree = new UXWrapPanel();

                UXGroupBox groupBox = new UXGroupBox();
                groupBox.Caption = "Change Me";
                NewView.VisualTree.Children.Add(groupBox);
            }
            else if (rbtnGrid.Checked)
            {
                NewView.VisualTree = new UXDockPanel();
                UXDataGrid dataGrid = new UXDataGrid();
                dataGrid.Name = "NoName";
                NewView.VisualTree.Children.Add(dataGrid);
            }
            else if (rbtnTwoWayListBox.Checked)
            {
                NewView.VisualTree = new UXWrapPanel();
                UXTwoWayListBox twoWayListBox = new UXTwoWayListBox();
                twoWayListBox.Name = "TwoWayListBox";
                NewView.VisualTree.Children.Add(twoWayListBox);
            }

            if (NewView.ServiceMethod != null)
            {
                dialogService.CreateViewServiceMethodMap(NewView, NewView.ServiceMethod.Id);
            }
            else
            {
                NewView.RequestMap  = new PropertyMap();
                NewView.ResponseMap = new PropertyMap();
            }

            FrontendApplication = modelService.GetInitializedDomainObject <DataAccess.Domain.Application>(FrontendApplication.Id);

            NewView.Application = FrontendApplication;

            // Persist the view
            NewView = (DataAccess.Domain.View)modelService.SaveDomainObject(NewView);
            ContaindDomainObjectIdAndType = new KeyValuePair <Guid, Type>(NewView.Id, typeof(DataAccess.Domain.View));
            //CheckOut view
            CheckOutInObject(NewView, true);



            DialogResult = DialogResult.OK;


            Cursor.Current = Cursors.Default;
        }