コード例 #1
0
        public void DrawBefore(CyberAttribute atr)
        {
            ToolbarAttribute attribute = atr as ToolbarAttribute;

            CyberEdit.Current.SetToolbarSelect
                (attribute.ToolbarId,
                GUILayout.Toolbar(CyberEdit.Current.GetToolbarSelect(attribute.ToolbarId),
                                  attribute.Names));
            CyberEdit.Current.SetToolbarElementCollection(attribute.ToolbarId, attribute.Names);
        }
コード例 #2
0
        /// <summary>
        /// Method initialize toolbar.
        /// It works on Resource.Id.toolbar that is placed in container
        /// </summary>
        /// <exception cref="!:AttributeException"></exception>
        private void InitToolbar()
        {
            var attrs = from attr in this.GetType().GetCustomAttributes() where attr is ToolbarAttribute select attr;

            if (attrs != null && attrs.Any())
            {
                ToolbarAttribute toolbarAttribute = (ToolbarAttribute)attrs.First();
                Toolbar = FindViewById <Toolbar>(toolbarAttribute.ToolbarResource);

                if (Toolbar == null)
                {
                    throw new AttributeException(toolbarAttribute, "Toolbar with specified id is not found.");
                }

                SetSupportActionBar(Toolbar);
                SupportActionBar.Title = ViewModel.Title;
                if (toolbarAttribute.NeedBackButton)
                {
                    SupportActionBar.SetDisplayHomeAsUpEnabled(true);
                    SupportActionBar.SetDisplayShowHomeEnabled(true);
                    Toolbar.NavigationClick += (sender, e) => OnBackPressed();
                }
            }
        }