コード例 #1
0
        private void OnCategorySelectionChanged()
        {
            if (string.IsNullOrWhiteSpace(CategorySelection))
            {
                return;
            }

            var list = GetFormatList(CategorySelection);

            if (list == null)
            {
                return;
            }

            list.Add(Properties.Resources.CustomString);

            FormatList = list;

            if (!FormatList.Contains(FormatSelection) || FormatSelection == Properties.Resources.CustomString)
            {
                // update format selection
                FormatSelection = FormatList.FirstOrDefault();
            }

            RaisePropertyChanged(() => FormatList);

            OutputCoordItem.CType = GetCoordinateType();
            OutputCoordItem.Name  = OutputCoordItem.CType.ToString();
        }
コード例 #2
0
        public void ValidateFormatList(string[] formats)
        {
            // check combo box
            foreach (var item in formats)
            {
                if (!FormatList.Contains(item))
                {
                    FormatList.Add(item);
                }
            }

            // remove blank
            for (int i = 0; i < FormatList.Count; i++)
            {
                if (String.IsNullOrWhiteSpace(FormatList[i]))
                {
                    FormatList.RemoveAt(i);
                    --i;
                }
            }

            // trim the list
            while (FormatList.Count > Properties.Settings.Default.FormatListCount)
            {
                FormatList.RemoveAt(0);
            }
        }
コード例 #3
0
        /// <summary>
        /// Validation if file is valid format
        /// </summary>
        /// <param name="arg">drag n drop event</param>
        /// <returns></returns>
        private bool CanAddImage(DragEventArgs arg)
        {
            var g = arg.Data.GetDataPresent(DataFormats.FileDrop);

            string[] files = (string[])arg.Data.GetData(DataFormats.FileDrop);
            for (int i = 0; i < files.Length; i++)
            {
                FileInfo info = new FileInfo(files[i]);
                if (!FormatList.Contains(info.Extension.Trim('.').ToUpper()))
                {
                    return(false);
                }
            }
            return(true);
        }
        private void OnCategorySelectionChanged()
        {
            var selectedCoordinateType = Convert.ToString(SelectedCoordinateType);

            if (string.IsNullOrWhiteSpace(selectedCoordinateType))
            {
                return;
            }

            var list = GetFormatList(selectedCoordinateType);

            if (list == null)
            {
                return;
            }

            if (selectedCoordinateType != CoordinateType.Default.ToString())
            {
                list.Add(CoordinateConversionLibrary.Properties.Resources.CustomString);
            }

            FormatList = list;
            if ((
                    (!FormatList.Contains(FormatSelection) || FormatSelection == CoordinateConversionLibrary.Properties.Resources.CustomString) &&
                    !CoordinateConversionLibraryConfig.AddInConfig.IsCustomFormat)
                )
            {
                // update format selection
                FormatSelection = FormatList.FirstOrDefault();
            }

            RaisePropertyChanged(() => FormatList);

            if (!CoordinateConversionLibraryConfig.AddInConfig.IsCustomFormat)
            {
                Format = GetFormatFromDefaults();
            }
            else
            {
                Format = CoordinateBase.InputCustomFormat;
            }
            RaisePropertyChanged(() => Format);
        }