Esempio n. 1
0
        private void DataGridView1_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            if (dataGridView1.Rows.Count <= 0)
            {
                return;
            }
            int ind = dataGridView1.Rows.IndexOf(dataGridView1.SelectedRows[0]);

            if (ind >= 0)
            {
                ToggleButtons(DownloaderList[ind]);

                if (DownloaderList[ind].DownloadStatus == Downloader.Status.Downloading)
                {
                    CurrentDownloadWindow cdw = new CurrentDownloadWindow();
                    cdw.Downloader = DownloaderList[ind];
                    cdw.UpdateProgress(DownloaderList[ind].File);
                    cdw.ShowDialog();
                }
                else
                {
                    FilePropertiesWindow fpw = new FilePropertiesWindow();
                    fpw.Downloader = DownloaderList[ind];
                    fpw.ShowDialog();
                }
            }
        }
Esempio n. 2
0
        private void propertiesCmd()
        {
            int headerOffset         = (int)fsctrl.getFileHeaderOffset(selection.FileHeader.NamePlusExtensionWithoutZeros, fsctrl.CurrDirCluster, false);
            FilePropertiesWindow fpw = new FilePropertiesWindow(selection.FileHeader);

            if (fpw.ShowDialog().Value)
            {
                fsctrl.writeBytes(headerOffset, selection.FileHeader.toByteArray());
                selection.refresh();
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Show file property.
        /// </summary>
        public void ShowProperties(string fileDisplayedName, string fileLocation, MediaType mediaType, string duration, string resolution)
        {
            if (!File.Exists(fileLocation))
            {
                MyMessageBox.Show("文件不存在 !", MessageBoxButton.OK, MessageBoxImage.Warning);
                return;
            }

            FilePropertiesWindow fpw = new FilePropertiesWindow();

            fpw.FileDisplayedName = fileDisplayedName;
            fpw.FileLocation      = fileLocation;
            fpw.MediaType         = mediaType;
            fpw.Duration          = duration;
            fpw.Resolution        = resolution;
            fpw.ShowDialog();
        }
Esempio n. 4
0
        private void createCmd(bool isDirectory)
        {
            FileHeader fh = new FileHeader(Session.userInfo);

            fh.IsDirectory = isDirectory;
            if (isDirectory)
            {
                fh.Name      = "newdir";
                fh.Extension = "";
            }

            FilePropertiesWindow fpw = new FilePropertiesWindow(fh);

            if (fpw.ShowDialog().Value)
            {
                try
                {
                    fsctrl.writeFile(fsctrl.CurrDir, fh, null, true);
                    FileView fv = addFileView(fh);
                    onFileViewMouseDown(fv, null);
                }
                catch (Exception e)
                {
                    MessageBox.Show(e.Message, "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
                    if (e is RootdirOutOfSpaceException || e is DiskOutOfSpaceException)
                    {
                        try
                        {
                            fsctrl.deleteFile(fsctrl.CurrDir, fh, false);
                        }
                        catch
                        {
                            //ignore
                        }
                    }
                }
            }
        }
Esempio n. 5
0
        protected BaseL3dFileViewModel(LoksimFile openFile, Window parentWindow)
        {
            CurrentFile  = openFile;
            ParentWindow = parentWindow;

            _fileSaveCmd = new RelayCommand(obj =>
            {
                SaveOrSaveAs(false);
            },
                                            obj =>
            {
                return(CurrentFile != null && !L3dFilePath.IsNullOrEmpty(CurrentFile.OwnPath));
            }
                                            );


            _fileSaveAsCmd = new RelayCommand(obj =>
            {
                SaveOrSaveAs(true);
            },
                                              obj =>
            {
                return(CurrentFile != null);
            }
                                              );

            FilePropertiesCmd = new RelayCommand(obj =>
            {
                Window dlg = new FilePropertiesWindow(CurrentFile);
                dlg.Owner  = ParentWindow;
                dlg.ShowDialog();
            },
                                                 obj =>
            {
                return(CurrentFile != null);
            }
                                                 );

            UndoCmd = new RelayCommand(obj =>
            {
                UndoAwareFile f = CurrentFile as UndoAwareFile;
                if (f != null)
                {
                    f.Undo();
                }
            },
                                       obj =>
            {
                UndoAwareFile f = CurrentFile as UndoAwareFile;
                return(f != null && f.UndoPossible);
            }
                                       );

            RedoCmd = new RelayCommand(obj =>
            {
                UndoAwareFile f = CurrentFile as UndoAwareFile;
                if (f != null)
                {
                    f.Redo();
                }
            },
                                       obj =>
            {
                UndoAwareFile f = CurrentFile as UndoAwareFile;
                return(f != null && f.RedoPossible);
            }
                                       );
        }