コード例 #1
0
        private void HandleConvertDone(IAsyncResult result)
        {
            try
            {
                if (_converter.EndConvert(result))
                {
                    Analytics.TrackEvent("COConvert_Done", new Dictionary <string, string>()
                    {
                        { "Path", _convertedFilePath }
                    });
                    base.InitializeDAL(_convertedFilePath);
                    this.AppState.AddRecentFile(_convertedFilePath);
                    this.WindowPresenter.ShowCruiseLandingLayout();
                }
                else
                {
                    this.ActiveView.ShowMessage("error unable to convert file");//TODO better error messages
                }
            }
            catch (System.IO.FileNotFoundException e)
            {
                Crashes.TrackError(e);
                MessageBox.Show(e.Message);
            }

            _convertedFilePath = null;
            //_convertDialog = null;
            _converter = null;
        }
コード例 #2
0
        /// <summary>
        /// opens file for use, handles various exceptions that can occur while opening file,
        /// determines if a cruise file/template file/or legacy cruise file
        /// </summary>
        /// <param name="filePath"></param>
        public override void OpenFile(String filePath)
        {
            base.OpenFile(filePath);
            var extention = System.IO.Path.GetExtension(filePath);
            if (extention == Strings.LEGACY_CRUISE_FILE_EXTENTION)
            {
                _converter = new COConverter();
                _convertedFilePath = System.IO.Path.ChangeExtension(filePath, Strings.CRUISE_FILE_EXTENTION);

                _converter.BenginConvert(filePath, _convertedFilePath, null, HandleConvertDone);
                return;
            }
        }
コード例 #3
0
        public void HandleConvertDone(IAsyncResult result)
        {
            if (_converter.EndConvert(result))
            {
                base.InitializeDAL(_convertedFilePath);
                this.AppState.AddRecentFile(_convertedFilePath);
                this.WindowPresenter.ShowCruiseLandingLayout();
            }
            else
            {
                this.ActiveView.ShowMessage("error unable to convert file");//TODO better error messages
            }

            _convertedFilePath = null;
            //_convertDialog = null;
            _converter = null;
        }
コード例 #4
0
        /// <summary>
        /// opens file for use, handles various exceptions that can occur while opening file,
        /// determines if a cruise file/template file/or legacy cruise file
        /// </summary>
        /// <param name="filePath"></param>
        public override void OpenFile(String filePath)
        {
            base.OpenFile(filePath);
            var extention = System.IO.Path.GetExtension(filePath);

            if (extention.ToLowerInvariant() == Strings.LEGACY_CRUISE_FILE_EXTENTION)
            {
                _converter         = new COConverter();
                _convertedFilePath = System.IO.Path.ChangeExtension(filePath, Strings.CRUISE_FILE_EXTENTION);

                Analytics.TrackEvent("COConvert_Start", new Dictionary <string, string>()
                {
                    { "Path", filePath }
                });
                _converter.BenginConvert(filePath, _convertedFilePath, null, HandleConvertDone);
                return;
            }
        }