Beispiel #1
0
        public async Task <string> RenameAsync(string currentName)
        {
            if (IsDialogOpen)
            {
                return(currentName);
            }

            IsDialogOpen = true;
            var inputBoxControl = new RenameInputBox()
            {
                Input = currentName
            };
            bool enterClicked = false;
            var  dialog       = new ContentDialog()
            {
                Title             = Strings.Resources.RenameText,
                CloseButtonText   = Strings.Resources.CancelText,
                PrimaryButtonText = Strings.Resources.RenameText,
                Content           = inputBoxControl
            };

            inputBoxControl.EnterClicked += (s, e) => { dialog.Hide(); enterClicked = true; };

            var result = await dialog.ShowAsync();

            IsDialogOpen = false;

            return(result == ContentDialogResult.Primary || enterClicked ? inputBoxControl.Input : currentName);
        }
Beispiel #2
0
//SUPER BUTTON*********************************
        protected void SuperButton_Click(object sender, EventArgs e)
        {
            var u       = UserPath = Session["UserPath"] as string;
            var args    = SuperButtonArg.Text.Split(',');
            var command = args[0];
            var target  = args[1].Replace("\r\n", "").TrimStart(' ').TrimEnd(' ');
            var go      = 0;

            switch (command)
            {
            case "cut":
                if (!CutList.Contains(new KeyValuePair <string, string>(Upath, target)))
                {
                    CutList.Add(new KeyValuePair <string, string>(Upath, target));
                }
                CutBtn_Click(this, new EventArgs());
                break;

            case "copy":
                if (!CopyList.Contains(new KeyValuePair <string, string>(Upath, target)))
                {
                    CopyList.Add(new KeyValuePair <string, string>(Upath, target));
                }
                CopyBtn_Click(this, new EventArgs());
                break;

            case "paste":
                PasteContent(target);
                break;

            case "inputaccept":
                InputModal.Style.Clear();
                InputModal.Style.Add("display", "none");
                var name = RenameInputBox.Text;
                //find file and rename it
                target = Session["Rename"] as string;
                if (Path.GetExtension(target) == "")
                {
                    RenameDir(target, name);
                }
                else
                {
                    RenameFile(target, name);
                }

                UpdateAllPanels();
                break;

            case "rename":
                InputModal.Style.Clear();
                InputModal.Style.Add("display", "inline-block");
                Session["Rename"]   = target;
                RenameInputBox.Text = target;
                RenameInputBox.Focus();
                UpdateAllPanels();

                break;

            case "delete":
                if (Path.GetExtension(target) == "")
                {
                    DeleteDir(target);
                }
                else
                {
                    DeleteFile(target);
                }
                DeleteBtn_Click(this, new EventArgs());
                break;

            case "New Folder":
                var newpath = Server.MapPath(UserPath) + "New Folder";
                Directory.CreateDirectory(newpath);
                break;

            default:
                break;
            }
            var aa = Session["UserPath"] as string;

            UpdateFileLists(aa);
            UpdateAllPanels();
        }