예제 #1
0
 public void SetView(DevExpress.ExpressApp.View view)
 {
     this.ViewSite.Controls.Clear();
     if (view != null)
     {
         contextMenu.CreateControls(view);
         view.CreateControls();
         ViewSite.Controls.Add((Control)view.Control);
         this.ViewCaptionLabel.Text = view.Caption;
         Header.Title = view.Caption + " - " + WebApplication.Instance.Title;
         ImageInfo imageInfo = ImageLoader.Instance.GetLargeImageInfo(view.Model.ModelClass.ImageName);
         if (imageInfo.IsEmpty)
         {
             ViewImage.Visible = false;
         }
         else
         {
             ViewImage.ImageUrl = imageInfo.ImageUrl;
         }
         if (view is DetailView)
         {
             //SearchActionContainer.Visible = false;
             //ObjectsCreationActionContainer.Visible = false;
         }
     }
 }
예제 #2
0
    public void SetView(DevExpress.ExpressApp.View view)
    {
        ViewSite.Controls.Clear();
        if (view != null)
        {
            contextMenu.CreateControls(view);
            view.CreateControls();
            if (ViewControlAdding != null)
            {
                ViewControlAdding(this, EventArgs.Empty);
            }
            ViewSite.Controls.Add((Control)view.Control);
            ViewCaption.Text = view.Caption;

            ImageInfo imageInfo = ImageLoader.Instance.GetLargeImageInfo(view.Info.GetAttributeValue("ImageName"));
            if (imageInfo.IsEmpty)
            {
                ViewImage.Visible = false;
            }
            else
            {
                ViewImage.ImageUrl = imageInfo.ImageUrl;
            }
            string colorString = view.Info.GetAttributeValue("BackColor");
            //if(!string.IsNullOrEmpty(colorString)) {
            //	try {
            //		KnownColor kColor = (KnownColor)Enum.Parse(typeof(KnownColor), colorString);
            //		//ViewTitle.BackColor = Color.FromKnownColor(kColor);
            //	}
            //	catch(Exception) { }
            //}
        }
    }
예제 #3
0
 public void SetView(DevExpress.ExpressApp.View view)
 {
     this.ViewSite.Controls.Clear();
     if (view != null)
     {
         contextMenu.CreateControls(view);
         view.CreateControls();
         ViewSite.Controls.Add((Control)view.Control);
         this.ViewCaption.Text = view.Caption;
         Header.Title          = view.Caption + " - " + WebApplication.Instance.Title;
         ImageInfo imageInfo = ImageLoader.Instance.GetLargeImageInfo(view.Info.GetAttributeValue("ImageName"));
         if (imageInfo.IsEmpty)
         {
             ViewImage.Visible = false;
         }
         else
         {
             ViewImage.ImageUrl = imageInfo.ImageUrl;
         }
         if (view is DetailView)
         {
             SearchActionContainer.Visible          = false;
             ObjectsCreationActionContainer.Visible = false;
         }
         //string colorString = view.Info.GetAttributeValue("BackColor");
         //if(!string.IsNullOrEmpty(colorString)) {
         //	try {
         //		KnownColor kColor = (KnownColor)Enum.Parse(typeof(KnownColor), colorString);
         //		ViewTitle.BackColor = Color.FromKnownColor(kColor);
         //	}
         //	catch(Exception) { }
         //}
     }
 }
 /// <summary>
 /// Quando a view modificar
 /// </summary>
 /// <param name="view">view</param>
 protected virtual void OnViewChanged(DevExpress.ExpressApp.View view)
 {
     if (ViewChanged != null)
     {
         ViewChanged(this, new TemplateViewChangedEventArgs(view));
     }
 }
        private static void SetCriteria(ChoiceActionItem selectedItem, View view)
        {
            var shortcut = selectedItem.Data as ViewShortcut;

            if (view is DevExpress.ExpressApp.ListView && shortcut.ContainsKey("Criteria"))
            {

                var ck = "NavigationCriteria";
                var lv = view as DevExpress.ExpressApp.ListView;

                var key = (string) shortcut["Criteria"];
                if (!string.IsNullOrEmpty(key))
                {
                    lv.CollectionSource.SetCriteria(ck, key);
                }
                else
                {
                    lv.CollectionSource.Criteria.Remove(ck);
                    shortcut["Criteria"] = "";
                }
                lv.Tag = shortcut;
                view.RefreshDataSource();
                view.Tag = shortcut;
            }
        }
예제 #6
0
        void OnCustomShowNavigationItem(object sender, CustomShowNavigationItemEventArgs e)
        {
            navigationController.CustomShowNavigationItem -= OnCustomShowNavigationItem;//It is important to unsubscribe from this event immediately.
            ShowViewParameters svp = e.ActionArguments.ShowViewParameters;
            IObjectSpace       os  = Application.CreateObjectSpace();

            //object theObjectToBeShown = os.FindObject<Contact>(null);
            //DetailView dv = Application.CreateDetailView(os, theObjectToBeShown, true);
            //dv.ViewEditMode = DevExpress.ExpressApp.Editors.ViewEditMode.Edit;
            //svp.CreatedView = dv;
            //e.Handled = true;

            Type objectType = AppDomain.CurrentDomain.GetAssemblies()
                              .SelectMany(x => x.GetTypes())
                              .FirstOrDefault(x => x.Name == "Payment");

            //string listViewId = Application.FindLookupListViewId(objectType); // "Person_ListView";//
            //string listViewId = Application.FindDetailViewId(objectType);

            DevExpress.ExpressApp.View listView = Application.CreateListView(Application.CreateObjectSpace(), objectType, false);

            //string listViewId = Application.FindListViewId(objectType);
            //CollectionSourceBase collectionSource = Application.CreateCollectionSource(Application.CreateObjectSpace(), objectType, listViewId);
            //DevExpress.ExpressApp.View listView = Application.CreateListView(listViewId, collectionSource, true);
            svp.TargetWindow  = TargetWindow.Current;
            svp.CreatedView   = listView;
            viewIsInitailized = true;
            e.Handled         = true;
        }
        void showWindowAction_Execute(object sender, SimpleActionExecuteEventArgs e)
        {
            NonXAFForm form = new NonXAFForm();

            form.Text = "Form with the XAF ListView";

            LayoutControl layoutControl = new LayoutControl();

            layoutControl.Dock = System.Windows.Forms.DockStyle.Fill;
            form.Controls.Add(layoutControl);

            LayoutControlItem item1    = layoutControl.Root.AddItem();
            TextBox           textBox1 = new TextBox();

            item1.Text    = "Company";
            item1.Control = textBox1;

            DevExpress.ExpressApp.View listView = Application.CreateListView(typeof(Person), true);
            listView.CreateControls();
            LayoutControlItem item2 = layoutControl.Root.AddItem();

            item2.Text    = "Persons";
            item2.Control = (Control)listView.Control;

            form.ShowDialog();
            listView.Dispose();
            form.Dispose();
        }
예제 #8
0
    public void SetView(DevExpress.ExpressApp.View view)
    {
        ViewSite.Controls.Clear();
        if (view != null)
        {
            contextMenu.CreateControls(view);
            view.CreateControls();
            if (ViewControlAdding != null)
            {
                ViewControlAdding(this, EventArgs.Empty);
            }
            ViewSite.Controls.Add((Control)view.Control);
            ViewCaptionLabel.Text = view.Caption;

            ImageInfo imageInfo = ImageLoader.Instance.GetLargeImageInfo(view.Info.GetAttributeValue("ImageName"));
            if (imageInfo.IsEmpty)
            {
                ViewImage.Visible = false;
            }
            else
            {
                ViewImage.ImageUrl = imageInfo.ImageUrl;
            }
        }
    }
 void IFrameTemplate.SetView(DevExpress.ExpressApp.View view)
 {
     viewSiteManager.SetView(view);
     if (view != null)
     {
         Tag = EasyTestTagHelper.FormatTestContainer(view.Caption);
     }
     RaiseViewChanged(view);
 }
예제 #10
0
        protected virtual void RaiseViewChanged(DevExpress.ExpressApp.View view)
        {
            EventHandler <TemplateViewChangedEventArgs> handler = (EventHandler <TemplateViewChangedEventArgs>)Events[viewChanged];

            if (handler != null)
            {
                handler(this, new TemplateViewChangedEventArgs(view));
            }
        }
    /// <summary>
    /// mátodo SetView
    /// </summary>
    /// <param name="view">view</param>
    public void SetView(DevExpress.ExpressApp.View view)
    {
        this.view = view;
        if (view != null)
        {
            contextMenu.CreateControls(view);
        }

        OnViewChanged(view);
    }
예제 #12
0
 /// <summary>
 /// Sets the current View for all Controllers in the Frame
 /// </summary>
 /// <param name="view">current View</param>
 private void UpdateControllers(DevExpress.ExpressApp.View view)
 {
     foreach (Controller controller in Frame.Controllers)
     {
         if (controller is ViewController && !controller.Equals(this))
         {
             ((ViewController)controller).SetView(null);
             ((ViewController)controller).SetView(view);
         }
     }
 }
예제 #13
0
 /// <summary>
 /// Sets the current View for all Controllers in the Frame
 /// </summary>
 /// <param name="view">current View</param>
 private void UpdateControllers(DevExpress.ExpressApp.View view)
 {
     foreach (Controller controller in Frame.Controllers)
     {
         var viewController = controller as ViewController;
         if (viewController != null && !viewController.Equals(this))
         {
             viewController.SetView(null);
             viewController.SetView(view);
         }
     }
 }
예제 #14
0
        protected virtual void AddNewObject()
        {
            var          svp = new ShowViewParameters();
            IObjectSpace newObjectViewObjectSpace = _helper.Application.CreateObjectSpace(_helper.LookupObjectTypeInfo.Type);
            object       newObject = newObjectViewObjectSpace.CreateObject(_helper.LookupObjectTypeInfo.Type);

            _lookupObjectView = _helper.Application.CreateDetailView(newObjectViewObjectSpace, newObject, true);
            svp.CreatedView   = _lookupObjectView;
            newObjectViewObjectSpace.Committed += newObjectViewObjectSpace_Committed;
            newObjectViewObjectSpace.Disposed  += newObjectViewObjectSpace_Disposed;
            svp.TargetWindow = TargetWindow.NewModalWindow;
            svp.Context      = TemplateContext.PopupWindow;
            svp.Controllers.Add(_helper.Application.CreateController <DialogController>());
            _helper.Application.ShowViewStrategy.ShowView(svp, new ShowViewSource(null, null));
        }
예제 #15
0
        private void ListViewFilterPanelController_Activated(object sender, EventArgs e)
        {
            // Скрываем саму кнопку
            ListViewClearFilter.Enabled[DO_NOT_ENABLED] = false;
            ListViewApplyFilter.Enabled[DO_NOT_ENABLED] = false;

            frame    = Frame;
            view     = View;
            listView = view as DevExpress.ExpressApp.ListView;
            if (listView == null)
            {
                return;
            }

            objectTypeInfo       = listView.CollectionSource.ObjectTypeInfo;
            typeObjectOfListView = objectTypeInfo.Type;

            // Критерий из модели для самого ListView
            listViewCriteria = listView.Model.Criteria;

            View.ControlsCreated += new EventHandler(View_ControlsCreated);
            FilteringCriterionListAction.Items.Clear();

            foreach (IModelDetailView node in View.Model.Application.Views.GetNodes <IModelDetailView>())
            {
                if (node.ModelClass.TypeInfo.Type.Name.StartsWith(typeObjectOfListView.Name + "Filter"))
                {
                    ChoiceActionItem current = new ChoiceActionItem(node.Id, node.Caption, node);
                    FilteringCriterionListAction.Items.Add(current);
                }
            }

            IModelDetailView imdvFullTextSearch    = Application.FindModelView(Application.FindDetailViewId(typeof(FilteringCriterion))) as IModelDetailView;
            string           FullTextSearchCaption = imdvFullTextSearch.Caption;

            FilteringCriterionListAction.Items.Add(new ChoiceActionItem("CriteriaBuilder", FullTextSearchCaption, null));
            FilteringCriterionListAction.SelectedIndex = 0;

            if (standardFullTextFilterAction != null)
            {
                standardFullTextFilterAction.Active["IsPersistentType"] = true;
                //    string searchText = "";
                //    if (standardFullTextFilterAction.Value != null) searchText = standardFullTextFilterAction.Value.ToString();
                //    InitVariablesForLikeSearchPathListAttribute(searchText, out criteriaForLikeSearchPathListAttribute, out propertiesForLikeSearchPathListAttribute);
            }
        }
        protected override void ShowStartupNavigationItem(ShowNavigationItemController controller)
        {
            base.ShowStartupNavigationItem(controller);
            ((WinWindow)Application.MainWindow).Form.BeginInvoke(new MethodInvoker(() =>
            {
                IObjectSpace os = Application.CreateObjectSpace();
                DevExpress.ExpressApp.View view = Application.CreateListView(os, typeof(Contact), true);
                var sp             = new ShowViewParameters();
                sp.CreatedView     = view;
                sp.NewWindowTarget = NewWindowTarget.MdiChild;

                sp.TargetWindow = TargetWindow.NewModalWindow;

                var ss = new ShowViewSource(this.Frame, null);
                SingleViewParameters.createdView = view;
                Application.ShowViewStrategy.ShowView(sp, ss);
            }));
        }
예제 #17
0
        protected virtual void OpenCurrentObject()
        {
            if (_lookup.EditValue == null)
            {
                return;
            }
            var          showViewParameters        = new ShowViewParameters();
            IObjectSpace openObjectViewObjectSpace = _helper.Application.CreateObjectSpace(_lookup.EditValue.GetType());
            object       targetObject = openObjectViewObjectSpace.GetObject(_lookup.EditValue);

            if (targetObject != null)
            {
                openObjectViewObjectSpace.Committed += openObjectViewObjectSpace_Committed;
                openObjectViewObjectSpace.Disposed  += openObjectViewObjectSpace_Disposed;
                _lookupObjectView = _helper.Application.CreateDetailView(openObjectViewObjectSpace, targetObject, true);
                showViewParameters.CreatedView  = _lookupObjectView;
                showViewParameters.TargetWindow = TargetWindow.NewModalWindow;
                _helper.Application.ShowViewStrategy.ShowView(showViewParameters, new ShowViewSource(null, null));
            }
        }
 public void SetView(DevExpress.ExpressApp.View view)
 {
     ViewSite.Controls.Clear();
     if (view != null)
     {
         contextMenu.CreateControls(view);
         view.CreateControls();
         ViewSite.Controls.Add((Control)view.Control);
         ViewCaptionLabel.Text = view.Caption;
         ImageInfo imageInfo = ImageLoader.Instance.GetImageInfo(view.Model.ModelClass.ImageName);
         if (imageInfo.IsEmpty)
         {
             ViewImage.Visible  = false;
             ViewImage.ImageUrl = null;
         }
         else
         {
             ViewImage.ImageUrl = imageInfo.ImageUrl;
         }
     }
 }
예제 #19
0
 public void SetView(DevExpress.ExpressApp.View view)
 {
     ViewSite.Controls.Clear();
     if (view != null)
     {
         contextMenu.CreateControls(view);
         view.CreateControls();
         ViewSite.Controls.Add((Control)view.Control);
         ViewCaption.Text = view.Caption;
         ImageInfo imageInfo = ImageLoader.Instance.GetImageInfo(view.Info.GetAttributeValue("ImageName"));
         if (imageInfo.IsEmpty)
         {
             ViewImage.Visible  = false;
             ViewImage.ImageUrl = null;
         }
         else
         {
             ViewImage.ImageUrl = imageInfo.ImageUrl;
         }
         OnViewInfoChanged();
     }
 }
예제 #20
0
 public void SetView(DevExpress.ExpressApp.View view)
 {
     this.ViewSite.Controls.Clear();
     if (view != null)
     {
         view.CreateControls();
         if (ViewControlAdding != null)
         {
             ViewControlAdding(this, EventArgs.Empty);
         }
         ViewSite.Controls.Add((Control)view.Control);
         ViewCaptionLabel.Text = view.Caption;
         Header.Title          = view.Caption;
         ImageInfo imageInfo = ImageLoader.Instance.GetLargeImageInfo(view.Model.ImageName);
         if (imageInfo.IsEmpty)
         {
             ViewImage.Visible = false;
         }
         else
         {
             ViewImage.ImageUrl = imageInfo.ImageUrl;
         }
     }
 }
        private static void SetCriteria(ChoiceActionItem selectedItem, View view)
        {
            var shortcut = selectedItem.Data as ViewShortcut;

            if (view is DevExpress.ExpressApp.ListView && shortcut.ContainsKey("Criteria"))
            {
                var ck = "NavigationCriteria";
                var lv = view as DevExpress.ExpressApp.ListView;

                var key = (string)shortcut["Criteria"];
                if (!string.IsNullOrEmpty(key))
                {
                    lv.CollectionSource.SetCriteria(ck, key);
                }
                else
                {
                    lv.CollectionSource.Criteria.Remove(ck);
                    shortcut["Criteria"] = "";
                }
                lv.Tag = shortcut;
                view.RefreshDataSource();
                view.Tag = shortcut;
            }
        }
예제 #22
0
        private void DetailViewAnalysisFilterPanelController_Activated(object sender, EventArgs e)
        {
            frame      = Frame;
            view       = View;
            detailView = view as DetailView;

            if (detailView == null)
            {
                return;
            }

            DevExpress.ExpressApp.DC.ITypeInfo objectTypeInfo = detailView.ObjectTypeInfo;



            // Подключаемся к ListViewProcessCurrentObjectController
            analysisDataBindController = frame.GetController <AnalysisDataBindController>();

            if (frame.Context.Name == TemplateContext.LookupControl ||
                frame.Context.Name == TemplateContext.LookupWindow)
            {
                return;
            }

            Type typeAnalysingObject = GetChoiceType();  // typeof(object);

            ExecStandartAction(null);

            if (typeAnalysingObject == null)
            {
                return;
            }

            #region ОБРАБОТКА ОПЦИЙ ФИЛЬТРАЦИИ ИЗ ПОДУЗЛА Filters текущего ListView СРЕДСТВАМИ ДАННОГО КОНТРОЛЛЕРА ВМЕСТО СТАНДАРТНОГО КОНТРОЛЛЕРА FilterController

            View.ControlsCreated += new EventHandler(View_ControlsCreated);
            AnalysisCriterionListAction.Items.Clear();
            #endregion

            // Виды фильтрации
            // Список DetailView, которые представляют формы ввода параметров
            // Считаем пока, что имя DetailView с фильром формируется из имени типа фильтуемого списка прибавлением
            // слова Filter и номера, например, WorkPlanFilter01_DetailView.

            foreach (IModelDetailView node in View.Model.Application.Views.GetNodes <IModelDetailView>())
            {
                //if (node.ModelClass == View.Model.ModelClass) {
                if (node.ModelClass.TypeInfo.Type.Name.StartsWith(typeAnalysingObject.Name + "Filter"))
                {
                    ChoiceActionItem current = new ChoiceActionItem(node.Id, node.Caption, node);
                    AnalysisCriterionListAction.Items.Add(current);
                    //if (node == View.Model) SelectViewAction.SelectedItem = current;
                }
            }

//            AnalysisCriterionListAction.SelectedIndex = 0;

            ClearFilterFields.Active.Clear();
            ClearFilterFields.Enabled.Clear();
            ClearFilterFields.Active.SetItemValue("ResultValue", true);
        }
예제 #23
0
 void IFrameTemplate.SetView(DevExpress.ExpressApp.View view)
 {
     viewSiteManager.SetView(view);
     RaiseViewChanged(view);
 }
 public override void Register(IAdditionalViewControlsProvider controlProvider, View view,Frame frame)
 {
     if (view is DetailView || !((DevExpress.ExpressApp.ListView)view).IsNested(frame))
         base.Register(controlProvider, view,frame);
 }
예제 #25
0
 object IBasePrintableProvider.GetIPrintableImplementer()
 {
     DevExpress.ExpressApp.View view = viewSiteManager.View;
     return(view != null ? view.Control : null);
 }
 protected override void OnViewChanging(DevExpress.ExpressApp.View view)
 {
     base.OnViewChanging(view);
 }
예제 #27
0
 protected virtual void RaiseViewChanged(DevExpress.ExpressApp.View view)
 {
     ((EventHandler <TemplateViewChangedEventArgs>)Events[viewChanged])?.Invoke(this, new TemplateViewChangedEventArgs(view));
 }
예제 #28
0
 protected virtual void OpenCurrentObject() {
     if (_lookup.EditValue==null)
         return;
     var showViewParameters = new ShowViewParameters();
     IObjectSpace openObjectViewObjectSpace = _helper.Application.CreateObjectSpace(_lookup.EditValue.GetType());
     object targetObject =openObjectViewObjectSpace.GetObject(_lookup.EditValue);
     if (targetObject != null) {
         openObjectViewObjectSpace.Committed += openObjectViewObjectSpace_Committed;
         openObjectViewObjectSpace.Disposed += openObjectViewObjectSpace_Disposed;
         _lookupObjectView = _helper.Application.CreateDetailView(openObjectViewObjectSpace,targetObject,true);
         showViewParameters.CreatedView = _lookupObjectView;
         showViewParameters.TargetWindow = TargetWindow.NewModalWindow;
         _helper.Application.ShowViewStrategy.ShowView(showViewParameters, new ShowViewSource(null, null));
     }
 }
예제 #29
0
 /// <summary>
 /// Sets the current View for all Controllers in the Frame
 /// </summary>
 /// <param name="view">current View</param>
 private void UpdateControllers(View view){
     foreach (Controller controller in Frame.Controllers){
         if (controller is ViewController && !controller.Equals(this)){
             ((ViewController) controller).SetView(null);
             ((ViewController) controller).SetView(view);
         }
     }
 }
예제 #30
0
 protected virtual void OpenCurrentObject() {
     var svp = new ShowViewParameters();
     IObjectSpace openObjectViewObjectSpace = _helper.Application.CreateObjectSpace();
     object targetObject =
         RuntimeHelpers.GetObjectValue(
             openObjectViewObjectSpace.GetObject(RuntimeHelpers.GetObjectValue(_lookup.EditValue)));
     if (targetObject != null) {
         openObjectViewObjectSpace.Committed += openObjectViewObjectSpace_Committed;
         openObjectViewObjectSpace.Disposed += openObjectViewObjectSpace_Disposed;
         lookupObjectView = _helper.Application.CreateDetailView(openObjectViewObjectSpace,
                                                                 RuntimeHelpers.GetObjectValue(targetObject),
                                                                 true);
         svp.CreatedView = lookupObjectView;
         svp.TargetWindow = TargetWindow.NewModalWindow;
         _helper.Application.ShowViewStrategy.ShowView(svp, new ShowViewSource(null, null));
     }
 }
예제 #31
0
 public override void Register(IAdditionalViewControlsProvider controlProvider, View view, Frame frame)
 {
     if (view is DetailView || !((DevExpress.ExpressApp.ListView)view).IsNested(frame))
     {
         base.Register(controlProvider, view, frame);
     }
 }
예제 #32
0
 protected virtual void AddNewObject() {
     var svp = new ShowViewParameters();
     IObjectSpace newObjectViewObjectSpace = _helper.Application.CreateObjectSpace(_helper.LookupObjectTypeInfo.Type);
     object newObject =newObjectViewObjectSpace.CreateObject(_helper.LookupObjectTypeInfo.Type);
     _lookupObjectView = _helper.Application.CreateDetailView(newObjectViewObjectSpace,newObject, true);
     svp.CreatedView = _lookupObjectView;
     newObjectViewObjectSpace.Committed += newObjectViewObjectSpace_Committed;
     newObjectViewObjectSpace.Disposed += newObjectViewObjectSpace_Disposed;
     svp.TargetWindow = TargetWindow.NewModalWindow;
     svp.Context = TemplateContext.PopupWindow;
     svp.Controllers.Add(_helper.Application.CreateController<DialogController>());
     _helper.Application.ShowViewStrategy.ShowView(svp, new ShowViewSource(null, null));
 }