Exemple #1
0
        public void ImagesTest()
        {
            var image = ImagesStorage.Get("row");

            Assert.IsTrue(image != null);
            var frm = new Form
            {
                StartPosition = FormStartPosition.CenterScreen,
                Location      = new Point(50, 50),
                Size          = new Size(700, 600)
            };
            var pb = new PictureBox {
                Image = image, Location = new Point(10, 10), Size = new Size(60, 60)
            };

            frm.Controls.Add(pb);

            //var image2 = ImagesStorage.Get("armenia-flag");
            var image2 = ImagesStorage.Get("azerbaijan_flag_2_");
            var pb2    = new PictureBox {
                Image = image2, Location = new Point(10, 110), Size = new Size(60, 60)
            };

            frm.Controls.Add(pb2);

            frm.ShowDialog();
        }
Exemple #2
0
 private void InitButton(SimpleButton btn, ActionMetaItem action)
 {
     btn.Text  = GetMessage(action.CaptionId(BusinessObject, Permissions));
     btn.Image = ImagesStorage.Get(action.IconId(BusinessObject, Permissions));
     if (!string.IsNullOrEmpty(action.TooltipId(BusinessObject, Permissions)))
     {
         var superToolTip = new SuperToolTip();
         //TODO получать текст специальным методом
         superToolTip.Items.Add(GetMessage(action.TooltipId(BusinessObject, Permissions)));
         btn.SuperTip = superToolTip;
     }
     SetControlWidth(btn);
 }
Exemple #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="action"></param>
        /// <param name="needAddAction"></param>
        public void AddAction(ActionMetaItem action, bool needAddAction)
        {
            int index = Actions.Count;
            var image = ImagesStorage.Get(action.IconId(BusinessObject, Permissions));

            if (action.ActionType == ActionTypes.Container)
            {
                m_ButtonMain.Tag  = action;
                m_ButtonMain.Text = GetCaption(action.CaptionId(BusinessObject, Permissions));
                m_ButtonMain.Name = String.Format("btn{0}", action.Name);
                if (image != null)
                {
                    m_ButtonMain.Image = image;
                }
                if (!string.IsNullOrEmpty(action.TooltipId(BusinessObject, Permissions)))
                {
                    var superToolTip = new SuperToolTip();
                    //TODO получать текст специальным методом
                    superToolTip.Items.Add(GetCaption(action.TooltipId(BusinessObject, Permissions)));
                    m_ButtonMain.SuperTip = superToolTip;
                }
                return;
            }
            var button = new BarButtonItem(m_PopupActions.Manager, GetCaption(action.CaptionId(BusinessObject, Permissions)))
            {
                Id = index, Tag = action
            };

            if (image != null)
            {
                button.Glyph = image;
            }
            button.ItemClick += OnButtonItemClick;
            button.Enabled    = action.IsEnable(BusinessObject, BusinessObject.GetPermissions());

            ButtonLinks.Add(action, m_PopupActions.AddItem(button));
            if (needAddAction)
            {
                Actions.Add(action);
            }

            //TODO правильно ли следующее
            if (String.IsNullOrEmpty(m_ButtonMain.Text) && Actions.Count >= 1)
            {
                m_ButtonMain.Tag  = Actions[0];
                m_ButtonMain.Text = GetCaption(Actions[0].Container);
            }
        }
Exemple #4
0
        private static ImagesStorage InitializeStorageClientInstance(AppSettings appSettings)
        {
            var imagesStorage = new ImagesStorage(appSettings.StorageConnectionString, appSettings.StorageImagesContainerName);

            return(imagesStorage);
        }