コード例 #1
0
        public void UpdateDrawerIcon(ImageSource source)
        {
            if (source == null)
            {
                _drawerIcon.LoadFromImageSourceAsync(ImageSource.FromResource(DefaultIcon, GetType().Assembly));
            }
            else
            {
                _drawerIconBox.UnPack(_drawerIcon);
                _drawerIcon.Unrealize();

                _drawerIcon = new EImage(this)
                {
                    AlignmentY = -1,
                    AlignmentX = -1,
                    WeightX    = 1,
                    WeightY    = 1
                };
                _drawerIcon.Show();
                _drawerIconBox.PackEnd(_drawerIcon);

                if (source is FileImageSource fsource)
                {
                    _drawerIcon.Load(fsource.ToAbsPath());
                }
                else
                {
                    _drawerIcon.LoadFromImageSourceAsync(source);
                }
            }
        }