Beispiel #1
0
        private void LoadWithSampleButton_Click(object sender, EventArgs e)
        {
            if (InfiniumFileList.Selected == -1)
            {
                return;
            }

            if (InfiniumFiles.CheckInheritedPermission(Security.CurrentUserID, InfiniumFileList.Entered) == false)
            {
                InfiniumTips.ShowTip(this, 50, 85, "Недостаточно прав", 3600);
                return;
            }

            if (InfiniumFileList.CheckVisible)
            {
                InfiniumFileList.CheckVisible = false;
                CheckMultipleButton.BringToFront();
            }

            UploadFileDialog.Multiselect = false;

            if (UploadFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                if (InfiniumFiles.CheckFileExist(UploadFileDialog.FileNames, InfiniumFileList.Entered) == true)//file exist
                {
                    InfiniumTips.ShowTip(this, 50, 85, "Один или несколько файлов уже существуют в папке", 2600);
                    return;
                }

                PhantomForm PhantomForm = new PhantomForm();
                PhantomForm.Show();


                //set attributes
                DocumentAttributesForm DocumentAttributesForm = new DocumentAttributesForm(ref InfiniumFiles, ref TopForm);

                TopForm = DocumentAttributesForm;

                DocumentAttributesForm.ShowDialog();

                bool bFirstSign = DocumentAttributesForm.bFirstSign;

                if (DocumentAttributesForm.bCanceled)
                {
                    PhantomForm.Close();
                    PhantomForm.Dispose();

                    TopForm = null;
                    return;
                }

                //upload
                UploadFileForm UploadFileForm = new UploadFileForm(ref InfiniumFiles.FM, ref InfiniumFiles, UploadFileDialog.FileNames, InfiniumFileList.Entered,
                                                                   ref TopForm);

                TopForm = UploadFileForm;

                UploadFileForm.ShowDialog();

                PhantomForm.Close();
                PhantomForm.Dispose();

                TopForm = null;
                UploadFileDialog.Dispose();

                InfiniumFiles.SetAttributes(Path.GetFileName(UploadFileDialog.FileNames[0]), InfiniumFileList.Entered, bFirstSign);

                Thread T = new Thread(delegate()
                {
                    SplashWindow.CreateCoverSplash(InfiniumFileList.Top + UpdatePanel.Top, InfiniumFileList.Left + UpdatePanel.Left,
                                                   InfiniumFileList.Height, InfiniumFileList.Width);
                });
                T.Start();

                while (!SplashWindow.bSmallCreated)
                {
                    ;
                }


                InfiniumFiles.EnterFolder(InfiniumFileList.Entered);

                InfiniumFileList.ItemsDataTable = InfiniumFiles.CurrentItemsDataTable;

                bC = true;
            }
        }
Beispiel #2
0
 private void UncheckMultipleButton_Click(object sender, EventArgs e)
 {
     CheckMultipleButton.BringToFront();
     InfiniumFileList.CheckVisible = false;
 }
Beispiel #3
0
        private void MenuFileSaveFile_Click(object sender, EventArgs e)
        {
            if (InfiniumFileList.CheckVisible == false)
            {
                SaveFileDialog.Filter = "(*" + Path.GetExtension(InfiniumFileList.FileItems[InfiniumFileList.Selected].Caption) + ")|*" +
                                        Path.GetExtension(InfiniumFileList.FileItems[InfiniumFileList.Selected].Caption);
                SaveFileDialog.FileName = InfiniumFileList.FileItems[InfiniumFileList.Selected].Caption;

                if (SaveFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    PhantomForm PhantomForm = new PhantomForm();
                    PhantomForm.Show();

                    UploadFileForm UploadFileForm = new UploadFileForm(ref InfiniumFiles.FM, ref InfiniumFiles,
                                                                       InfiniumFileList.FileItems[InfiniumFileList.Selected].Caption,
                                                                       InfiniumFileList.FileItems[InfiniumFileList.Selected].FolderID,
                                                                       InfiniumFileList.FileItems[InfiniumFileList.Selected].FileID,
                                                                       true, SaveFileDialog.FileName, ref TopForm);

                    TopForm = UploadFileForm;

                    UploadFileForm.ShowDialog();

                    if (UploadFileForm.bOk == 0)
                    {
                        InfiniumTips.ShowTip(this, 50, 85, "Отсутствует файл либо нет доступа к интернет", 5000);
                    }

                    PhantomForm.Close();
                    PhantomForm.Dispose();

                    TopForm = null;
                    UploadFileDialog.Dispose();
                }
            }
            else
            {
                int r = InfiniumFiles.CheckCheckedItems(InfiniumFileList.ItemsDataTable);

                if (r == -2)
                {
                    bool OK = LightMessageBox.Show(ref TopForm, true,
                                                   "Копирование папок не поддерживается, скопируются только выбранные файлы. Продолжить?", "Копирование файла");

                    if (!OK)
                    {
                        return;
                    }
                }

                if (r == -1)
                {
                    LightMessageBox.Show(ref TopForm, false,
                                         "Копирование папок не поддерживается.", "Копирование файла");

                    return;
                }

                if (r == 0)
                {
                    InfiniumTips.ShowTip(this, 50, 85, "Выберите один или несколько файлов", 5600);

                    return;
                }



                if (FolderBrowserDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    if (InfiniumFiles.CheckFilesExists(InfiniumFileList.ItemsDataTable, FolderBrowserDialog.SelectedPath))
                    {
                        bool OK = LightMessageBox.Show(ref TopForm, true,
                                                       "Файл с таким именем в указанной папке уже существует. Заменить?", "Копирование файла");

                        if (!OK)
                        {
                            return;
                        }
                    }

                    PhantomForm PhantomForm = new PhantomForm();
                    PhantomForm.Show();

                    UploadFileForm UploadFileForm = new UploadFileForm(ref InfiniumFiles.FM, ref InfiniumFiles, FolderBrowserDialog.SelectedPath,
                                                                       InfiniumFileList.ItemsDataTable, ref TopForm);

                    TopForm = UploadFileForm;

                    UploadFileForm.ShowDialog();

                    PhantomForm.Close();
                    PhantomForm.Dispose();

                    TopForm = null;
                    UploadFileDialog.Dispose();


                    if (InfiniumFileList.CheckVisible)
                    {
                        InfiniumFileList.CheckVisible = false;
                        CheckMultipleButton.BringToFront();
                    }
                }
            }
        }
Beispiel #4
0
        private void UploadFileIButton_Click(object sender, EventArgs e)
        {
            if (InfiniumFileList.Selected == -1)
            {
                return;
            }

            if (InfiniumFiles.CheckInheritedPermission(Security.CurrentUserID, InfiniumFileList.Entered) == false)
            {
                InfiniumTips.ShowTip(this, 50, 85, "Недостаточно прав", 3600);
                return;
            }

            if (InfiniumFileList.CheckVisible)
            {
                InfiniumFileList.CheckVisible = false;
                CheckMultipleButton.BringToFront();
            }

            UploadFileDialog.Multiselect = true;

            if (UploadFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                if (InfiniumFiles.CheckFileExist(UploadFileDialog.FileNames, InfiniumFileList.Entered) == true)//file exist
                {
                    InfiniumTips.ShowTip(this, 50, 85, "Один или несколько файлов уже существуют в папке", 2600);
                    return;
                }

                PhantomForm PhantomForm = new PhantomForm();
                PhantomForm.Show();

                UploadFileForm UploadFileForm = new UploadFileForm(ref InfiniumFiles.FM, ref InfiniumFiles, UploadFileDialog.FileNames, InfiniumFileList.Entered,
                                                                   ref TopForm);

                TopForm = UploadFileForm;

                UploadFileForm.ShowDialog();

                if (UploadFileForm.bOk == 0)
                {
                    InfiniumTips.ShowTip(this, 50, 85, "Отсутствует файл либо нет доступа к интернет", 5000);
                }

                PhantomForm.Close();
                PhantomForm.Dispose();

                TopForm = null;
                UploadFileDialog.Dispose();


                Thread T = new Thread(delegate()
                {
                    SplashWindow.CreateCoverSplash(InfiniumFileList.Top + UpdatePanel.Top, InfiniumFileList.Left + UpdatePanel.Left,
                                                   InfiniumFileList.Height, InfiniumFileList.Width);
                });
                T.Start();

                while (!SplashWindow.bSmallCreated)
                {
                    ;
                }


                InfiniumFiles.EnterFolder(InfiniumFileList.Entered);

                InfiniumFileList.ItemsDataTable = InfiniumFiles.CurrentItemsDataTable;

                bC = true;
            }
        }
Beispiel #5
0
        private void RemoveButton_Click(object sender, EventArgs e)
        {
            if (InfiniumFileList.Selected == -1)
            {
                return;
            }

            if (InfiniumFileList.FileItems[InfiniumFileList.Selected].Caption == "[...]")
            {
                return;
            }

            if (InfiniumFiles.CurrentItemsDataTable.Select("FolderID = " +
                                                           InfiniumFileList.FileItems[InfiniumFileList.Selected].FolderID)[0]["Extension"].ToString() == "folder")
            {
                if (InfiniumFiles.CheckFolderPermission(Security.CurrentUserID, InfiniumFileList.FileItems[InfiniumFileList.Selected].FolderID) == false)
                {
                    InfiniumTips.ShowTip(this, 50, 85, "Недостаточно прав", 3600);
                    return;
                }
            }
            else
            {
                if (InfiniumFiles.CanEditFile(Security.CurrentUserID, InfiniumFileList.FileItems[InfiniumFileList.Selected].FileID) == false)
                {
                    InfiniumTips.ShowTip(this, 50, 85, "Недостаточно прав", 3600);
                    return;
                }
            }



            if (InfiniumFileList.CheckVisible)
            {
                int r = InfiniumFiles.CheckCheckedItems(InfiniumFileList.ItemsDataTable);

                if (r == 0)
                {
                    InfiniumTips.ShowTip(this, 50, 85, "Выберите один или несколько файлов", 5600);

                    return;
                }

                bool OK = LightMessageBox.Show(ref TopForm, true,
                                               "Удалить выбранные файлы\\папки?", "Удаление");

                if (!OK)
                {
                    return;
                }

                InfiniumFiles.RemoveFolder(InfiniumFileList.ItemsDataTable);
                InfiniumFiles.RemoveFile(InfiniumFileList.ItemsDataTable);
            }
            else
            {
                if (InfiniumFileList.Selected > -1)
                {
                    bool OK = LightMessageBox.Show(ref TopForm, true,
                                                   "Удалить?", "Удаление");

                    if (!OK)
                    {
                        return;
                    }

                    if (InfiniumFiles.CurrentItemsDataTable.Select("FolderID = " +
                                                                   InfiniumFileList.FileItems[InfiniumFileList.Selected].FolderID)[0]["Extension"].ToString() == "folder")
                    {
                        if (InfiniumFiles.RemoveFolder(InfiniumFileList.FileItems[InfiniumFileList.Selected].FolderID) == false)
                        {
                            InfiniumTips.ShowTip(this, 50, 85, "Ошибка удаления папки с хостинга", 4000);
                        }
                    }
                    else
                    {
                        InfiniumFiles.RemoveFile(InfiniumFileList.FileItems[InfiniumFileList.Selected].FileID,
                                                 InfiniumFileList.FileItems[InfiniumFileList.Selected].FolderID,
                                                 InfiniumFileList.FileItems[InfiniumFileList.Selected].Caption);
                    }
                }
            }


            Thread T = new Thread(delegate()
            {
                SplashWindow.CreateCoverSplash(InfiniumFileList.Top + UpdatePanel.Top, InfiniumFileList.Left + UpdatePanel.Left,
                                               InfiniumFileList.Height, InfiniumFileList.Width);
            });

            T.Start();

            while (!SplashWindow.bSmallCreated)
            {
                ;
            }


            InfiniumFiles.EnterFolder(InfiniumFileList.Entered);

            InfiniumFileList.ItemsDataTable = InfiniumFiles.CurrentItemsDataTable;
            InfiniumFileList.EnterInFolder(InfiniumFileList.Entered);


            if (InfiniumFileList.CheckVisible)
            {
                InfiniumFileList.CheckVisible = false;
                CheckMultipleButton.BringToFront();
            }

            bC = true;
        }
Beispiel #6
0
        private void AddFolderButton_Click(object sender, EventArgs e)
        {
            if (InfiniumFileList.Entered > -1)
            {
                if (InfiniumFileList.CheckVisible)
                {
                    InfiniumFileList.CheckVisible = false;
                    CheckMultipleButton.BringToFront();
                }

                if (InfiniumFiles.CheckInheritedPermission(Security.CurrentUserID, InfiniumFileList.Entered) == false)
                {
                    InfiniumTips.ShowTip(this, 50, 85, "Недостаточно прав", 3600);
                    return;
                }

                PhantomForm PhantomForm = new PhantomForm();
                PhantomForm.Show();

                CreateFolderForm CreateFolderForm = new CreateFolderForm(ref InfiniumFiles, ref TopForm);

                TopForm = CreateFolderForm;

                CreateFolderForm.ShowDialog();

                PhantomForm.Close();
                PhantomForm.Dispose();

                TopForm = null;

                if (CreateFolderForm.Canceled)
                {
                    return;
                }


                Thread T = new Thread(delegate()
                {
                    SplashWindow.CreateCoverSplash(InfiniumFileList.Top + UpdatePanel.Top, InfiniumFileList.Left + UpdatePanel.Left,
                                                   InfiniumFileList.Height, InfiniumFileList.Width);
                });
                T.Start();

                while (!SplashWindow.bSmallCreated)
                {
                    ;
                }


                InfiniumFiles.CreateFolder(InfiniumFileList.Entered, CreateFolderForm.FolderName);

                InfiniumFiles.EnterFolder(InfiniumFileList.Entered);

                InfiniumFileList.ItemsDataTable = InfiniumFiles.CurrentItemsDataTable;
                InfiniumFileList.EnterInFolder(InfiniumFileList.Entered);

                CreateFolderForm.Dispose();

                bC = true;
            }
        }