Esempio n. 1
0
        private void BoxExcelDir_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            string dir = boxExcelDir.SelectedItem.ToString();

            AppData.Config.ExcelDir = dir;
            AppData.saveConfig();
            if (ExcelDirChanged != null)
            {
                ExcelDirChanged.Invoke();
            }
        }
 private void btnBrowseExcelDir_Clicked(object sender, RoutedEventArgs e)
 {
     System.Windows.Forms.FolderBrowserDialog dialog = new System.Windows.Forms.FolderBrowserDialog();
     dialog.Description = "请选择Excel目录";
     dialog.ShowNewFolderButton = true;
     if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
     {
         if (!string.IsNullOrEmpty(dialog.SelectedPath))
         {
             txtExcelDir.Text = dialog.SelectedPath;
             AppData.Config.ExcelDir = dialog.SelectedPath;
             AppData.saveConfig();
             if (ExcelDirChanged != null)
                 ExcelDirChanged.Invoke();
         }
     }
 }
Esempio n. 3
0
        private void btnBrowseExcelDir_Clicked(object sender, RoutedEventArgs e)
        {
            System.Windows.Forms.FolderBrowserDialog dialog = new System.Windows.Forms.FolderBrowserDialog();
            dialog.Description         = "请选择Excel目录";
            dialog.ShowNewFolderButton = true;
            if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                if (!string.IsNullOrEmpty(dialog.SelectedPath))
                {
                    //boxExcelDir.Text = dialog.SelectedPath;
                    AppData.Config.ExcelDir = dialog.SelectedPath;

                    if (AppData.Config.ExcelDirHistory == null)
                    {
                        AppData.Config.ExcelDirHistory = new Dictionary <string, int>();
                    }
                    if (AppData.Config.ExcelDirHistory.ContainsKey(dialog.SelectedPath))
                    {
                        AppData.Config.ExcelDirHistory[dialog.SelectedPath] += 1;
                    }
                    else
                    {
                        AppData.Config.ExcelDirHistory[dialog.SelectedPath] = 1;
                        boxExcelDir.Items.Add(dialog.SelectedPath);
                    }
                    boxExcelDir.SelectedItem = dialog.SelectedPath;
                    Dictionary <string, int> temp = AppData.Config.ExcelDirHistory.OrderBy(o => o.Value).ToDictionary(p => p.Key, o => o.Value);
                    AppData.Config.ExcelDirHistory = temp;

                    AppData.saveConfig();
                    if (ExcelDirChanged != null)
                    {
                        ExcelDirChanged.Invoke();
                    }
                }
            }
        }