virtual protected void InvokeOnSaved(object sender, FileActionEventArgs e)
 {
     if (OnSaved != null)
     {
         OnSaved(sender, e);
     }
 }
Exemple #2
0
        private void NotificationCenter_FileSelected(object sender, FileActionEventArgs e)
        {
            if (sender == this)
            {
                return;
            }

            if (activeTab == ActiveFileBrowserTab.Cameras)
            {
                return;
            }

            // Find the file and select it here.
            ListView lv = GetFileListview();

            lv.SelectedItems.Clear();

            if (string.IsNullOrEmpty(e.File))
            {
                return;
            }

            foreach (ListViewItem item in lv.Items)
            {
                if ((string)item.Tag != e.File)
                {
                    continue;
                }

                externalSelection = true;
                item.Selected     = true;
                item.EnsureVisible();
                break;
            }
        }
Exemple #3
0
        public static void InvokeFileActionEvent(FileActionEventArgs e)
        {
            var handler = FileActionEvent;

            if (handler != null)
            {
                handler(null, e);
            }
        }
 public override void SaveFile()
 {
     string directory = m_file.FilePath.SubstringBeforeLast('\\');
     if (!Directory.Exists(directory))
         Directory.CreateDirectory(directory);
     var fs = new FileStream(m_file.FilePath, FileMode.Create);
     m_editor.Save(fs);
     var e = new FileActionEventArgs(FileActionType.Save, m_file);
     InvokeOnSaved(this, e);
     HasChanges = false;
 }
Exemple #5
0
        public override void SaveFile()
        {
            string directory = m_file.FilePath.SubstringBeforeLast('\\');

            if (!Directory.Exists(directory))
            {
                Directory.CreateDirectory(directory);
            }
            var fs = new FileStream(m_file.FilePath, FileMode.Create);

            m_editor.Save(fs);
            var e = new FileActionEventArgs(FileActionType.Save, m_file);

            InvokeOnSaved(this, e);
            HasChanges = false;
        }
Exemple #6
0
        private void NotificationCenter_FileOpened(object sender, FileActionEventArgs e)
        {
            // Create a virtual shortcut for the current video directory.

            lastOpenedDirectory = Path.GetDirectoryName(e.File);

            if (activeTab == ActiveFileBrowserTab.Shortcuts && currentShortcutItem != null && currentShortcutItem.Path == lastOpenedDirectory)
            {
                return;
            }

            if (e.File.StartsWith("."))
            {
                return;
            }

            ReloadShortcuts();
            etShortcuts.SelectNode(lastOpenedDirectory);
        }
        public override void SaveFile()
        {
            if (m_rbf.FileExtension == "rbf")
            {
                SaveFileRBF(m_rbf.FilePath);
            }
            else if (m_rbf.FileExtension == "attr_pc")
            {
                SaveFileBAF(m_rbf.FilePath);
            }
            else
            {
                return;
            }

            var e = new FileActionEventArgs(FileActionType.Save, m_rbf);

            InvokeOnSaved(this, e);
            HasChanges = false;
        }
Exemple #8
0
        private void NotificationCenter_FileSelected(object sender, FileActionEventArgs e)
        {
            if (sender == this)
            {
                return;
            }

            if (string.IsNullOrEmpty(e.File))
            {
                Deselect(false);
                return;
            }

            foreach (ThumbnailFile tlvi in thumbnails)
            {
                if (tlvi.FileName == e.File)
                {
                    externalSelection = true;
                    tlvi.SetSelected();
                    break;
                }
            }
        }
Exemple #9
0
 static void FileAction(object sender, FileActionEventArgs e)
 {
     Console.WriteLine("{1}: '{0}'", e.File, e.Action);
 }
Exemple #10
0
 virtual protected void InvokeOnSaved(object sender, FileActionEventArgs e)
 {
     if (OnSaved != null)
         OnSaved(sender, e);
 }
Exemple #11
0
 private void Project_Loaded(object sender, FileActionEventArgs e)
 {
     SyncProjectSettings();
 }
Exemple #12
0
 public static void InvokeFileActionEvent(FileActionEventArgs e)
 {
     var handler = FileActionEvent;
     if (handler != null)
         handler(null, e);
 }
Exemple #13
0
        public void Copy(object oParametersList)
        {
            FileActionEventArgs e = new FileActionEventArgs();

            e.ActionType = FileActionsType.faCopy;
            e.Message    = "Copy starts!";
            e.ActionData = null;

            int  numReads       = 0;
            long totalBytesRead = 0;

            Byte[] bCopyBuffer = new Byte[iCopyBufferLenght];

            string[] lParams = new string[2];
            lParams = (string[])oParametersList;

            FileStream fsSourceStream = new FileStream(lParams[0], FileMode.Open, FileAccess.Read);
            FileStream fsDestStream   = new FileStream(lParams[1], FileMode.Create, FileAccess.Write);

            long sLenght = fsSourceStream.Length;

            try
            {
                while (true)
                {
                    int bytesRead = 0;
                    numReads++;
                    bytesRead = fsSourceStream.Read(bCopyBuffer, 0, iCopyBufferLenght);

                    if (bytesRead == 0)
                    {
                        SendInfo(sLenght, sLenght);
                        break;
                    }


                    fsDestStream.Write(bCopyBuffer, 0, bytesRead);
                    totalBytesRead += bytesRead;


                    if (numReads % 10 == 0)
                    {
                        int iprocNext = SendInfo(totalBytesRead, sLenght);
                    }


                    if (bytesRead < iCopyBufferLenght)
                    {
                        int iprocNext = SendInfo(totalBytesRead, sLenght);
                        break;
                    }
                }

                fsSourceStream.Close();
                fsDestStream.Close();

                if (OnCopyComplete != null)
                {
                    OnCopyComplete(this, new FileActionEventArgs("Copy complete", FileActionsType.faCopy, null));
                }
            }
            catch
            {
                if (OnCopyComplete != null)
                {
                    OnCopyComplete(this, new FileActionEventArgs("Copy complete", FileActionsType.faCopy, null));
                }
            }
        }