Ejemplo n.º 1
0
        public void Push(ImportLyricStep step)
        {
            if (CurrentScreen is IImportLyricSubScreen lyricSubScreen)
            {
                if (step == lyricSubScreen.Step)
                {
                    throw new ScreenNotCurrentException("Cannot push same screen.");
                }

                if (step <= lyricSubScreen.Step)
                {
                    throw new ScreenNotCurrentException("Cannot push previous then current screen.");
                }

                if (step != ImportLyricStep.GenerateRuby && step - lyricSubScreen.Step > 1)
                {
                    throw new ScreenNotCurrentException("Only generate ruby step can be skipped.");
                }
            }

            switch (step)
            {
            case ImportLyricStep.ImportLyric:
                Push(new DragFileSubScreen());
                return;

            case ImportLyricStep.EditLyric:
                Push(new EditLyricSubScreen());
                return;

            case ImportLyricStep.AssignLanguage:
                Push(new AssignLanguageSubScreen());
                return;

            case ImportLyricStep.GenerateRuby:
                Push(new GenerateRubyRomajiSubScreen());
                return;

            case ImportLyricStep.GenerateTimeTag:
                Push(new GenerateTimeTagSubScreen());
                return;

            case ImportLyricStep.Success:
                Push(new SuccessSubScreen());
                return;

            default:
                throw new ScreenNotCurrentException("Screen is not in the lyric import step.");
            }
        }
Ejemplo n.º 2
0
            public void GoToStep(ImportLyricStep step)
            {
                if (!(ScreenStack.CurrentScreen is IImportLyricSubScreen lyricSubScreen))
                {
                    return;
                }

                if (step == lyricSubScreen.Step)
                {
                    return;
                }

                if (step <= lyricSubScreen.Step)
                {
                    return;
                }

                var totalSteps = EnumUtils.GetValues <ImportLyricStep>().Where(x => x > lyricSubScreen.Step && x <= step);

                foreach (var gotoStep in totalSteps)
                {
                    ScreenStack.Push(gotoStep);
                }
            }