Ejemplo n.º 1
0
        public OpenFileBinaryMenu(FileListGrid fileList)
        {
            this.Text = "開く(バイナリ形式)";

            //クリックイベント
            this.Click += (sender, e) => {
                //カレント行のパスを取得します。
                var path = fileList[0, fileList.CurrentCell.RowIndex].Value.ToString();

                //フォルダの場合は処理しない
                if (FileUtils.IsFile(path) == false)
                {
                    return;
                }

                //プラグイン生成パラメーターを設定します
                var pluginCreateParam = new PluginCreateParam {
                    ["path"]      = path,  //選択されたパス
                    ["encoding"]  = null,  //文字コード
                    ["is_binary"] = true   //バイナリーモード
                };

                //テキストエディタープラグインを生成します
                var plugin = (IFilePlugin)PluginManager.GetInstance().CreatePluginInstance(typeof(TextEditorPlugin), pluginCreateParam, this);
            };
        }
Ejemplo n.º 2
0
        public async void Import(IEnumerable <ImportedFileInfo> validFileInfos)
        {
            Result     = "";
            repository = new TRepository();

            foreach (ImportedFileInfo file in validFileInfos)
            {
                IStatDateImporter importer = GenerateImporter();
                ImportedFileInfo  fileInfo = file;
                importer.Date = fileInfo.FilePath.RetrieveFileNameBody().GetDateExtend();
                TStat stat = repository.Stats.FirstOrDefault(x => x.StatTime == importer.Date);
                if (stat == null)
                {
                    using (StreamReader reader = ReadFile(fileInfo.FilePath))
                    {
                        int count = await importer.ImportStat(reader, CsvFileDescription.CommaDescription);

                        Result += "\n" + fileInfo.FilePath + "完成导入数量:" + count;
                    }
                    fileInfo.FinishState();
                }
                else
                {
                    Result += "\n日期:" + importer.Date.ToShortDateString() + "的统计记录已导入!";
                    fileInfo.UnnecessaryState();
                }
            }
            FileListGrid.SetDataSource(FileInfoList);
        }
Ejemplo n.º 3
0
        public OpenFileMenu(FileListGrid fileList)
        {
            this.Text = "開く";

            //クリックイベント
            this.Click += (sender, e) => {
                if (fileList.CurrentCell.RowIndex == -1)
                {
                    return;                                      //ヘッダーダブルクリックは無視する
                }
                //カレント行のパスを取得します。
                var path = fileList[0, fileList.CurrentCell.RowIndex].Value.ToString();

                //フォルダまたはファイル選択イベントを発生させます
                RaiseSelectedEvent(path);
            };
        }
Ejemplo n.º 4
0
        public CreateDirMenu(FileListGrid fileList)
        {
            this.Text = "新規作成(フォルダ)";

            //クリックイベント
            this.Click += (sender, e) => {
                //フォルダ作成
                var path = FileUtils.CreateNewDir(fileList.CurrentPath);

                //行データの生成
                var rowData = new object[fileList.ColumnCount];

                //行を追加します
                var rowIndex = fileList.Rows.Add(rowData);

                //行データを設定します
                fileList.SetRowData(rowIndex, path);

                //追加した行にカレントをします
                fileList.CurrentCell = fileList[fileList.CurrentCell.ColumnIndex, rowIndex];
            };
        }