Beispiel #1
0
 public void UpdateCamera(CameraInfo camera)
 {
     if (camera != null && SelectedFileInfo != null)
     {
         SelectedFileInfo.CameraId = camera.CameraID;
         DataRow row = m_Table.Rows.Find(SelectedFileInfo.GetHashCode());
         row["CameraId"]   = camera.CameraID;
         row["CameraName"] = camera.CameraName;
     }
 }
Beispiel #2
0
        public ViewModel()
        {
            currentFileInfo = new FileInfo()
            {
                Source = "http://212.183.159.230/50MB.zip", FolderPath = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory)
            };

            downloadCommand     = new DelegateCommand(Download);
            selectFolderCommand = new DelegateCommand(SelectFolder);

            moveFileCommand   = new DelegateCommand(Move, () => SelectedFileInfo != null);
            renameFileCommand = new DelegateCommand(Rename, () => SelectedFileInfo != null && !String.IsNullOrEmpty(Name));
            deleteFileCommand = new DelegateCommand(DeleteFile, () => SelectedFileInfo != null);


            addTagCommand      = new DelegateCommand(AddTag, () => !String.IsNullOrEmpty(Tag));
            removeTagCommand   = new DelegateCommand(RemoveTag, () => !String.IsNullOrEmpty(Tag));
            searchByTagCommand = new DelegateCommand(SearchByTag);

            deleteDownloadCommand = new DelegateCommand(DeleteDownload, () => SelectedFileInfo != null);

            stopDownloadCommand = new DelegateCommand(Stop, () => SelectedFileInfo != null);

            PropertyChanged += (sender, args) =>
            {
                if (args.PropertyName == nameof(SelectedFileInfo))
                {
                    CurrentFileInfo = SelectedFileInfo.Clone();
                    renameFileCommand.RaiseCanExecuteChanged();
                    deleteFileCommand.RaiseCanExecuteChanged();
                    deleteDownloadCommand.RaiseCanExecuteChanged();
                    stopDownloadCommand.RaiseCanExecuteChanged();
                    moveFileCommand.RaiseCanExecuteChanged();
                }

                else if (args.PropertyName == nameof(Name))
                {
                    renameFileCommand.RaiseCanExecuteChanged();
                }
                else if (args.PropertyName == nameof(Tag))
                {
                    addTagCommand.RaiseCanExecuteChanged();
                    removeTagCommand.RaiseCanExecuteChanged();
                }
            };
        }
Beispiel #3
0
        async private Task <ErrorCodes> ImportFromZipFile(BankImportFormatClient selectedbankFormat, SelectedFileInfo fileInfo, PostingAPI postingapi, bool append, DateTime fromDate, DateTime toDate)
        {
            var        zipContent      = new MemoryStream(fileInfo.FileBytes);
            var        zipFile         = new ZipFile(zipContent);
            ErrorCodes importZipResult = ErrorCodes.NoSucces;

            foreach (ZipEntry zipEntry in zipFile)
            {
                if (!zipEntry.IsFile)
                {
                    continue;
                }

                var bufferSize = (int)zipEntry.Size;
                var buffer     = UnistreamReuse.Create(bufferSize);
                var stream     = zipFile.GetInputStream(zipEntry);
                buffer.CopyFrom(stream);

                var zipFileInfo = new FileInfo(zipEntry.Name);
                importZipResult = await postingapi.ImportJournalLines(selectedbankFormat, buffer, append, fromDate, toDate);

                buffer.Release();

                if (importZipResult != ErrorCodes.Succes)
                {
                    break;
                }
            }

            return(importZipResult);
        }
        private void ok_button_Click(object sender, RoutedEventArgs e)
        {
            SelectedFileInfo files = new SelectedFileInfo();

            if (fileRename_text.Text == "")
            {
                MessageBox.Show("Enter a valid File Path");
            }
            else
            {
                files.FileInfo = fileRename_text.Text;
                files.FileName = System.IO.Path.GetFileName(fileRename_text.Text);
                files.FilePath = System.IO.Path.GetDirectoryName(fileRename_text.Text);

                files.FileExtention            = System.IO.Path.GetExtension(fileRename_text.Text);
                files.FileNameWithoutExtension = System.IO.Path.GetFileNameWithoutExtension(fileRename_text.Text);
            }


            RenameFileData.FilesToRename = files;

            RenameFileData.IsActive     = (bool)this_checkbox.IsChecked;
            RenameFileData.IfFileExists = Convert.ToBoolean(ifExists_dropdown.SelectedIndex);
            RenameFileData.Var_StoreRenamedFilesInto = store_text.Text;
            RenameFileData.RenameScheme = renameSchema_dropdown.Text.ToString();
            RenameFileData.NewFileName  = newFileName_text.Text;

            RenameFileData.After_Or_Before_Date   = addDateTime_dropdown.Text.ToString();
            RenameFileData.Date_time_to_Add       = dateTimeAdd_dropdown.Text.ToString();
            RenameFileData.Ater_Or_Before_AddText = addText_dropdown.Text.ToString();

            RenameFileData.Separator_datetime  = separator_dropdown.Text.ToString();
            RenameFileData.New_Extension       = newExtension_text.Text.ToString();
            RenameFileData.KeepExtension       = (bool)keepExtensionCheck.IsChecked;
            RenameFileData.Text_to_Add         = add_text.Text.ToString();
            RenameFileData.Text_to_Remove      = remove_text.Text;
            RenameFileData.Text_to_Replace     = replace_text.Text.ToString();
            RenameFileData.Text_to_ReplaceWith = replaceWith_text.Text.ToString();
            RenameFileData.Date_Time_Format    = format_dropdown.Text.ToString();
            RenameFileData.Custom_Date         = custom_text.Text.ToString();

            //Make Sequential
            RenameFileData.NewFileName_or_Existing_Sequentioal = Add_dropdown.Text.ToString();
            RenameFileData.NewFileNameSequential = newName_text.Text.ToString();
            RenameFileData.Separator_sequential  = serator_dropdown.Text.ToString();
            // if(start_text.Text.ToString()!="")
            {
                RenameFileData.After_or_before_sequential = ddDateTime_dropdown.Text.ToString();
            }
            if (start_text.Text.ToString() != "")
            {
                RenameFileData.Start_numbering_at = Convert.ToInt32((start_text.Text.ToString()));
            }
            if (ample_text.Text.ToString() != "")
            {
                RenameFileData.Increment_by = Convert.ToInt32(ample_text.Text.ToString());
            }
            //MessageBox.Show(sequnce_length.SelectedItem.ToString());
            if (sequnce_length.Text.ToString() == "")
            {
                RenameFileData.Lenght_of_digit = 1;
            }
            else
            {
                RenameFileData.Lenght_of_digit = Convert.ToInt32(sequnce_length.Text.ToString());
            }


            ////FileInfo f = new FileInfo("c:\test.txt");
            ////f.("test2.txt");
            //string newFileName = "Foo.txt";

            //// full pattern
            ////System.IO.FileInfo fileInfo = new System.IO.FileInfo(files.FileName);
            ////fileInfo.re(newFileName);

            //// or short form
            //new System.IO.FileInfo(fileRename_text.Text).Rename(newFileName);

            if (fileRename_text.Text != "")
            {
                ((((this.Parent as StackPanel).Parent as Grid).Parent as TaskViewFrameUC).Parent as MetroWindow).DialogResult = false;
            }
        }