Ejemplo n.º 1
0
        private void SelectProfileImage(bool newUser = false)
        {
            SystemVersion firmwareVersion = _contentManager.GetCurrentFirmwareVersion();

            if (firmwareVersion == null)
            {
                ProfileImageFileChooser();
            }
            else
            {
                Dictionary <int, string> buttons = new Dictionary <int, string>()
                {
                    { 0, "Upload Image File" },
                    { 1, "Select Firmware Avatar" }
                };

                ResponseType responseDialog = GtkDialog.CreateCustomDialog("Profile Image Selection",
                                                                           "Choose a Profile Image",
                                                                           "You may upload a custom profile image, or select an avatar from the system firmware.",
                                                                           buttons, MessageType.Question);

                if (responseDialog == 0)
                {
                    ProfileImageFileChooser();
                }
                else if (responseDialog == (ResponseType)1)
                {
                    AvatarWindow avatarWindow = new AvatarWindow(_contentManager, _virtualFileSystem)
                    {
                        NewUser = newUser
                    };

                    avatarWindow.DeleteEvent += AvatarWindow_DeleteEvent;

                    avatarWindow.SetSizeRequest((int)(avatarWindow.DefaultWidth * Program.WindowScaleFactor), (int)(avatarWindow.DefaultHeight * Program.WindowScaleFactor));
                    avatarWindow.Show();
                }
            }
        }
Ejemplo n.º 2
0
        public UserProfilesManagerWindow(AccountManager accountManager, ContentManager contentManager, VirtualFileSystem virtualFileSystem) : base($"Ryujinx {Program.Version} - Manage User Profiles")
        {
            Icon = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.Ui.Resources.Logo_Ryujinx.png");

            InitializeComponent();

            _selectedColor.Red   = 0.212;
            _selectedColor.Green = 0.843;
            _selectedColor.Blue  = 0.718;
            _selectedColor.Alpha = 1;

            _accountManager = accountManager;
            _contentManager = contentManager;

            CellRendererToggle userSelectedToggle = new CellRendererToggle();

            userSelectedToggle.Toggled += UserSelectedToggle_Toggled;

            // NOTE: Uncomment following line when multiple selection of user profiles is supported.
            //_usersTreeView.AppendColumn("Selected",  userSelectedToggle,       "active", 0);
            _usersTreeView.AppendColumn("User Icon", new CellRendererPixbuf(), "pixbuf", 1);
            _usersTreeView.AppendColumn("User Info", new CellRendererText(), "text", 2, "background-rgba", 3);

            _tableStore.SetSortColumnId(0, SortType.Descending);

            RefreshList();

            if (_contentManager.GetCurrentFirmwareVersion() != null)
            {
                Task.Run(() =>
                {
                    AvatarWindow.PreloadAvatars(contentManager, virtualFileSystem);
                    _avatarsPreloadingEvent.Set();
                });
            }
        }