Beispiel #1
0
        public void SaveCurrentView()
        {
            if (OwnerStudio.SurfaceManager.ActiveDesignSurface == null)
            {
                return;
            }

            ABCView view = (ABCView)(((HostSurface)OwnerStudio.SurfaceManager.ActiveDesignSurface).DesignerHost.RootComponent);

            view.Save();
        }
        public void ReloadFieldNodes(HostSurface Surface)
        {
            ABCView view = (ABCView)Surface.DesignerHost.RootComponent;

            Surface.TreeFieldNodes = new ABCCommonTreeListNode(null, null);

            if (view != null && view.DataConfig != null && view.DataConfig.BindingList != null)
            {
                foreach (ABCScreen.ABCBindingConfig config in view.DataConfig.BindingList.TreeValues)
                {
                    InitTable(Surface.TreeFieldNodes, config);
                }
            }
        }
Beispiel #3
0
        public void TestCurrentScreen( )
        {
            if (OwnerStudio.SurfaceManager.ActiveDesignSurface == null)
            {
                return;
            }

            ABCView currentView = (ABCView)(((HostSurface)OwnerStudio.SurfaceManager.ActiveDesignSurface).DesignerHost.RootComponent);

            currentView.SaveToXML("temp.xml");

            ABCScreen.ABCBaseScreen scr = null;

            String strSourceCode = ((HostSurface)OwnerStudio.SurfaceManager.ActiveDesignSurface).OwnerHostControl.SourceCSharpEditor.Text;

            if (currentView.DataField == null)
            {
                if (currentView.IsUseSourceCode && String.IsNullOrWhiteSpace(strSourceCode) == false)
                {
                    ABCScreen.ABCScreenFactory.DebugScreen("temp.xml", strSourceCode, "ABCTemp", ViewMode.Test);
                }
                else
                {
                    ABCScreen.ABCScreenFactory.RunScreen("temp.xml", null, ViewMode.Test);
                }
            }
            else
            {
                if (String.IsNullOrWhiteSpace(strSourceCode))
                {
                    strSourceCode = currentView.DataField.STViewCode;
                }

                if (currentView.DataField.STViewUseCode && String.IsNullOrWhiteSpace(strSourceCode) == false)
                {
                    ABCScreen.ABCScreenFactory.DebugScreen("temp.xml", strSourceCode, currentView.DataField.STViewNo, ViewMode.Test);
                }
                else
                {
                    ABCScreen.ABCScreenFactory.RunScreen("temp.xml", currentView.DataField, ViewMode.Test);
                }
            }
        }
Beispiel #4
0
        public void LoadView(STViewsInfo viewInfo, ViewMode mode)
        {
            if (View == null)
            {
                View = new ABCView();
                View.Load(viewInfo, mode);
            }
            else
            {
                Control ctrlParent = View.Parent;
                View.Parent = null;
                View        = new ABCView();
                View.Load(viewInfo, mode);

                View.Parent           = ctrlParent;
                View.Dock             = DockStyle.Fill;
                ctrlParent.ClientSize = View.Size;
            }
            InitializeEvents();
        }
Beispiel #5
0
        void ServiceComponentChange_ComponentChanged(object sender, ComponentChangedEventArgs e)
        {
            OwnerStudio.CheckUndoRedo();
            OwnerStudio.ControlListsGrid.RefreshList();

            InvalidatePropertyGrid();


            if (e.Member != null && e.Member.Name == "Caption")
            {
                ABCView view = (ABCView)(((HostSurface)OwnerStudio.SurfaceManager.ActiveDesignSurface).DesignerHost.RootComponent);
                if (e.Component == view)
                {
                    OwnerStudio.TabViewControl.SelectedTabPage.Text = view.Caption;
                }
            }

            if (e.Member != null && e.Member.Name == "Url" && e.Component is System.Windows.Forms.WebBrowser)
            {
                ((System.Windows.Forms.WebBrowser)e.Component).Url = new Uri(e.NewValue.ToString());
            }
        }
Beispiel #6
0
        public void ConfigBinding( )
        {
            if (HostSurfaceManager.CurrentManager.ActiveDesignSurface == null)
            {
                return;
            }

            ABCView view = (ABCView)(HostSurfaceManager.CurrentManager.ActiveDesignSurface as HostSurface).DesignerHost.RootComponent;

            using (ABCBusinessConfigEditorForm form = new ABCBusinessConfigEditorForm(view))
            {
                form.DataConfig = view.DataConfig;
                if (form.DataConfig == null)
                {
                    form.DataConfig = new ABCScreen.ABCScreenConfig(view);
                }
                if (form.ShowDialog() == DialogResult.OK)
                {
                    view.DataConfig = form.NewDataConfig;
                }
            }
        }
Beispiel #7
0
        public void CloseSurface(HostSurface surface)
        {
            if (surface == null)
            {
                return;
            }

            DevExpress.XtraTab.XtraTabPage currentTab = GetTabPageFromHostSurface(surface);
            if (currentTab == null)
            {
                return;
            }

            if (surface.UndoEngine.CanUndo)
            {
                ABCView view = (ABCView)surface.DesignerHost.RootComponent;
                if (view != null)
                {
                    DialogResult dlgResult = ABCHelper.ABCMessageBox.Show(String.Format(@"Do you want to save '{0}' View   ?", view.Name), "Message", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
                    if (dlgResult == DialogResult.Cancel)
                    {
                        return;
                    }

                    if (dlgResult == DialogResult.Yes)
                    {
                        view.Save();
                    }
                }
            }

            OwnerStudio.SurfaceManager.CloseSurface(surface);

            OwnerStudio.TabViewControl.TabPages.Remove(currentTab);
            OwnerStudio.PropertyGrid.SelectedObject = null;
        }
Beispiel #8
0
        protected override IComponent[] CreateComponentsCore(
            IDesignerHost host,
            IDictionary defaultValues)
        {
            ABCView view = (ABCView)host.RootComponent;

            try
            {
                if (Binding != null && Binding.ViewInfo != null)
                {
                    bool isOK = view.CheckLoopSurface(Binding.ViewInfo.STViewID);
                    if (!isOK)
                    {
                        ABCHelper.ABCMessageBox.Show("Can not include this View to another, there will be loop !", "Message", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return(null);
                    }
                }

                if (this.TypeName == typeof(ABCDockPanel).FullName)
                {
                    ABCDockPanel panel = ABCDockPanel.AddNewDockPanel(view);
                    panel.PerformDock(view);
                    return(null);
                }
                else
                {
                    IComponent[] comps = null;
                    //if (defaultValues["Parent"] is  System.Windows.Forms.FlowLayoutPanel &&
                    //    (defaultValues["Parent"] as System.Windows.Forms.FlowLayoutPanel ).Parent !=null &&
                    //    (defaultValues["Parent"] as System.Windows.Forms.FlowLayoutPanel ).Parent is ABCSearchPanel&&
                    //    defaultValues.Contains( "ToolboxSnapDragDropEventArgs" ) )
                    //{
                    //    DataObject obj=(DataObject)defaultValues["ToolboxSnapDragDropEventArgs"].GetType().GetProperty( "Data" ).GetValue( defaultValues["ToolboxSnapDragDropEventArgs"] , null );
                    //    ABCToolboxItem toolboxItem=    (ABCToolboxItem) obj.GetData(typeof( ABCToolboxItem ));
                    //    if ( toolboxItem.TypeName!="ABCControls.ABCSearchControl" )
                    //    {
                    //        ABCToolboxItem newToolboxItem=new ABCToolboxItem( typeof( ABCSearchControl ) );
                    //        newToolboxItem.Binding=toolboxItem.Binding;
                    //        comps=newToolboxItem.CreateComponentsCore( host );

                    //    }
                    //}

                    //if(comps==null)
                    comps = base.CreateComponentsCore(host, defaultValues);
                    try
                    {
                        if (Binding != null)
                        {
                            if (comps[0] is DevExpress.XtraEditors.GroupControl)
                            {
                                ((DevExpress.XtraEditors.GroupControl)comps[0]).Text = Binding.FieldName;
                            }


                            if (comps[0] is ABCView && Binding.ViewInfo != null)
                            {
                                ((ABCView)comps[0]).Load(Binding.ViewInfo, ViewMode.Test);
                                ((ABCView)comps[0]).Enabled = false;
                            }

                            if (comps[0] is ABCCheckEdit)
                            {
                                ((ABCCheckEdit)comps[0]).Initialize(view, Binding);
                            }

                            if (comps[0] is ABCCheckPanel)
                            {
                                ((ABCCheckPanel)comps[0]).Initialize(view, Binding);
                            }

                            if (comps[0] is ABCRadioGroup)
                            {
                                ((ABCRadioGroup)comps[0]).Initialize(Binding);
                            }

                            if (comps[0] is ABCLabel)
                            {
                                ((ABCLabel)comps[0]).Initialize(view, Binding);
                            }

                            if (comps[0] is ABCBindingBaseEdit)
                            {
                                ((ABCBindingBaseEdit)comps[0]).Initialize(view, Binding);
                            }
                            if (comps[0] is ABCSearchControl)
                            {
                                ABCSearchInfo searchInfo = new ABCSearchInfo();
                                searchInfo.DataSource = Binding.BusName;
                                searchInfo.TableName  = Binding.TableName;
                                searchInfo.DataMember = Binding.FieldName;
                                ((ABCSearchControl)comps[0]).Initialize(view, searchInfo);
                            }
                            if (comps[0] is ABCSearchPanel)
                            {
                                ((ABCSearchPanel)comps[0]).PopulateControls(view, Binding.BusName, Binding.TableName);
                            }
                            if (comps[0] is ABCDataPanel)
                            {
                                ((ABCDataPanel)comps[0]).PopulateControls(view, Binding.BusName, Binding.TableName);
                            }
                            if (comps[0] is ABCGridControl && view.DataConfig != null && view.DataConfig.BindingList.ContainsKey(Binding.BusName))
                            {
                                if (view.DataConfig.BindingList[Binding.BusName].IsList)
                                {
                                    ((ABCGridControl)comps[0]).Initialize(view, Binding);
                                }
                            }
                            if (comps[0] is ABCGridBandedControl && view.DataConfig != null && view.DataConfig.BindingList.ContainsKey(Binding.BusName))
                            {
                                if (view.DataConfig.BindingList[Binding.BusName].IsList)
                                {
                                    ((ABCGridBandedControl)comps[0]).Initialize(view, Binding);
                                }
                            }
                            if (comps[0] is ABCPivotGridControl && view.DataConfig != null && view.DataConfig.BindingList.ContainsKey(Binding.BusName))
                            {
                                if (view.DataConfig.BindingList[Binding.BusName].IsList)
                                {
                                    ((ABCPivotGridControl)comps[0]).Initialize(view, Binding);
                                }
                            }
                            if (comps[0] is ABCTreeList && view.DataConfig != null && view.DataConfig.BindingList.ContainsKey(Binding.BusName))
                            {
                                if (view.DataConfig.BindingList[Binding.BusName].IsList)
                                {
                                    ((ABCTreeList)comps[0]).Initialize(view, Binding);
                                }
                            }
                        }
                    }
                    catch (Exception ex2)
                    {
                    }
                    return(comps);
                }
            }
            catch (Exception ex)
            {
            }
            return(null);
        }
Beispiel #9
0
 public ABCScreenConfig(ABCView view)
 {
     OwnerView = view;
 }
Beispiel #10
0
 public void LoadView(XmlDocument doc, ViewMode mode)
 {
     View = new ABCView();
     View.Load(doc, mode);
     InitializeEvents();
 }