/// <summary>
        /// </summary>
        /// <param name="f"></param>
        /// <returns>The requested Application Path WITHOUT a slash at the end</returns>
        public static string getFolderPath(ApplicationFolder f)
        {
            switch (f)
            {
            case ApplicationFolder.ApplicationData:
                return(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\" + APP_FOLDER);

            case ApplicationFolder.Settings:
                return(String.Format("{0}\\{1}", getFolderPath(ApplicationFolder.ApplicationData), SETTINGS_FOLDER));

            case ApplicationFolder.Application:
                return(AppDomain.CurrentDomain.BaseDirectory.TrimEnd('\\'));;

            case ApplicationFolder.Language:
                return(String.Format("{0}\\{1}", getFolderPath(ApplicationFolder.Application), LANGUAGE_FOLDER));

            case ApplicationFolder.Sessions:
                return(String.Format("{0}\\{1}", getFolderPath(ApplicationFolder.ApplicationData), SESSIONS_FOLDER));

            case ApplicationFolder.Pictures:
                return(String.Format("{0}\\{1}", getFolderPath(ApplicationFolder.ApplicationData), PICTURES_FOLDER));

            case ApplicationFolder.Defaults:
                return(String.Format("{0}\\{1}", getFolderPath(ApplicationFolder.Application), DEFAULTS_FOLDER));

            case ApplicationFolder.Maps:
                return(String.Format("{0}\\{1}", getFolderPath(ApplicationFolder.ApplicationData), MAPS_FOLDER));

            case ApplicationFolder.Icons:
                return(String.Format("{0}\\{1}", getFolderPath(ApplicationFolder.Application), ICONS_FOLDER));

            default:
                throw new ArgumentException("Unknown FolderType!");
            }
        }
Exemple #2
0
        /// <summary>
        /// </summary>
        /// <param name="f"></param>
        /// <returns>The requested Application Path WITHOUT a slash at the end</returns>
        public static string getFolderPath(ApplicationFolder f)
        {
            switch (f)
            {
            case ApplicationFolder.ApplicationData:
                return(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\" + APP_FOLDER);

                break;

            case ApplicationFolder.Settings:
                return(String.Format("{0}\\{1}", getFolderPath(ApplicationFolder.ApplicationData), SETTINGS_FOLDER));

                break;

            case ApplicationFolder.Application:
                return(AppDomain.CurrentDomain.BaseDirectory.TrimEnd('\\'));;
                break;

            case ApplicationFolder.Language:
                return(String.Format("{0}\\{1}", getFolderPath(ApplicationFolder.Application), LANGUAGE_FOLDER));

                break;

            case ApplicationFolder.Transactions:
                return(String.Format("{0}\\{1}", getFolderPath(ApplicationFolder.ApplicationData), TRANSACTION_FOLDER));

                break;

            case ApplicationFolder.CurrentTransaction:
                return(String.Format("{0}\\{1}", getFolderPath(ApplicationFolder.Transactions), currentTransaction));

                break;

            case ApplicationFolder.Pictures:
                return(String.Format("{0}\\{1}", getFolderPath(ApplicationFolder.Settings), PICTURES_FOLDER));

                break;

            case ApplicationFolder.EmptyDatabases:
                return(String.Format("{0}\\{1}", getFolderPath(ApplicationFolder.Application), DATABASE_FOLDER));

                break;

            case ApplicationFolder.Maps:
                return(String.Format("{0}\\{1}", getFolderPath(ApplicationFolder.Settings), MAPS_FOLDER));

                break;

            case ApplicationFolder.Icons:
                return(String.Format("{0}\\{1}", getFolderPath(ApplicationFolder.Application), ICONS_FOLDER));

                break;

            default:
                throw new ArgumentException("Unknown FolderType!");
                break;
            }
        }
        private static void createIfNotExists(ApplicationFolder f)
        {
            var path = getFolderPath(f);

            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }
        }
        /// <summary>
        /// </summary>
        /// <param name="f"></param>
        /// <returns>The requested Application Path WITHOUT a slash at the end</returns>
        public static string getFolderPath(ApplicationFolder f)
        {
            switch (f)
            {
                case ApplicationFolder.ApplicationData:
                    return Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\" + APP_FOLDER;

                case ApplicationFolder.Settings:
                    return String.Format("{0}\\{1}", getFolderPath(ApplicationFolder.ApplicationData), SETTINGS_FOLDER);

                case ApplicationFolder.Application:
                    return AppDomain.CurrentDomain.BaseDirectory.TrimEnd('\\'); ;

                case ApplicationFolder.Language:
                    return String.Format("{0}\\{1}", getFolderPath(ApplicationFolder.Application), LANGUAGE_FOLDER);

                case ApplicationFolder.Sessions:
                    return String.Format("{0}\\{1}", getFolderPath(ApplicationFolder.ApplicationData), SESSIONS_FOLDER);

                case ApplicationFolder.Pictures:
                    return String.Format("{0}\\{1}", getFolderPath(ApplicationFolder.ApplicationData), PICTURES_FOLDER);

                case ApplicationFolder.Defaults:
                    return String.Format("{0}\\{1}", getFolderPath(ApplicationFolder.Application), DEFAULTS_FOLDER);

                case ApplicationFolder.Maps:
                    return String.Format("{0}\\{1}", getFolderPath(ApplicationFolder.ApplicationData), MAPS_FOLDER);

                case ApplicationFolder.Icons:
                    return String.Format("{0}\\{1}", getFolderPath(ApplicationFolder.Application), ICONS_FOLDER);

                default:
                    throw new ArgumentException("Unknown FolderType!");

            }
        }
Exemple #5
0
 /// <summary>
 /// 执行与释放或重置非托管资源相关的应用程序定义的任务。
 /// </summary>
 public void Dispose()
 {
     try { ApplicationFolder.DeleteDirectory("~/App_Data"); }
     catch { }
 }
Exemple #6
0
        //根据数据显示控件 bRet true 新增
        private void ShowUpdataData()
        {
            try
            {
                foreach (var val in mapControl)
                {
                    Control c = val.Value;
                    if (c is Label)
                    {
                        if (c.Name.Equals("JZNF"))
                        {
                            c.Text = string.Format("截止至{0}", mapResult[c.Name]);
                        }
                    }
                    else if (c is DevExpress.XtraEditors.DateEdit)
                    {
                        if (mapResult.ContainsKey(c.Name))
                        {
                            c.Text = Convert.ToDateTime(mapResult[c.Name]).ToString("yyyy-MM-dd");
                        }
                        else
                        {
                            c.Text = "";
                        }
                    }
                    else if (c is TextEdit || c is DevExpress.XtraEditors.ComboBoxEdit)
                    {
                        if (mapResult.ContainsKey(c.Name))
                        {
                            c.Text = mapResult[c.Name];
                        }
                        else
                        {
                            c.Text = "";
                        }
                    }
                    else if (c is CheckEdit)
                    {
                        if (mapResult.ContainsKey(c.Name))
                        {
                            if (mapResult[c.Name] == "是")
                            {
                                ((CheckEdit)c).Checked = true;
                            }
                            else
                            {
                                ((CheckEdit)c).Checked = false;
                            }
                        }
                        else
                        {
                            ((CheckEdit)c).Checked = false;
                        }
                    }
                    else if (c is PictureEdit)
                    {
                        if (mapResult.ContainsKey(c.Name))
                        {
                            string path = "";
                            if (c.Name == "FPTP_PICTURE")
                            {
                                path = String.Format("{0}\\{1}", ApplicationFolder.billImage, mapResult[c.Name]);
                            }
                            else
                            {
                                path = String.Format("{0}\\{1}", ApplicationFolder.driveImage, mapResult[c.Name]);
                            }
                            try
                            {
                                if (!File.Exists(path))
                                {
                                    if (c.Name == "FPTP_PICTURE")
                                    {
                                        ApplicationFolder.FtpDownload(String.Format("/IMAGEBill/{0}/{1}", mapResult["CLSCQY"], mapResult[c.Name]), path, true);
                                    }
                                    else
                                    {
                                        ApplicationFolder.FtpDownload(String.Format("/IMAGEDrive/{0}/{1}", mapResult["CLSCQY"], mapResult[c.Name]), path, true);
                                    }
                                }

                                Image image      = Image.FromFile(path);
                                Image cloneImage = new Bitmap(image, c.Width, c.Height);
                                ((PictureEdit)c).Image = cloneImage;
                                image.Dispose();
                            }
                            catch (Exception ex)
                            {
                                ((PictureEdit)c).Image = null;
                            }
                        }
                        else
                        {
                            ((PictureEdit)c).Image = null;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LogManager.Log("Error", "SingleInfoForm", "根据数据显示控件失败,失败原因:" + ex.Message);
            }
        }
 private static void createIfNotExists(ApplicationFolder f)
 {
     var path = getFolderPath(f);
     if (!Directory.Exists(path))
         Directory.CreateDirectory(path);
 }
 /// <summary>
 /// </summary>
 /// <param name="f"></param>
 /// <returns>The requested Application Path WITHOUT a slash at the end</returns>
 public static string getFolderPath(ApplicationFolder f)
 {
     switch (f)
     {
         case ApplicationFolder.ApplicationData:
             return Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\" + APP_FOLDER;
             break;
         case ApplicationFolder.Settings:
             return String.Format("{0}\\{1}", getFolderPath(ApplicationFolder.ApplicationData), SETTINGS_FOLDER);
             break;
         case ApplicationFolder.Application:
             return AppDomain.CurrentDomain.BaseDirectory.TrimEnd('\\'); ;
             break;
         case ApplicationFolder.Language:
             return String.Format("{0}\\{1}", getFolderPath(ApplicationFolder.Application), LANGUAGE_FOLDER);
             break;
         case ApplicationFolder.Transactions:
             return String.Format("{0}\\{1}", getFolderPath(ApplicationFolder.ApplicationData), TRANSACTION_FOLDER);
             break;
         case ApplicationFolder.CurrentTransaction:
             return String.Format("{0}\\{1}", getFolderPath(ApplicationFolder.Transactions), currentTransaction);
             break;
         case ApplicationFolder.Pictures:
             return String.Format("{0}\\{1}", getFolderPath(ApplicationFolder.Settings), PICTURES_FOLDER);
             break;
         case ApplicationFolder.EmptyDatabases:
             return String.Format("{0}\\{1}", getFolderPath(ApplicationFolder.Application), DATABASE_FOLDER);
             break;
         case ApplicationFolder.Maps:
             return String.Format("{0}\\{1}",getFolderPath(ApplicationFolder.Settings), MAPS_FOLDER);
             break;
         case ApplicationFolder.Icons:
             return String.Format("{0}\\{1}", getFolderPath(ApplicationFolder.Application), ICONS_FOLDER);
             break;
         default:
             throw new ArgumentException("Unknown FolderType!");
             break;
     }
 }