コード例 #1
0
        public ActionResult EditFont(int id)
        {
            FontRecord    record     = _fontService.GetFont(id);
            FontViewModel editRecord = new FontViewModel()
            {
            };

            editRecord.Id       = record.Id;
            editRecord.Family   = record.Family;
            editRecord.FileName = record.FileName;
            string[] stringSeparators = new string[] { "," };
            string[] separatedTags;
            string   Tags = record.Tags.Trim(new Char[] { '[', '*', ',', ']', ' ', '.' });

            Tags = Tags.Replace("\"", "");
            string resultTags = "";

            separatedTags = Tags.Split(stringSeparators, StringSplitOptions.None);
            int i = 0;

            foreach (var item in separatedTags)
            {
                if (i != 0)
                {
                    resultTags = resultTags + "," + " ";
                }
                resultTags = resultTags + item;
                i++;
            }
            editRecord.Tags = resultTags;
            return(View(editRecord));
        }
コード例 #2
0
        /// <summary>
        /// Initializes a new instance of the VaultPanel class.
        /// </summary>
        /// <param name="dragInfo">Instance of the ItemDragInfo</param>
        /// <param name="numberOfBags">Number of bags in this panel</param>
        /// <param name="panelSize">Main panel size</param>
        /// <param name="numberOfAutosortButtons">The number of AutoSort buttons associated with this panel.,</param>
        /// <param name="autoMoveLocation">The automovelocation for this panel.</param>
        public VaultPanel(ItemDragInfo dragInfo, int numberOfBags, Size panelSize, int numberOfAutosortButtons, AutoMoveLocation autoMoveLocation, IServiceProvider serviceProvider)
        {
            InitializeComponent();

            this.ServiceProvider = serviceProvider;
            this.FontService     = this.ServiceProvider.GetService <IFontService>();
            this.UIService       = this.ServiceProvider.GetService <IUIService>();

            this.DragInfo         = dragInfo;
            this.AutoMoveLocation = autoMoveLocation;
            this.Text             = Resources.PlayerPanelNoVault;
            this.NoPlayerString   = Resources.PlayerPanelNoVault;
            this.DrawAsGroupBox   = false;

            // Setup the offset to make room for the autosort button
            int autosortOffset = 0;

            if (numberOfAutosortButtons > 0)
            {
                autosortOffset = Convert.ToInt32(27.0F * UIService.Scale);
            }

            this.Size = new Size(
                (panelSize.Width * UIService.ItemUnitSize) + Convert.ToInt32(10.0F * UIService.Scale) + autosortOffset + BorderPad,
                (panelSize.Height * UIService.ItemUnitSize) + Convert.ToInt32(56.0F * UIService.Scale) + BorderPad);

            this.Font = new Font(this.Font.FontFamily, this.Font.SizeInPoints * UIService.Scale, this.Font.Style);

            this.BagPanelOffset = 0;             // bag panel starts with bag #0
            this.BagSackPanel   = new SackPanel(panelSize.Width, panelSize.Height, this.DragInfo, autoMoveLocation, this.ServiceProvider);
            this.BagSackPanel.SetLocation(new Point(autosortOffset + BorderPad, this.Size.Height - (this.BagSackPanel.Size.Height + BorderPad)));
            this.BagSackPanel.OnNewItemHighlighted    += new EventHandler <SackPanelEventArgs>(this.NewItemHighlightedCallback);
            this.BagSackPanel.OnAutoMoveItem          += new EventHandler <SackPanelEventArgs>(this.AutoMoveItemCallback);
            this.BagSackPanel.OnActivateSearch        += new EventHandler <SackPanelEventArgs>(this.ActivateSearchCallback);
            this.BagSackPanel.OnItemSelected          += new EventHandler <SackPanelEventArgs>(this.ItemSelectedCallback);
            this.BagSackPanel.OnClearAllItemsSelected += new EventHandler <SackPanelEventArgs>(this.ClearAllItemsSelectedCallback);
            this.BagSackPanel.OnResizeForm            += new EventHandler <ResizeEventArgs>(this.ResizeFormCallback);
            this.Controls.Add(this.BagSackPanel);
            this.BagSackPanel.IsPlayerBagPanel = false;
            this.BagSackPanel.MaxSacks         = numberOfBags;
            // Create the buttons
            this.bagButtons = new Collection <BagButtonBase>();
            this.CreateBagButtons(numberOfBags);

            // Assume it's the trash panel if we are not autosorting it.
            if (numberOfAutosortButtons == 0)
            {
                this.BagSackPanel.SackType = SackType.Trash;
            }
            else
            {
                this.autoSortButtons = new Collection <AutoSortButton>();

                for (int i = 0; i < numberOfAutosortButtons; ++i)
                {
                    this.autoSortButtons.Insert(i, this.CreateAutoSortButton(i));
                    this.Controls.Add(this.autoSortButtons[i]);
                }

                this.BagSackPanel.SackType = SackType.Vault;
            }

            this.contextMenu.Font = FontService.GetFont(9.0F * UIService.Scale);

            this.PropertyChanged += new PropertyChangedEventHandler(this.PropertyChangedCallback);

            // to avoid flickering use double buffer and to force control to use OnPaint
            this.SetStyle(ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer, true);
        }