Ejemplo n.º 1
0
        private void Export_Init(FormatType FType, IExportFormat ExportFormat)
        {
            Logging.Log("ExportUI Initialising...");
            Logging.Log($"Format type: {FType}, export format: {ExportFormat.GetName()}");

            ExpFormat      = ExportFormat;
            StormsToExport = MnWindow.CurrentProject.SelectedBasin.GetFlatListOfStorms(); // feature pushed back to Dano, maybe even 3.0/"Aurora"
            Type           = FType;

            if (ExportFormat is IImageExportFormat)
            {
                IImageExportFormat ExpFI = (IImageExportFormat)ExportFormat;
                if (!ExpFI.DisplayQualityControl)
                {
                    HideQualityControl();
                }
            }
            else // not an IImageExportFormat
            {
                HideQualityControl();
            }

            if (!GeneratePreview())
            {
                Error.Throw("Error!", "Error generating preview", ErrorSeverity.FatalError, 283);
            }
        }
Ejemplo n.º 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);
        }