コード例 #1
0
        // Set the header using the Export Platform.
        private void Setup()
        {
            // Set the "Export to..." text based on the ExportFormat's Name and the Type supplied to us in the constructor.
            switch (Type)
            {
            case FormatType.Import:
                ExportPlatform_ExportBtn.Content = "Import";
                ExportPlatform.Text = $"Import from {ExpFormat.GetName()}";
                Title = $"Import from {ExpFormat.GetName()}";
                return;

            case FormatType.Export:
                ExportPlatform.Text = $"Export to {ExpFormat.GetName()}";
                Title = $"Export to {ExpFormat.GetName()}";
                return;
            }
        }
コード例 #2
0
        /// <summary>
        /// Method name: RunIEX()
        ///
        /// Runs the import/export (Version 515)
        /// </summary>
        private bool RunIEX()
        {
            // Old code - dano move when we can do easy previews due to multitab
            // Stop the ticktimer while importing or exporting because we need to do this stuff.
            MnWindow.TickTimer.Stop();

            switch (Type)
            {
            case FormatType.Import:
                ImportResult IResult = ExpFormat.Import();

                switch (IResult.Status)
                {
                case ExportResults.Cancelled:
                    MnWindow.TickTimer.Start();
                    return(true);

                case ExportResults.Error:
                    MnWindow.TickTimer.Start();
                    return(false);

                case ExportResults.OK:
                    if (IResult.Project.FileName == null)
                    {
                        Error.Throw("Fatal Error!", "Failed to set current file name", ErrorSeverity.Error, 190);
                        return(false);        // possibly extend subsequent else
                    }
                    else
                    {
                        GlobalState.SetCurrentOpenFile(IResult.Project.FileName);
                    }

                    //may bindings work?
                    MnWindow.Title = $"Track Maker 2.0 - {GlobalState.GetCurrentOpenFile()}";

                    // we are not setting current project before, usually you wouldn't need to do this hack
                    MnWindow.CurrentProject = IResult.Project;

                    MnWindow.TickTimer.Start();
                    MnWindow.UpdateLayout();


                    return(true);
                }
                // this shouldn't run
                return(true);

            case FormatType.Export:

                if (ExpFormat is IImageExportFormat)
                {
                    IImageExportFormat IIEF = (IImageExportFormat)ExpFormat;

                    // surely allowing (bool == bool?) would be more intuitive for users
                    bool IsFullQuality    = (bool)QualityControl.QualityControl_FullQuality.IsChecked;
                    bool IsHalfQuality    = (bool)QualityControl.QualityControl_HalfQuality.IsChecked;
                    bool IsQuarterQuality = (bool)QualityControl.QualityControl_QuarterQuality.IsChecked;
                    bool IsEighthQuality  = (bool)QualityControl.QualityControl_EighthQuality.IsChecked;

                    if (IsFullQuality)
                    {
                        IIEF.Quality = ImageQuality.Full;
                    }
                    if (IsHalfQuality)
                    {
                        IIEF.Quality = ImageQuality.Half;
                    }
                    if (IsQuarterQuality)
                    {
                        IIEF.Quality = ImageQuality.Quarter;
                    }
                    if (IsEighthQuality)
                    {
                        IIEF.Quality = ImageQuality.Eighth;
                    }

                    // need to make this priscilla-specific
                    return(ExpFormat.Export(MnWindow.CurrentProject));
                }
                else
                {
                    ExpFormat.Export(MnWindow.CurrentProject);
                }

                // wish VS allowed the same var names under different code paths
                Project CurProject = MnWindow.CurrentProject;

                if (CurProject.FileName != null && CurProject.FileName != "")
                {
                    MnWindow.Title = $"Track Maker 2.0 - {CurProject.FileName}";
                }
                MnWindow.UpdateLayout();
                MnWindow.TickTimer.Start();


                Close();
                return(true);
            }

            return(false);
        }