Пример #1
0
            void LoadMainMenuCompleted(object sender, RunWorkerCompletedEventArgs e)
            {
                keyboardInput.ResetSelectedByKey();
                LoadStopped();
                MenuData menuData = (MenuData)e.Result;

                switch (menuData.Validity)
                {
                case MenuDataValidity.Valid:
                    DisposeMenu(menus[menuData.Level]);
                    menus[0] = Create(menuData, Path.GetFileName(Config.Path));
                    AsEnumerable.ToList().ForEach(m => { m.ShowWithFade(); });
                    break;

                case MenuDataValidity.Empty:
                    if (!showingMessageBox)
                    {
                        showingMessageBox = true;
                        MessageBox.Show(Translator.GetText(
                                            "MessageRootFolderEmpty"));
                        OpenFolder();
                        showingMessageBox = false;
                    }

                    break;

                case MenuDataValidity.NoAccess:
                    if (!showingMessageBox)
                    {
                        showingMessageBox = true;
                        MessageBox.Show(Translator.GetText(
                                            "MessageRootFolderNoAccess"));
                        OpenFolder();
                        showingMessageBox = false;
                    }

                    break;

                case MenuDataValidity.AbortedOrUnknown:
                    Log.Info("MenuDataValidity.AbortedOrUnknown");
                    break;

                default:
                    break;
                }
            }
Пример #2
0
        object IList <object> .this[int index]
        {
            get
            {
                if (!_isGrouped)
                {
                    return(_collection.ElementAt(index));
                }
                else
                {
                    return(AsEnumerable.ElementAt(index));                    //TODO: should use logic from ItemsControl for caching and utilizing group counts
                }
            }

            set
            {
                (_collection as IList ?? throw new NotSupportedException())[index] = value;