コード例 #1
0
        private void deleteFolderMsgBox_Result(object sender, DialogEventArgs e)
        {
            if (e.Result != DialogResult.OK)
            {
                return;
            }

            //Delete Selected folder...
            Host.Cursor = Cursors.WaitCursor;
            //Delete Folder
            if (Form1.Instance.DropBox.Delete(_selectedItem))
            {
                //Now load the parent Directory
                _selectedItem                = _selectedItem.Parent;
                lsbDropbox.Items             = ListHelpers.MakeDirList(Form1.Instance.DropBox.GetItems(_selectedItem));
                lsbDropbox.SelectedItemIndex = -1;
                header.Title = _selectedItem.Name;
                Host.Cursor  = Cursors.Default;
            }
            else
            {
                Host.Cursor = Cursors.Default;
                MessageDialog.Show("Failed to Delete!", null, "OK");
            }
        }
コード例 #2
0
        private void copyMsgBox_Result(object sender, DialogEventArgs e)
        {
            //If a File is selected select the folder its in
            if (!_selectedItem.Is_Dir)
            {
                _selectedItem = _selectedItem.Parent;
            }

            Host.Cursor = Cursors.WaitCursor;

            if (e.Result == DialogResult.OK)
            {
                //copy
                if (!Form1.Instance.DropBox.CopyFile(_clipboard, _selectedItem))
                {
                    Host.Cursor = Cursors.Default;
                    MessageDialog.Show("Failed to Copy!", null, "OK");
                }
            }
            else if (e.Result == DialogResult.Cancel)
            {
                //move
                if (!Form1.Instance.DropBox.MoveFile(_clipboard, _selectedItem))
                {
                    Host.Cursor = Cursors.Default;
                    MessageDialog.Show("Failed to Move!", null, "OK");
                }
            }

            lsbDropbox.Items = ListHelpers.MakeDirList(Form1.Instance.DropBox.GetItems(_selectedItem));
            Host.Cursor      = Cursors.Default;
            _clipboard       = null;
        }
コード例 #3
0
        private void newFolder_submit(object sender, DialogEventArgs e)
        {
            if (e.Result != DialogResult.OK)
            {
                return;
            }

            //If a File is selected select the folder its in
            if (!_selectedItem.Is_Dir)
            {
                _selectedItem = _selectedItem.Parent;
            }

            var folderName = textInputPanel.Data;

            Host.Cursor = Cursors.WaitCursor;
            var newSelected = Form1.Instance.DropBox.CreateFolder(_selectedItem, folderName);

            if (newSelected != null)
            {
                newSelected.Parent = _selectedItem;
                _selectedItem.Contents.Add(newSelected);
                _selectedItem                = newSelected;
                lsbDropbox.Items             = ListHelpers.MakeDirList(_selectedItem);
                lsbDropbox.SelectedItemIndex = -1;
                header.Title = _selectedItem.Name;
                Host.Cursor  = Cursors.Default;
            }
            else
            {
                //show error...?
                Host.Cursor = Cursors.Default;
                MessageDialog.Show("Create Folder Failed!", null, "OK");
            }
        }
コード例 #4
0
        void BackButton_Click(object sender, EventArgs e)
        {
            //if a file is selected deselect it and reselect the folder
            if (!_selectedItem.Is_Dir)
            {
                _selectedItem = _selectedItem.Parent;
            }

            //Check if they are at root
            if (_selectedItem.Parent == null)
            {
                if (fileButtonPanel != null)
                {
                    fileButtonPanel.Close();
                }
                Form1.Instance.OpenFoldersPanel();
                Close(ShowTransition.FromBottom);
            }
            else
            {
                //Goes Up a dir...
                Host.Cursor = Cursors.WaitCursor;
                if (fileButtonPanel != null)
                {
                    fileButtonPanel.Close(ShowTransition.FromBottom); //hide file buttons
                }
                _selectedItem = _selectedItem.Parent;
                // Cached...?
                if (_selectedItem.Parent == null)
                {
                    //At the root
                    header.BackButton.Text = "Back";
                }
                else
                {
                    header.BackButton.Text = "Up";
                }
                //lsbFolders.Items = MakeDirList(Form1.Instance.DropBox.GetItems(_selectedItem));
                lsbDropbox.Items             = ListHelpers.MakeDirList(_selectedItem);
                lsbDropbox.SelectedItemIndex = -1;
                header.Title = string.IsNullOrEmpty(_selectedItem.Name) ? "/" : _selectedItem.Name;
                Host.Cursor  = Cursors.Default;
            }
        }
コード例 #5
0
 private void deleteMsgBox_Result(object sender, Fluid.Classes.DialogEventArgs e)
 {
     if (e.Result == DialogResult.OK)
     {
         Host.Cursor = Cursors.WaitCursor;
         //Delete File
         if (Form1.Instance.DropBox.Delete(_selectedItem))
         {
             //Reload current folder...?
             fileButtonPanel.Hide();
             lsbDropbox.Items = ListHelpers.MakeDirList(Form1.Instance.DropBox.GetItems(_selectedItem.Parent));
             Host.Cursor      = Cursors.Default;
         }
         else
         {
             Host.Cursor = Cursors.Default;
             MessageDialog.Show("Failed to Delete!", null, "OK");
         }
     }
 }
コード例 #6
0
 private void lsbUpload_SelectedFile(object sender, EventArgs e)
 {
     Host.Cursor = Cursors.WaitCursor;
     //If a File is selected select the folder its in
     if (!_selectedItem.Is_Dir)
     {
         _selectedItem = _selectedItem.Parent;
     }
     if (Form1.Instance.DropBox.UploadFile(lsbUpload.SelectedItem, _selectedItem))
     {
         //Reload current folder...?
         lsbDropbox.Items = ListHelpers.MakeDirList(Form1.Instance.DropBox.GetItems(_selectedItem));
         Host.Cursor      = Cursors.Default;
     }
     else
     {
         Host.Cursor = Cursors.Default;
         MessageDialog.Show("Failed to Upload File!", null, "OK");
     }
 }
コード例 #7
0
        void lsbDropbox_ItemClick(object sender, ListBoxItemEventArgs e)
        {
            //if a file is selected deselect it and reselect the folder
            if (!_selectedItem.Is_Dir)
            {
                _selectedItem = _selectedItem.Parent;
            }

            var selected = e.Item as MetaData;

            if (selected.Is_Dir)
            {
                Host.Cursor = Cursors.WaitCursor;
                //hide file buttons
                fileButtonPanel.Hide();
                //Get the selected folders contents
                var newSelected = Form1.Instance.DropBox.GetItems(selected);
                if (newSelected == null)
                {
                    Host.Cursor = Cursors.Default;
                    MessageDialog.Show("Failed to Get Dropbox Folder" + Environment.NewLine + "Check Data Connection.", null, "OK");
                }
                else
                {
                    header.BackButton.Text       = "Up";
                    newSelected.Parent           = _selectedItem;
                    _selectedItem                = newSelected;
                    lsbDropbox.Items             = ListHelpers.MakeDirList(_selectedItem);
                    lsbDropbox.SelectedItemIndex = -1;
                    header.Title = _selectedItem.Name;
                    Host.Cursor  = Cursors.Default;
                }
            }
            else
            {
                selected.Parent = _selectedItem;
                _selectedItem   = selected;

                fileButtonPanel.Show(ShowTransition.FromBottom);
            }
        }
コード例 #8
0
        protected override void InitControl()
        {
            base.InitControl();
            Bounds    = new Rectangle(0, 0, 240, 300);
            BackColor = Color.Green;
            Anchor    = AnchorAll;
            const int h = 32;

            header.Bounds                  = new Rectangle(0, 0, 240, h);
            lsbDropbox.Bounds              = new Rectangle(0, h, 240, 254 - h);
            header.Anchor                  = AnchorTLR;
            lsbDropbox.Anchor              = AnchorAll;
            header.Title                   = "/";
            header.BackColor               = Theme.Current.HeaderBackColor;
            header.ForeColor               = Theme.Current.HeaderForeColor;
            header.GradientFill            = Theme.Current.HeaderGradianted;
            header.BackButton.Click       += new EventHandler(BackButton_Click);
            header.BackButton.BackColor    = Theme.Current.HeaderBackButtonBackColor;
            header.BackButton.Visible      = true;
            header.BackButton.Text         = "Back";
            header.BackButton.GradientFill = Theme.Current.ButtonsGradianted;

            //Maybe make this an upload button...?
            FluidButton btnUpload = new FluidButton("Upload");

            btnUpload.Click       += new EventHandler(btnUpload_Click);
            btnUpload.BackColor    = Theme.Current.HeaderSecondaryButtonBackColor;
            btnUpload.GradientFill = Theme.Current.ButtonsGradianted;
            header.Buttons.Add(btnUpload);

            Controls.Add(header);

            lsbDropbox.ItemClick    += new EventHandler <ListBoxItemEventArgs>(lsbDropbox_ItemClick);
            lsbDropbox.NavigateBack += new EventHandler(BackButton_Click);

            Controls.Add(lsbDropbox);

            //Options Panel
            buttonPanel          = new DropOptionButtonPanel();
            buttonPanel.Bounds   = new Rectangle(0, this.Height - 54, Width, 54);
            buttonPanel.Anchor   = AnchorStyles.None;
            buttonPanel.Command += new EventHandler <CommandEventArgs>(buttonPanel_Command);
            Controls.Add(buttonPanel);

            //File Options Panel
            fileButtonPanel          = new FileOptionButtonPanel();
            fileButtonPanel.Bounds   = new Rectangle(0, this.Height - 54, Width, 54);
            fileButtonPanel.Anchor   = AnchorStyles.None;
            fileButtonPanel.Command += new EventHandler <CommandEventArgs>(fileButtonPanel_Command);
            fileButtonPanel.Hide();
            Controls.Add(fileButtonPanel);

            _rootItem = Form1.Instance.DropBox.GetItems();
            if (_rootItem == null)
            {
                //Failed
                Form1.Instance.OpenFoldersPanel();
                Close(ShowTransition.FromBottom);

                MessageDialog.Show("Failed to Get Dropbox Folder", null, "OK");
            }
            else
            {
                _selectedItem = _rootItem;

                lsbDropbox.Items = ListHelpers.MakeDirList(_rootItem);
            }
        }