Ejemplo n.º 1
0
        public void LoadViews()
        {
            searchOrderView = new SearchInfo(DataBase, this);
            ViewDictionary.Add("SearchOrder", searchOrderView);
            searchOrderView.Dock = DockStyle.Fill;
            panel1.Controls.Add(searchOrderView);
            searchOrderView.Hide();

            searchComponentView = new SearchComponent(DataBase, this);
            ViewDictionary.Add("SearchComponent", searchComponentView);
            searchComponentView.Dock = DockStyle.Fill;
            panel1.Controls.Add(searchComponentView);
            searchComponentView.Hide();

            createComponentView = new CreateComponent(DataBase, this);
            ViewDictionary.Add("CreateComponent", createComponentView);
            createComponentView.Dock = DockStyle.Fill;
            panel1.Controls.Add(createComponentView);
            createComponentView.Hide();

            OrderSuppliersView = new OrderSuppliers(DataBase, this);
            ViewDictionary.Add("OrderSuppliersView", OrderSuppliersView);
            OrderSuppliersView.Dock = DockStyle.Fill;
            panel1.Controls.Add(OrderSuppliersView);
            OrderSuppliersView.Hide();
        }
Ejemplo n.º 2
0
 public ViewChild(View parent, string id)
 {
     Data = new ViewDictionary(parent, id);
     //load related fields
     foreach (var item in parent.Fields)
     {
         if (item.Key.IndexOf(id + "-") == 0)
         {
             Fields.Add(item.Key.Replace(id + "-", ""), item.Value);
         }
     }
 }
        /// <summary>
        /// Initializer that takes in a list of XmlReaders and creates metadata for mapping
        /// in all the files.
        /// </summary>
        /// <param name="edmCollection">The edm metadata collection that this mapping is to use</param>
        /// <param name="storeCollection">The store metadata collection that this mapping is to use</param>
        /// <param name="filePaths">Mapping URIs</param>
        /// <param name="xmlReaders">The XmlReaders to load mapping from</param>
        /// <param name="errors">a list of errors for each file loaded</param>
        private IList <EdmSchemaError> Init(EdmItemCollection edmCollection,
                                            StoreItemCollection storeCollection,
                                            IEnumerable <XmlReader> xmlReaders,
                                            List <string> filePaths,
                                            bool throwOnError)
        {
            EntityUtil.CheckArgumentNull(xmlReaders, "xmlReaders");
            EntityUtil.CheckArgumentNull(edmCollection, "edmCollection");
            EntityUtil.CheckArgumentNull(storeCollection, "storeCollection");

            this.m_edmCollection       = edmCollection;
            this.m_storeItemCollection = storeCollection;

            Dictionary <EntitySetBase, GeneratedView>    userDefinedQueryViewsDict;
            Dictionary <OfTypeQVCacheKey, GeneratedView> userDefinedQueryViewsOfTypeDict;

            this.m_viewDictionary = new ViewDictionary(this, out userDefinedQueryViewsDict, out userDefinedQueryViewsOfTypeDict);

            List <EdmSchemaError> errors = new List <EdmSchemaError>();

            if (this.m_edmCollection.EdmVersion != XmlConstants.UndefinedVersion &&
                this.m_storeItemCollection.StoreSchemaVersion != XmlConstants.UndefinedVersion &&
                this.m_edmCollection.EdmVersion != this.m_storeItemCollection.StoreSchemaVersion)
            {
                errors.Add(
                    new EdmSchemaError(
                        Strings.Mapping_DifferentEdmStoreVersion,
                        (int)StorageMappingErrorCode.MappingDifferentEdmStoreVersion, EdmSchemaErrorSeverity.Error));
            }
            else
            {
                double expectedVersion = this.m_edmCollection.EdmVersion != XmlConstants.UndefinedVersion
                    ? this.m_edmCollection.EdmVersion
                    : this.m_storeItemCollection.StoreSchemaVersion;
                errors.AddRange(LoadItems(xmlReaders, filePaths, userDefinedQueryViewsDict, userDefinedQueryViewsOfTypeDict, expectedVersion));
            }

            Debug.Assert(errors != null);

            if (errors.Count > 0 && throwOnError)
            {
                if (!System.Data.Common.Utils.MetadataHelper.CheckIfAllErrorsAreWarnings(errors))
                {
                    // NOTE: not using Strings.InvalidSchemaEncountered because it will truncate the errors list.
                    throw new MappingException(
                              String.Format(System.Globalization.CultureInfo.CurrentCulture,
                                            EntityRes.GetString(EntityRes.InvalidSchemaEncountered),
                                            Helper.CombineErrorMessage(errors)));
                }
            }

            return(errors);
        }
Ejemplo n.º 4
0
 //<Constructors>
 public Client(ICommunication communication)
 {
     _game = new GameOutput();
     _clientDataPackageProvider = new ClientDataPackageProvider();
     _viewDictionary            = new ViewDictionary();
     _communication             = communication;
     _actionHandler             = new ProtocolAction(_viewDictionary._views, this, _clientDataPackageProvider, _game);
     _inputHandler  = new InputAction(_actionHandler, _viewDictionary._views, this, _clientDataPackageProvider);
     _outputWrapper = new OutputWrapper();
     _viewUpdater   = new ViewUpdater(_viewDictionary._views);
     _actionHandler._enterToRefreshView.ViewEnabled = true;
     _actionHandler._enterToRefreshView.SetUpdateContent("Press enter to refresh\nafter you typed a command.");
 }
Ejemplo n.º 5
0
        public string Run(ViewDictionary data)
        {
            var cacheKey = controller + view + layout;

            var template = HttpContext.Current.Cache[cacheKey] as BoostTemplate;

            if (null == template)
            {
                var s = Path.DirectorySeparatorChar;

                var viewPath = Path.Combine(applicationPath, string.Format("Views{0}{1}{0}{2}.rhtml", s, controller, view));
                var layoutPath = Path.Combine(applicationPath, string.Format("Views{0}Layouts{0}{1}.rhtml", s, layout));

                var viewText = File.ReadAllText(viewPath);
                var layoutText = File.ReadAllText(layoutPath);

                template = new BoostTemplate(viewText, layoutText);

                HttpContext.Current.Cache.Insert(cacheKey, template, new CacheDependency(new[] { viewPath, layoutPath }));
            }

            return template.Run(data);
        }
        // <summary>
        // Initializer that takes in a list of XmlReaders and creates metadata for mapping
        // in all the files.
        // </summary>
        // <param name="edmCollection"> The edm metadata collection that this mapping is to use </param>
        // <param name="storeCollection"> The store metadata collection that this mapping is to use </param>
        // <param name="xmlReaders"> The XmlReaders to load mapping from </param>
        // <param name="filePaths"> Mapping URIs </param>
        private IList<EdmSchemaError> Init(
            EdmItemCollection edmCollection,
            StoreItemCollection storeCollection,
            IEnumerable<XmlReader> xmlReaders,
            IList<string> filePaths,
            bool throwOnError)
        {
            DebugCheck.NotNull(xmlReaders);
            DebugCheck.NotNull(edmCollection);
            DebugCheck.NotNull(storeCollection);

            _edmCollection = edmCollection;
            _storeItemCollection = storeCollection;

            Dictionary<EntitySetBase, GeneratedView> userDefinedQueryViewsDict;
            Dictionary<OfTypeQVCacheKey, GeneratedView> userDefinedQueryViewsOfTypeDict;

            m_viewDictionary = new ViewDictionary(this, out userDefinedQueryViewsDict, out userDefinedQueryViewsOfTypeDict);

            var errors = new List<EdmSchemaError>();

            if (_edmCollection.EdmVersion != XmlConstants.UndefinedVersion
                && _storeItemCollection.StoreSchemaVersion != XmlConstants.UndefinedVersion
                && _edmCollection.EdmVersion != _storeItemCollection.StoreSchemaVersion)
            {
                errors.Add(
                    new EdmSchemaError(
                        Strings.Mapping_DifferentEdmStoreVersion,
                        (int)MappingErrorCode.MappingDifferentEdmStoreVersion, EdmSchemaErrorSeverity.Error));
            }
            else
            {
                var expectedVersion = _edmCollection.EdmVersion != XmlConstants.UndefinedVersion
                                          ? _edmCollection.EdmVersion
                                          : _storeItemCollection.StoreSchemaVersion;
                errors.AddRange(
                    LoadItems(xmlReaders, filePaths, userDefinedQueryViewsDict, userDefinedQueryViewsOfTypeDict, expectedVersion));
            }

            Debug.Assert(errors != null);

            if (errors.Count > 0 && throwOnError)
            {
                if (!MetadataHelper.CheckIfAllErrorsAreWarnings(errors))
                {
                    // NOTE: not using Strings.InvalidSchemaEncountered because it will truncate the errors list.
                    throw new MappingException(
                        String.Format(
                            CultureInfo.CurrentCulture,
                            EntityRes.GetString(EntityRes.InvalidSchemaEncountered),
                            Helper.CombineErrorMessage(errors)));
                }
            }

            return errors;
        }
Ejemplo n.º 7
0
        public void AddDockAbleContent(FrmState thisState, object thisControl, string name)
        {
            string name2 = null;
            var    count = ViewDictionary.Count(d => d.Name == name);

            if (count != 0)
            {
                name2 = name + count;
            }
            else
            {
                name2 = name;
            }
            var viewitem            = new ViewItem(thisControl, name, thisState);
            LayoutAnchorable layout = null;

            ViewDictionary.Add(viewitem);
            try
            {
                switch (thisState)
                {
                case FrmState.Large:
                    layout = Factory(name, thisControl);
                    documentMain.Children.Add(layout);

                    layout.IsActive = true;
                    break;

                case FrmState.Buttom:
                    layout = Factory(name, thisControl);

                    var view = thisControl as DebugManagerUI;
                    if (view != null)
                    {
                        RichTextBoxAppender.SetRichTextBox(view.richtextBox, DebugText, notifier);
                    }

                    documentButtom.Children.Add(layout);
                    documentButtom.Children.RemoveElementsNoReturn(d => d.Content == null);
                    layout.IsActive = true;
                    layout.CanClose = false;
                    break;

                case FrmState.Middle:
                    layout             = Factory(name, thisControl);
                    viewitem.Container = layout;
                    dockablePane1.Children.Add(layout);
                    dockablePane1.Children.RemoveElementsNoReturn(d => d.Content == null);
                    layout.IsActive = true;
                    layout.CanClose = false;
                    break;

                case FrmState.Mini:
                    layout             = Factory(name, thisControl);
                    viewitem.Container = layout;
                    dockablePane2.Children.Add(layout);
                    dockablePane2.Children.RemoveElementsNoReturn(d => d.Content == null);
                    layout.IsActive = true;
                    break;

                case FrmState.Mini2:
                    layout             = Factory(name, thisControl);
                    viewitem.Container = layout;
                    dockablePane3.Children.Add(layout);
                    dockablePane3.Children.RemoveElementsNoReturn(d => d.Content == null);
                    layout.IsActive = true;
                    layout.CanClose = false;
                    break;

                case FrmState.Custom:
                    var window = new Window {
                        Title = name
                    };
                    window.Content = thisControl;
                    window.ShowDialog();
                    break;

                case FrmState.Float:

                    layout = Factory(name, thisControl);

                    dockablePane1.Children.Add(layout);

                    layout.Float();

                    break;
                }
                var canNotClose = new[]
                { GlobalHelper.Get("ModuleMgmt"), GlobalHelper.Get("SysState"), GlobalHelper.Get("DebugView") };
                if (canNotClose.Contains(name))
                {
                    if (layout != null)
                    {
                        layout.CanClose = false;
                    }
                }
                viewitem.Container = layout;
            }
            catch (Exception ex)
            {
                XLogSys.Print.ErrorFormat("{0}{1},{2}", GlobalHelper.Get("ControlLoad"), GlobalHelper.Get("Error"),
                                          ex.Message);
            }
        }
Ejemplo n.º 8
0
 public virtual string Run(ViewDictionary data)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 9
0
        public string Run(ViewDictionary data)
        {
            if (null == generatedOutputter)
                generatedOutputter = Parse();

            return generatedOutputter.Run(data);
        }