示例#1
0
 public FieldAccessor(InputForm inputform, Asset parent, bool editable = true)
 {
     _type      = 3;
     _inputform = inputform;
     _asset     = parent;
     _raw       = new RawAccessor(_asset);
 }
示例#2
0
        private void 新建文件夹NToolStripMenuItem_Click(object sender, EventArgs e)
        {
            InputForm frmInput = new InputForm("新建文件夹", "请输入新文件夹的名称:", "NewFolder");
            var       dr       = frmInput.ShowDialog();

            if (dr == System.Windows.Forms.DialogResult.Cancel)
            {
                return;
            }
            String newFolderName = frmInput.Value;

            if (!newFolderName.StartsWith("/"))
            {
                newFolderName = CurrentFolderPath + "/" + newFolderName;
            }

            ThreadPool.QueueUserWorkItem(new WaitCallback(delegate
            {
                var site = CurrentFtpClient;
                if (!site.CreateDirectory(newFolderName))
                {
                    return;
                }
                RefreshRemote();
            }));
        }
示例#3
0
 public FieldAccessor(InputForm inputform, bool editable = true)
 {
     _type      = 3;
     _inputform = inputform;
     _editable  = editable;
     //_raw = new RawAccessor(this);
 }
示例#4
0
        private void 重命名RToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ListViewItem newLvi   = lvRemoteFile.SelectedItems[0];
            var          baseFile = newLvi.Tag as FtpBaseFileInfo;

            InputForm frmInput = new InputForm("重命名", "请输入新的名称:", baseFile.Name);
            var       dr       = frmInput.ShowDialog();

            if (dr == System.Windows.Forms.DialogResult.Cancel)
            {
                return;
            }
            String newFolderName = frmInput.Value;

            var client = CurrentFtpClient;

            ThreadPool.QueueUserWorkItem(new WaitCallback(delegate
            {
                if (!client.Rename(baseFile.FullName, newFolderName))
                {
                    return;
                }

                RefreshRemote();
            }));
        }
示例#5
0
        private void ChangeParameter(object sender, EventArgs e)
        {
            if (mAppState.Filter == Filter.BrightnessChange &&
                InputForm.DisplayInputFormInt(-100, 100, mBitmapManager.BrightnessValue, out int result))
            {
                mBitmapManager.BrightnessValue = result;
                mAppState.Filter = Filter.BrightnessChange;
            }

            if (mAppState.Filter == Filter.GammaCorrection &&
                InputForm.DisplayInputFormDouble(0.1, 3.0, mBitmapManager.GammaValue, out double result1))
            {
                mBitmapManager.GammaValue = result1;
                mAppState.Filter          = Filter.GammaCorrection;
            }

            if (mAppState.Filter == Filter.ConstrastEnhancement &&
                InputForm.DisplayInputFormDouble(0.1, 50.0, mBitmapManager.ContrastValue, out double result2))
            {
                mBitmapManager.ContrastValue = result2;
                mAppState.Filter             = Filter.ConstrastEnhancement;
            }

            if (mAppState.Filter == Filter.SingleComponent)
            {
                int sc = (int)mBitmapManager.SingleComponentValue;
                mBitmapManager.SingleComponentValue = (SingleComponent)((sc + 1) % 3);
            }

            PicMain.Invalidate();
            ApplyFilterUI();
        }
示例#6
0
        private void currentFileLabel_MouseDown(object sender, MouseEventArgs e)
        {
            var inputForm = new InputForm(
                "Enter the file number you want to play:\nNote: Value must be between 1 - " + GetTotalItems,
                "Enter File Number",
                (GetPlayingItem.Index + 1).ToString(CultureInfo.InvariantCulture));

            if (inputForm.ShowDialog(this) == DialogResult.OK)
            {
                var i = Functions.TryParse.ToInt(inputForm.GetInputText) - 1;

                if (i >= 0 && i < GetTotalItems)
                {
                    SelectedIndex = i;

                    // play selected item
                    var newUrl = Path.Combine(mp.FileInfo.GetDirectoryName, GetSelectedItem.Text);

                    if (File.Exists(newUrl) && SelectedIndex != GetPlayingItem.Index)
                    {
                        OpenFile(newUrl);
                    }
                }
            }
            inputForm.Dispose();
        }
        public void Should_edit_user_group()
        {
            string key        = Guid.NewGuid().ToString();
            string groupName  = Guid.NewGuid().ToString();
            string groupName2 = Guid.NewGuid().ToString();

            _webBrowser.ScreenCaptureOnFailure(() =>
            {
                AddNewUserGroup(key, groupName);

                var table = new DisplayTable <UserGroupInput>(_webBrowser);
                table.AddRowFilter(u => u.Name, groupName);

                Assert.IsTrue(table.VerifyRowExists());

                table.ClickLink(CodeCampSite.Admin.EditUserGroup);
                _webBrowser.VerifyPage <UserGroupController>(
                    p => p.Edit((UserGroupInput)null));

                var form = new InputForm <UserGroupInput>(_webBrowser);
                form
                .Input(u => u.Name, groupName2)
                .Submit();

                var table2 = new DisplayTable <UserGroupInput>(_webBrowser);
                table2.AddRowFilter(u => u.Name, groupName2);
                table2.AddRowFilter(u => u.Key, key);

                Assert.IsTrue(table2.VerifyRowExists());
            });
        }
        public ActionResult Login(InputForm form)
        {
            ViewBag.username = form.FormUsername;
            ViewBag.password = form.FormPassword;
            var r = (from a in db.Users
                     where a.UserName == form.FormUsername
                     select a).FirstOrDefault();

            if (r == null)
            {
                ViewBag.message = "帳號密碼錯誤";
                return(View());
            }
            else
            {
                string SaltAndFormPassword = String.Concat(r.Id, form.FormPassword);
                string FormPassword        = Encrypt(SaltAndFormPassword);
                ViewBag.inputHPV = FormPassword;
                ViewBag.savedHPV = r.PassWord;
                if (string.Compare(FormPassword, r.PassWord, false) == 0)
                {
                    ViewBag.message = "登入成功";
                }
                else
                {
                    ViewBag.message = "帳號密碼錯誤";
                }
                return(View());
            }
        }
示例#9
0
 /*
  * Start the application
  */
 private void startApp()
 {
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     inputForm = new InputForm(this);
     Application.Run(inputForm);
 }
示例#10
0
 private void UpdateDataView()
 {
     if (ddlGroups.SelectedIndex > 0)
     {
         panelExplain.Visible = false;
         dg.Visible           = true;
         using (inputForm = InputForm.GetByKey(inputFormId))
         {
             //ContainerList cl = Container.GetAll("GroupId = " + ddlGroups.SelectedValue);
             using (ContainerList cl = inputForm.GetCandidates(Convert.ToInt32(ddlGroups.SelectedValue)))
             {
                 cl.Sort("Tag");
                 dg.DataSource = cl;
                 dg.DataBind();
                 Utils.InitGridSort(ref dg, false);
                 dg.DisplayLayout.Pager.AllowPaging   = false;
                 dg.DisplayLayout.AllowSortingDefault = Infragistics.WebUI.UltraWebGrid.AllowSorting.No;
                 lbNbContainers.Text = " (#" + cl.Count.ToString() + " containers with [" + inputForm.InputFormTypeCode + "] type)";
             }
             if (ifcl != null)
             {
                 ifcl.Dispose();
             }
         }
     }
     else
     {
         dg.Visible           = false;
         panelExplain.Visible = true;
     }
 }
示例#11
0
        private void 重命名RToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var item    = lvBrowser.SelectedItems[0];
            var oldPath = item.Name;

            InputForm frmInput = new InputForm("重命名", "请输入新的名称:", item.Text);
            var       dr       = frmInput.ShowDialog();

            if (dr == System.Windows.Forms.DialogResult.Cancel)
            {
                return;
            }
            String newName = frmInput.Value;

            try
            {
                String newPath = Path.Combine(CurrentFolderPath, newName);
                if (Directory.Exists(oldPath))
                {
                    Directory.Move(oldPath, newPath);
                }
                else if (File.Exists(oldPath))
                {
                    File.Move(oldPath, newPath);
                }
            }
            catch { }
        }
示例#12
0
        public JObject PersadaString(string param)
        {
            Persada_Fc persadaF = new Persada_Fc();
            InputForm  xx       = JsonConvert.DeserializeObject <InputForm>(param);

            return(JObject.FromObject(persadaF.TestGetDataTable(xx)));
        }
        public void Should_edit_user_group()
        {
            string key = Guid.NewGuid().ToString();
            string groupName = Guid.NewGuid().ToString();
            string groupName2 = Guid.NewGuid().ToString();
            _webBrowser.ScreenCaptureOnFailure(() =>
                                                   {
                                                       AddNewUserGroup(key, groupName);

                                                       var table = new DisplayTable<UserGroupInput>(_webBrowser);
                                                       table.AddRowFilter(u => u.Name, groupName);

                                                       Assert.IsTrue(table.VerifyRowExists());

                                                       table.ClickLink(CodeCampSite.Admin.EditUserGroup);
                                                       _webBrowser.VerifyPage<UserGroupController>(
                                                           p => p.Edit((UserGroupInput) null));

                                                       var form = new InputForm<UserGroupInput>(_webBrowser);
                                                       form
                                                           .Input(u => u.Name, groupName2)
                                                           .Submit();

                                                       var table2 = new DisplayTable<UserGroupInput>(_webBrowser);
                                                       table2.AddRowFilter(u => u.Name, groupName2);
                                                       table2.AddRowFilter(u => u.Key, key);

                                                       Assert.IsTrue(table2.VerifyRowExists());
                                                   });
        }
示例#14
0
        /// <summary>
        /// 新增刀具
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void AddScissor_Click(object sender, EventArgs e)
        {
            InputForm inputForm = new InputForm();

            inputForm.RefreshInput("新刀具");
            inputForm.SentText += NewScissor;
            inputForm.ShowDialog();
        }
示例#15
0
        /// <summary>
        /// 修改了刀具名称
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ScissorListBox_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            InputForm inputForm = new InputForm();

            inputForm.RefreshInput(ScissorListBox.SelectedItem.ToString());
            inputForm.SentText += ChangeScissorName;
            inputForm.ShowDialog();
        }
示例#16
0
        //新建桌面组菜单
        private void MenuItemNewDesktopGroup_Click(object sender, EventArgs e)
        {
            if (treeLeft.SelectedNode == null)
            {
                return;
            }

            string sVal = "";

_ReTry:
            InputForm frm = new InputForm();

            frm.lbTitle.Text = "请输入桌面组名称:";
            frm.txtVal.Text  = sVal;
            if (frm.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            sVal = frm.txtVal.Text.Trim();
            if (sVal == "")
            {
                MessageBox.Show("名称不能空!");
                goto _ReTry;
            }
            if (Program.Ctx.DesktopGroupMgr.FindByName(sVal) != null)
            {
                MessageBox.Show("桌面组已经存在!");
                goto _ReTry;
            }
            CDesktopGroup group = new CDesktopGroup();

            group.Ctx  = Program.Ctx;
            group.Name = sVal;
            Program.Ctx.DesktopGroupMgr.AddNew(group);
            if (!Program.Ctx.DesktopGroupMgr.Save(true))
            {
                MessageBox.Show("添加桌面组失败!");
                return;
            }

            TreeNode node = new TreeNode();

            node.Text               = group.Name;
            node.ImageIndex         = 10;
            node.SelectedImageIndex = 10;
            TreeNodeTag tag = new TreeNodeTag();

            tag.NodeType = TreeNodeType.DesktopGroup;
            tag.Data     = group;
            node.Tag     = tag;

            treeLeft.SelectedNode.Nodes.Add(node);
            //刷新桌面组
            if (m_frmDesktopPanel != null)
            {
                m_frmDesktopPanel.LoadDesktopGroup();
            }
        }
示例#17
0
 private void ChangeCircleRadius(object sender, EventArgs e)
 {
     if (InputForm.DisplayInputFormInt(10, 300, mAppState.CircleRadius, out int newRadius))
     {
         mAppState.CircleRadius = newRadius;
         mAppState.CurrentArea  = Area.Circle;
         ApplyModeUI();
     }
 }
示例#18
0
        public SecureString PromptForPasskey()
        {
            if (!Encrypted)
            {
                throw new ManifestNotEncryptedException();
            }


            bool         passkeyValid = false;
            SecureString passkey      = null;

            try
            {
                if (CredentialLocker)
                {
                    credMan = CredManifest.GetManifest();
                    if (credMan.Key.Length >= 1)
                    {
                        if (VerifyPasskey(credMan.Key))
                        {
                            passkeyValid = true;
                            passkey      = credMan.Key;
                        }
                    }
                }
            }
            catch (Exception) { }

            while (!passkeyValid)
            {
                InputForm passkeyForm = new InputForm(Properties.strings.ManifestEnterKey, true);
                passkeyForm.ShowDialog(Application.Current.Windows.OfType <Window>().SingleOrDefault(x => x.IsActive)); // Gets the current active window and passes that to the input form (so it can center)
                if (!passkeyForm.Canceled)
                {
                    passkey = passkeyForm.txtPass.SecurePassword;
                    if (!VerifyPasskey(passkey))
                    {
                        MessageBox.Show(Properties.strings.ManifestKeyInvalid);
                    }
                    else
                    {
                        passkeyValid = true;
                        if (CredentialLocker)
                        {
                            credMan     = CredManifest.GetManifest();
                            credMan.Key = passkey;
                            credMan.Save();
                        }
                    }
                }
                else
                {
                    return(null);
                }
            }
            return(passkey);
        }
示例#19
0
        private void AddTemplate()
        {
            Excel.Worksheet   workSheet = null;
            Excel.Application XlApp     = Globals.ThisAddIn.Application;

            // Checks to see if the current worksheet is empty
            var empty = ((Excel.Worksheet)XlApp.ActiveSheet).WorkSheetEmpty();

            // If empty
            if (empty)
            {
                workSheet = XlApp.ActiveSheet;
            }

            // If not empty, create new worksheet
            else
            {
                InputForm form = new InputForm("Enter new worksheet name");

                form.ShowDialog();

                var workSheetName = form.TextInput;

                if (string.IsNullOrEmpty(workSheetName))
                {
                    return;
                }

                XlApp.ActiveWorkbook.CreateNewWorksheet(workSheetName);
                XlApp.ActiveWorkbook.ActivateSheet(workSheetName);
                workSheet = XlApp.ActiveSheet;
            }

            // Adds column headers to template table
            workSheet.Range["A5"].Value = "Command Type";
            workSheet.Range["B5"].Value = "Command";
            workSheet.Range["C5"].Value = "Options";
            workSheet.Range["D5"].Value = "Reference";
            workSheet.Range["E5"].Value = "New/Reference Name";
            workSheet.Range["F5"].Value = "Target Value";
            workSheet.Range["G5"].Value = "Auxillary Value";

            XlApp.ActiveWorkbook.CreateNamedRange(workSheet.Name + "Type", "A5");

            // Selects and styles the column headers
            var topRange = workSheet.Range["A5:G5"];

            topRange.Interior.Color = System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.CornflowerBlue);
            topRange.Font.Color     = System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.Black);
            topRange.Font.Bold      = true;

            // Styles the command columns
            var stylingRange = (Excel.Range)workSheet.Range["A:G"];

            stylingRange.ColumnWidth = 25;
            stylingRange.Cells.HorizontalAlignment = Excel.XlHAlign.xlHAlignCenter;
        }
示例#20
0
        private void BuildInputFormTab(string filter)
        {
            // Show/Hide Culture column
            if (Convert.ToInt32(inputFormId) >= 0 && SessionState.Culture.Type != CultureType.Master && SessionState.User.GetOptionById((int)OptionsEnum.OPT_SHOW_CULTURE) != null)
            {
                dg.Columns.FromKey("Country").ServerOnly = (!SessionState.User.GetOptionById((int)OptionsEnum.OPT_SHOW_CULTURE).Value);
            }
            else
            {
                dg.Columns.FromKey("Country").ServerOnly = true;
            }
            if (SessionState.User.GetOptionById((int)OptionsEnum.OPT_SHOW_INHERITANCEMODE) != null)
            {
                dg.Columns.FromKey("InheritanceMethodId").ServerOnly = (!SessionState.User.GetOptionById((int)OptionsEnum.OPT_SHOW_INHERITANCEMODE).Value);
            }
            if (Convert.ToInt32(inputFormId) >= 0)
            {
                // Show/Hide Comment column
                if (SessionState.User.GetOptionById((int)OptionsEnum.OPT_SHOW_COMMENT) != null)
                {
                    dg.Columns.FromKey("Comment").ServerOnly = (!SessionState.User.GetOptionById((int)OptionsEnum.OPT_SHOW_COMMENT).Value);
                }
                InputForm inputForm = InputForm.GetByKey(Convert.ToInt32(inputFormId));
                ViewState["InputFormName"] = inputForm.Name;
                SessionState.QDETab        = "tb_" + inputFormId;

                // Show / Hide Paste button in the toolbar
                if (SessionState.Clipboard.Items.Count > 0)
                {
                    if (SessionState.Clipboard.Items.Item(0).ItemId == itemId)
                    {
                        UITools.HideToolBarButton(uwToolbar, "Paste");
                        UITools.HideToolBarSeparator(uwToolbar, "PasteSep");
                    }
                }
                else
                {
                    UITools.HideToolBarButton(uwToolbar, "Paste");
                    UITools.HideToolBarSeparator(uwToolbar, "PasteSep");
                }
            }
            else
            {
                SessionState.QDETab        = "tb_all";
                ViewState["InputFormName"] = "All attached content";
            }

            using (InputFormChunkList chunkList = InputFormChunk.GetByInputForm(itemId, Convert.ToInt32(inputFormId), SessionState.Culture.Code))
            {
                dg.DataSource = chunkList;
                Utils.InitGridSort(ref dg, false);
                dg.DataBind();
                dg.DisplayLayout.AllowSortingDefault = AllowSorting.No;
                dg.DisplayLayout.Pager.AllowPaging   = false;
            }
        }
示例#21
0
        public void GetNotes_InputNullValue()
        {
            var form = new InputForm()
            {
                ImputedAmount = null, Results = new List <decimal>()
            };
            var atmService = new AtmService();

            Assert.AreEqual(new List <decimal>(), atmService.GetNotes(form));
        }
    private void FillList()
    {
        var fi = new InputForm();

        fi.Value = textBox1.Text;      // set initial value from main form
        if (fi.ShowDialog() == DialogResult.OK)
        {
            textBox1.Text = fi.Value;     // get input value back to main form
        }
    }
        private void AddTemplate()
        {
            Excel.Worksheet workSheet = null;

            var empty = ((Excel.Worksheet)Globals.ThisAddIn.Application.ActiveSheet).WorkSheetEmpty();

            if (empty)
            {
                workSheet = Globals.ThisAddIn.Application.ActiveSheet;
            }
            else
            {
                InputForm form = new InputForm("Enter new Work Sheet Name");

                form.ShowDialog();

                var workSheetName = form.TextInput;

                if (string.IsNullOrEmpty(workSheetName))
                {
                    return;
                }

                Globals.ThisAddIn.Application.ActiveWorkbook.Worksheets.Add();

                workSheet = Globals.ThisAddIn.Application.ActiveSheet;

                workSheet.Name = workSheetName;
            }

            workSheet.Range["A5"].Value = "Part Number";
            workSheet.Range["B5"].Value = "Description";
            workSheet.Range["C5"].Value = "Command";
            workSheet.Range["D5"].Value = "Name";
            workSheet.Range["E5"].Value = "Parent";
            workSheet.Range["F5"].Value = "Value";
            workSheet.Range["G5"].Value = "Value 2";

            workSheet.Range["C5"].Name = $"{workSheet.Name}Type";

            var topRange = workSheet.Range["A5:H5"];

            topRange.Interior.Color = System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.Orange);
            topRange.Font.Color     = System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.White);
            topRange.Font.Bold      = true;

            workSheet.Range["C6"].Value = "TopLevelName";
            workSheet.Range["D6"].Value = "Enter Top document name here";

            AddCommands();

            Globals.ThisAddIn.Application.ActiveWorkbook.ActivateSheet(workSheet.Name);

            workSheet.Range["C7"].AddDropDownList("Commands");
        }
示例#24
0
        private void MenuItemEditDesktopGroup_Click(object sender, EventArgs e)
        {
            if (treeLeft.SelectedNode == null)
            {
                return;
            }
            TreeNodeTag tag = (TreeNodeTag)treeLeft.SelectedNode.Tag;

            if (tag.NodeType != TreeNodeType.DesktopGroup)
            {
                return;
            }
            CDesktopGroup group = (CDesktopGroup)tag.Data;

            string sVal = group.Name;

_ReTry:
            InputForm frm = new InputForm();

            frm.lbTitle.Text = "请输入桌面组名称:";
            frm.txtVal.Text  = sVal;
            if (frm.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            sVal = frm.txtVal.Text.Trim();
            if (sVal == group.Name)
            {
                return;
            }
            if (sVal == "")
            {
                MessageBox.Show("名称不能空!");
                goto _ReTry;
            }
            if (Program.Ctx.DesktopGroupMgr.FindByName(sVal) != null)
            {
                MessageBox.Show("桌面组已经存在!");
                goto _ReTry;
            }

            group.Name = sVal;
            Program.Ctx.DesktopGroupMgr.Update(group);
            if (!Program.Ctx.DesktopGroupMgr.Save(true))
            {
                MessageBox.Show("修改桌面组失败!");
                return;
            }
            treeLeft.SelectedNode.Text = sVal;
            //刷新桌面组
            if (m_frmDesktopPanel != null)
            {
                m_frmDesktopPanel.LoadDesktopGroup();
            }
        }
 string Prompt(string name)
 {
     using (var f = new InputForm()) {
         f.Prompt = "Enter a value for " + name;
         if (f.ShowDialog() = DialogResult.OK)
         {
             return(f.Value);
         }
         return(null);
     }
 }
示例#26
0
文件: setup.cs 项目: Eun/WixSharp
    public static ActionResult MyAction(Session session)
    {
        using (InputForm inputBox = new InputForm())
        {
            if (inputBox.ShowDialog() != DialogResult.OK)
                return ActionResult.UserExit;

            session["WEBPOOL_NAME"] = inputBox.WebPoolName;
            return ActionResult.Success;
        }
    }
示例#27
0
        public async Task <IRequestReturnEntity> Post([FromBody] InputForm inputForm)
        {
            if (!ModelState.IsValid)
            {
                return(new RequestReturnEntity("Invalid Data.", 400));
            }

            await _formDomain.AddFormRecord(inputForm);

            return(new RequestReturnEntity("Successfully created new form record.", 200));
        }
示例#28
0
        public Form1()
        {
            InitializeComponent();

            inp = new InputForm(10, 10, this);

            inp.AddField("name", "Teljes név");
            inp.AddField("email", "E-Mail cím");
            inp.AddField("born", "Születési dátum");
            inp.AddButton("Regisztráció", ButtonClick);
        }
示例#29
0
        private void addToolStripMenuItem_Click(object sender, EventArgs e)
        {
            InputForm nInput = new InputForm();

            nInput.ShowDialog();
            if (nInput.DialogResult == DialogResult.OK)
            {
                this.objectListView1.AddObject(nInput.NewGuest);
                this.RefreshGuestsCount();
            }
        }
        public MainForm()
            : base(true)
        {
            InitializeComponent();

            //this.SetLogoIcon();
            this.SetLogoImages(picTop, status);
            UpdateCaption();

            tslblStatusState.SetLogoForeColor();
            tslblStatusNetwork.SetLogoForeColor();

            imgServices.Images.Add(Images.OK);
            imgServices.Images.Add(Images.Error);
            imgServices.Images.Add(Images.Extension);
            imgServices.Images.Add(Images.Extension.MakeGrayscale());
            imgServices.Images.Add(Images.Find);
            imgServices.Images.Add(Images.Warning);

            lblExtensionsWarning.ImageIndex = ImageIndexWarning;
            lblMonitorWarning.ImageIndex    = ImageIndexWarning;

            var lvgc = lvwMonitor.Groups;

            lvgc.Clear();
            foreach (var mt in RuntimeHelper.GetEnumElements <MonitoringObjectCategory>())
            {
                lvgc.Add(mt.ToString(), mt.GetString());
            }

            sberBank               = null;
            settingsForm           = null;
            aboutForm              = null;
            inputForm              = new InputForm();
            stateTimer             = new ToolStripStateTimer(tslblStatusState, TimeSpan.FromSeconds(2));
            stateTimer.DefaultText = StatusStateReady;
            stateTimer.UpdateStateText();

            var chordHandler = new ChordKeyHandler(this);

            actions = new Dictionary <int, HotKeyAction>();
            actions.Add(chordHandler.AddChord(Keys.Control, Keys.L, Keys.F), HotKeyAction.OpenLogFolder);
            actions.Add(chordHandler.AddChord(Keys.Control, Keys.L, Keys.D), HotKeyAction.DeleteLogFiles);
            actions.Add(chordHandler.AddChord(Keys.Control, Keys.L, Keys.O), HotKeyAction.OpenLogFile);
            actions.Add(chordHandler.AddChord(Keys.Control, Keys.L, Keys.W), HotKeyAction.LogComment);
            actions.Add(chordHandler.AddChord(Keys.Control, Keys.L, Keys.R), HotKeyAction.LogRuntimeInfo);
            actions.Add(chordHandler.AddChord(Keys.Control, Keys.D, Keys.N), HotKeyAction.NetworkControl);
            actions.Add(chordHandler.AddChord(Keys.Control, Keys.S, Keys.E), HotKeyAction.ShowExtensionFilter);
            actions.Add(chordHandler.AddChord(Keys.Control, Keys.L, Keys.C), HotKeyAction.LogControl);
            chordHandler.ChordPressed += OnChordPressed;

            menuMain = null;
        }
示例#31
0
 public void OnGet()
 {
     Input = new InputForm
     {
         Items = new List <InputForm.Item>
         {
             new InputForm.Item {
                 ID = 1
             }
         }
     };
 }
示例#32
0
        //新建视图菜单
        private void MenuItemNewViewCatalog_Click(object sender, EventArgs e)
        {
            if (treeLeft.SelectedNode == null)
            {
                return;
            }

            string sVal = "";

_ReTry:
            InputForm frm = new InputForm();

            frm.lbTitle.Text = "请输入目录名称:";
            frm.txtVal.Text  = sVal;
            if (frm.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            sVal = frm.txtVal.Text.Trim();
            if (sVal == "")
            {
                MessageBox.Show("名称不能空!");
                goto _ReTry;
            }
            if (Program.Ctx.ViewCatalogMgr.FindByName(sVal) != null)
            {
                MessageBox.Show("目录已经存在!");
                goto _ReTry;
            }
            CViewCatalog catalog = new CViewCatalog();

            catalog.Ctx  = Program.Ctx;
            catalog.Name = sVal;
            Program.Ctx.ViewCatalogMgr.AddNew(catalog);
            if (!Program.Ctx.ViewCatalogMgr.Save(true))
            {
                MessageBox.Show("添加目录失败!");
                return;
            }

            TreeNode node = new TreeNode();

            node.Text               = catalog.Name;
            node.ImageIndex         = 10;
            node.SelectedImageIndex = 10;
            TreeNodeTag tag = new TreeNodeTag();

            tag.NodeType = TreeNodeType.ViewCatalog;
            tag.Data     = catalog;
            node.Tag     = tag;

            treeLeft.SelectedNode.Nodes.Add(node);
        }
示例#33
0
        /// <summary>
        /// 执行命令
        /// </summary>
        /// <param name="o">当前对象</param>
        /// <return>是否执行成功</return>
        public override bool Execute(object o)
        {
            bool success = false;
            TreeNode currentNode = tree.SelectedNode;

            if (currentNode != null)
            {
                // 显示输入管理器
                InputForm iForm = new InputForm("请输入重命名结点的名称", currentNode.Text);
                DialogResult result = iForm.ShowDialog();

                if (result == DialogResult.OK)
                {
                    if (CheckPathValid(currentNode, iForm.InputText)) // 当前无重复路径
                    {
                        description = "重命名树结点 " + iForm.InputText;
                        currentNode.Text = iForm.InputText;
                        currentNode.Name = iForm.InputText;
                        documentManager.CurrentTreeMode = EditMode.Normal;
                        
                        // 对数据库进行操作
                        DataBaseManager dataBaseManager = DataBaseManager.GetDataBaseManager();                                             

                        // 批量更新绘图路径
                        List<TreeNode> nodeList = GetChildNodeList(currentNode);
                        foreach (TreeNode node in nodeList)
                        {
                            string newPath = documentManager.GetNodePath(node);
                            dataBaseManager.UpdateDiagramPath(node.Tag.ToString(), newPath);
                        }               

                        success = true;
                    }
                    else
                    {
                        MessageBox.Show("该路径已经存在!", "路径有效性检查", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }                                      
                }
            }

            return success;
        }
        public void Should_require_fields()
        {
            _webBrowser.ScreenCaptureOnFailure(() =>
                                                   {
                                                       string groupName = Guid.NewGuid().ToString();
                                                       GoToUserGroupAdminPage();

                                                       _webBrowser.ClickLink(CodeCampSite.Admin.CreateUserGroup);
                                                       var form = new InputForm<UserGroupInput>(_webBrowser);
                                                       form
                                                           .Input(u => u.Name, groupName)
                                                           .Submit();

                                                       _webBrowser.VerifyPage<UserGroupController>(
                                                           p => p.Edit((UserGroupInput) null));

                                                       _webBrowser.ValidationSummaryExists();
                                                       _webBrowser.ValidationSummaryContainsMessageFor<UserGroupInput>(
                                                           m => m.Key);
                                                       _webBrowser.AssertValue<UserGroupInput>(m => m.Name, groupName);
                                                   });
        }
        private void AddNewUserGroup(string key, string groupName)
        {
            GoToUserGroupAdminPage();

            _webBrowser.ClickLink(CodeCampSite.Admin.CreateUserGroup);

            var form = new InputForm<UserGroupInput>(_webBrowser);
            form
                .Input(u => u.Key, key)
                .Input(u => u.Name, groupName)
                .Input(u => u.Users, "Joe User", "Bart Simpson")
                .Submit();

            _webBrowser.VerifyPage<UserGroupController>(p => p.List());
        }
示例#36
0
        /// <summary>After requesting start index, will copy all items currently shown in list view 
        /// to a subfolder called Renamed, renaming incrementally from the start index.</summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void btnRename_Click(object sender, System.EventArgs e)
        {
            InputForm input = new InputForm("Enter start index:", "Start Index");
            if (input.ShowDialog(this) == DialogResult.OK) {
                int n = 0;
                string startIndex = input.InputText;
                try {
                    n = int.Parse(startIndex);
                } catch (FormatException) {
                    MessageBox.Show("That is not a valid number.\n 0 will be used as the start index", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }

                string subfolder = "Renamed\\", filename, fileNumber;//path = this.Text+"\\"
                bool doIt = true;
                MessageFolder folder = (MessageFolder) tvParents.SelectedNode.Tag;
                MessageFormat format = folder.RetrieveFormat();
                System.Diagnostics.Debugger.Launch();//could probably use folder.RetrievePath()
                string path = MainForm.path + "\\" + tvParents.SelectedNode.FullPath.Substring(tvParents.Nodes[0].Text.Length + 1) + "\\";

                if (Directory.Exists(path + subfolder)) {
                    doIt = false;
                    DialogResult dr = MessageBox.Show("Overwrite existing directory and files", "Warning", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation);
                    if (dr == DialogResult.OK) {
                        doIt = true;
                        Directory.Delete(path + subfolder, true);
                    } else {
                        MessageBox.Show("Operation Aborted");
                    }
                }
                if (doIt) {
                    Directory.CreateDirectory(path + subfolder);
                    foreach (ListViewItem lvi in lvChildren.Items) {
                        filename = lvi.SubItems[5].Text;
                        fileNumber = n.ToString();
                        if (format == MessageFormat.Motorola) {
                            fileNumber = fileNumber.PadLeft(4, '0');
                        }
                        File.Copy(path + filename, path + subfolder + MessageNameFormatAttribute.FileFormat(format).Replace("*", fileNumber));
                        n++;
                    }
                }
                //File.Move(txtPath.Text+txtOrigFileName.Text,txtPath.Text+txtNewFileName.Text);
                //File.Delete(txtPath.Text+txtOrigFileName.Text);
            }
        }
示例#37
0
        /// <summary>Creates a new subfolder.</summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void mnuCreateNew_Click(object sender, System.EventArgs e)
        {
            //node has been set for mnuCreateNew when context menu was opening
            TreeNode node = (TreeNode) ((MenuItem) sender).Tag;
            string nodePath;
            bool isTopNode = node.Parent == null;
            if (isTopNode) {
                //top most node
                nodePath = path + "\\";
            } else {
                //phone/folder node
                nodePath = CreateNodePath(node);
            }

            InputForm input = new InputForm("Enter name for new folder:", "New Folder");
            if (input.ShowDialog(this) == DialogResult.OK) {
                string newName = input.InputText;
                Directory.CreateDirectory(nodePath + newName);
                if (isTopNode) {
                    //top most node
                    AddPhoneNode(newName, nodePath, MessageFormat.Nokia);
                } else {
                    //phone/folder node
                    RefreshNode(node);
                }
            }
        }
示例#38
0
 private void MenuItemNewFile_Click(object sender, EventArgs e)
 {
     string UserInput;
     InputForm Input = new InputForm();
     Input.ShowDialog();
     UserInput = Input.InputBoxText();
 }
示例#39
0
        /// <summary>
        /// 执行命令
        /// </summary>
        /// <param name="o">命令参数</param>
        /// <returns>是否执行成功</returns>
        public override bool Execute(object o)
        {
            bool success = false;
            List<string> mapList = o as List<string>;
            TreeNode currentNode = tree.SelectedNode;
            TreeNode newNode;
            DialogResult result;
            string inputText;

            if (currentNode.Level > 0) // 在当前选中树结点下新建分类
            {
                InputForm iForm = new InputForm("请输入新建分类的名称", "新建分类");
                result = iForm.ShowDialog();
                inputText = iForm.InputText;
            }
            else // 在根结点下新建分类
            {
                ListForm lForm = new ListForm("请选择新建分类的地图名", mapList);
                result = lForm.ShowDialog();
                inputText = lForm.InputText;
            }

            if (result == DialogResult.OK)
            {
                if (CheckPathValid(currentNode, inputText)) // 当前无重复路径
                {
                    // 保存命令执行前的状态
                    description = ("新建分类 " + inputText);                    

                    if (currentNode != null) 
                    {
                        newNode = currentNode.Nodes.Add(inputText);
                    }
                    else 
                    {
                        newNode = tree.Nodes.Add(inputText);
                    }

                    newNode.Name = inputText;
                    newNode.ImageIndex = 0;
                    newNode.SelectedImageIndex = 0;
                    tree.SelectedNode = newNode;
                    documentManager.CurrentTreeMode = EditMode.Normal;

                    // 对数据库进行操作
                    DataBaseManager dataBaseManager = DataBaseManager.GetDataBaseManager();
                    string path = documentManager.GetNodePath(newNode);
                    string id = dataBaseManager.CreateNewDiagram(path, true, documentManager.CurrentChartMode);
                    newNode.Tag = id;

                    // 保存命令执行后的状态                    
                    success = true;
                }
                else
                {
                    MessageBox.Show("该路径已经存在!", "路径有效性检查", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }

            return success;
        }
示例#40
0
        private void mnuImportMessages_Click(object sender, EventArgs e)
        {
            TreeNode folderNode = tvParents.SelectedNode;
            MessageFolder folder = (MessageFolder) folderNode.Tag;
            MessageFormat format = folder.RetrieveFormat();
            ImportMessagesForm importForm = new ImportMessagesForm(format);
            if (importForm.ShowDialog(this) == DialogResult.OK) {
                List<TextMessage> importMessages = importForm.Messages;

                InputForm input = new InputForm("Rename messages - Enter start index:", "Start Index");
                Dictionary<string, string> fileNameMap = new Dictionary<string, string>();
                bool validIndex = false;
                while (!validIndex && input.DialogResult != DialogResult.Cancel) {
                    if (input.ShowDialog(this) == DialogResult.OK) {
                        int n = 0;
                        string startIndex = input.InputText;
                        try {
                            n = int.Parse(startIndex);
                            validIndex = true;

                            foreach (TextMessage importMessage in importMessages) {
                                string fileName = importMessage.FileName;
                                string fileNumber = n.ToString();
                                if (format == MessageFormat.Motorola) {
                                    fileNumber = fileNumber.PadLeft(4, '0');
                                }
                                string newFileName = MessageNameFormatAttribute.FileFormat(format).Replace("*", fileNumber);
                                fileNameMap.Add(fileName, newFileName);
                                n++;
                            }
                        } catch (FormatException) {
                            MessageBox.Show("That is not a valid number. Enter a valid numeric value.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }
                    }
                }

                string targetLocation = folder.RetrievePath();
                foreach (TextMessage importMessage in importMessages) {
                    string sourceLocation = importMessage.FilePath;
                    string fileName = Path.GetFileName(sourceLocation);
                    string newFileName;
                    if (!fileNameMap.TryGetValue(fileName, out newFileName)) {
                        newFileName = fileName;
                    }
                    //does not replace files
                    File.Copy(sourceLocation, targetLocation + newFileName);
                }
                RefreshNode(folderNode);
            }
        }
示例#41
0
        public object ask(object data)
        {
           
            LuaTable table = (LuaTable)data;
            foreach (LuaTable field in table.Values)
            {
                List<InputField> inputFields = new List<InputField>();
                foreach (LuaTable t in table.Values)
                {
                    int i = 0;
                    InputField inputField = new InputField();
                    foreach (string tt in t.Keys)
                    {
                        if (tt == "title")
                        {
                            inputField.Title = (String)t.Values.OfType<string>().ElementAt(i);
                        }
                        if (tt == "key")
                        {
                            inputField.Key = (String)t.Values.OfType<string>().ElementAt(i);
                        }

                    }
                    inputFields.Add(inputField);

                }
                InputForm inputForm = new InputForm(inputFields);
                if (inputForm.ShowDialog() == DialogResult.OK)
                {
                    return inputForm.Data;
                }

            }
            return null;
           
        }