Пример #1
0
        ContextMenu CreateFileRightMenu(Status status)
        {
            //contextMenu
            var contextMenu = new ContextMenu();

            contextMenu.Items.Add(new Actions.ItemRefresh(status));
            contextMenu.Items.AddSeparator();
            contextMenu.Items.Add(new Actions.ItemUpload(status));
            contextMenu.Items.Add(new Actions.ItemDownload(status));
            contextMenu.Items.Add(new Actions.ItemDownloadToServer(status));
            contextMenu.Items.AddSeparator();
            contextMenu.Items.Add(new Actions.ItemEdit(status));
            contextMenu.Items.Add(new Actions.ItemRename(status));
            contextMenu.Items.Add(new Actions.ItemModifyTime(status));
            contextMenu.Items.AddSeparator();
            contextMenu.Items.Add(new Actions.ItemCopy(status));
            contextMenu.Items.Add(new Actions.ItemPaste(status));
            contextMenu.Items.AddSeparator();
            var create = contextMenu.Items.GetSubmenu(StrRes.GetString("StrNew", "New"));

            create.Items.Add(new Actions.ItemCreateDir(status));
            create.Items.Add(new Actions.ItemCreateFile(status));
            contextMenu.Items.Add(new Actions.ItemDelete(status));

            return(contextMenu);
        }
Пример #2
0
        public PanelDbManager(IHost host, PluginParameter data)
        {
            _host         = host;
            _shellData    = (Shell)data[0];
            _shellSqlConn = GetShellSqlConn();

            // init StrRes to translate string
            StrRes.SetHost(_host);
            Init();

            //绑定事件
            _dbManager = new DbManager(_host, _shellData, _shellSqlConn.type);
            _dbManager.ConnectDbCompletedToDo       += DbManagerConnectDbCompletedToDo;
            _dbManager.GetDbNameCompletedToDo       += DbManagerGetDbNameCompletedToDo;
            _dbManager.GetDbTableNameCompletedToDo  += DbManagerGetTableNameCompletedToDo;
            _dbManager.GetColumnTypeCompletedToDo   += DbManagerGetColumnTypeCompletedToDo;
            _dbManager.ExecuteReaderCompletedToDo   += DbManagerExecuteReaderCompletedToDo;
            _dbManager.ExecuteNonQueryCompletedToDo += DbManagerExecuteNonQueryCompletedToDo;

            RefreshServerStatus(false);


            if (string.IsNullOrEmpty(_shellSqlConn.type) || string.IsNullOrEmpty(_shellSqlConn.conn))
            {
                MessageBox.Show("shell's sqlConnection is null or space");
            }
            else
            {
                //连接数据库
                _dbManager.ConnectDb(_shellSqlConn.conn);
            }
        }
Пример #3
0
        public ItemDownload(Status status)
        {
            MenuText  = StrRes.GetString("StrDownload", "Download");
            Executed += ItemDownload_Executed;

            _status = status;
        }
        void InitUi()
        {
            //_itemRefreshStatus
            _itemRefreshStatus = new ButtonMenuItem {
                Text = StrRes.GetString("StrRefreshStatus", "Refresh Status")
            };
            _itemRefreshStatus.Click += _itemRefreshStatus_Click;
            //_itemCopyServerCode
            _itemCopyServerCode = new ButtonMenuItem {
                Text = StrRes.GetString("StrCopyServerCode", "Copy ServerCode")
            };
            _itemCopyServerCode.Click += _itemCopyServerCode_Click;
            //_itemAdd
            _itemAdd = new ButtonMenuItem {
                Text = StrRes.GetString("StrAdd", "Add")
            };
            _itemAdd.Click += _itemAdd_Click;
            //_itemEdit
            _itemEdit = new ButtonMenuItem {
                Text = StrRes.GetString("StrEdit", "Edit")
            };
            _itemEdit.Click += _itemEdit_Click;
            //_itemDelete
            _itemDelete = new ButtonMenuItem {
                Text = StrRes.GetString("StrDelete", "Delete")
            };
            _itemDelete.Click += _itemDelete_Click;

            //rightMenu_Webshell
            _rightMenuWebshell = new ContextMenu();
            _rightMenuWebshell.Items.Add(_itemRefreshStatus);
            _rightMenuWebshell.Items.Add(_itemCopyServerCode);
            _rightMenuWebshell.Items.Add(new SeparatorMenuItem());
            _rightMenuWebshell.Items.Add(_itemAdd);
            _rightMenuWebshell.Items.Add(_itemEdit);
            _rightMenuWebshell.Items.Add(_itemDelete);
            _rightMenuWebshell.Items.Add(new SeparatorMenuItem());

            //_gridViewShell
            _gridViewShell             = CreateListView();
            _gridViewShell.ContextMenu = _rightMenuWebshell;
            _gridViewShell.MouseUp    += (sender, e) =>
            {
                if (e.Buttons == MouseButtons.Alternate)
                {
                    _gridViewShell.ContextMenu.Show(_gridViewShell);
                }
            };
            //_gridViewShell.CellDoubleClick += _gridViewShell_CellDoubleClick;
            //_gridViewShell.ColumnHeaderClick += _gridViewShell_ColumnHeaderClick;

            var layout = new DynamicLayout {
                Padding = new Padding(0), Spacing = new Size(10, 10)
            };

            layout.Add(_gridViewShell);

            this.Content = layout;
        }
Пример #5
0
        public ItemCreateFile(Status status)
        {
            ID        = "createFile";
            MenuText  = StrRes.GetString("StrCreateFile", "CreateFile");
            Executed += ItemCreateFile_Executed;

            _status = status;
        }
Пример #6
0
        public ItemRename(Status status)
        {
            ID        = "rename";
            MenuText  = StrRes.GetString("StrRename", "Rename");
            Executed += ItemRename_Executed;

            _status = status;
        }
Пример #7
0
        public ItemRefresh(Status status)
        {
            ID        = "refresh";
            MenuText  = StrRes.GetString("StrRefresh", "Refresh");
            Executed += ItemRefresh_Executed;

            _status = status;
        }
Пример #8
0
        public ItemPaste(Status status)
        {
            ID        = "paste";
            MenuText  = StrRes.GetString("StrPaste", "Paste");
            Executed += ItemPaste_Executed;

            _status = status;
        }
Пример #9
0
        public ItemEdit(Status status)
        {
            ID        = "edit";
            MenuText  = StrRes.GetString("StrEdit", "Edit");
            Executed += ItemEdit_Executed;

            _status = status;
        }
Пример #10
0
        public ItemDownloadToServer(Status status)
        {
            ID        = "downloadToServer";
            MenuText  = StrRes.GetString("StrDownloadToServer", "DownloadToServer");
            Executed += ItemDownloadToServer_Executed;

            _status = status;
        }
Пример #11
0
        public ItemCopy(Status status)
        {
            ID        = "copy";
            MenuText  = StrRes.GetString("StrCopy", "Copy");
            Executed += ItemCopy_Executed;

            _status = status;
        }
Пример #12
0
        public ItemUpload(Status status)
        {
            ID        = "upload";
            MenuText  = StrRes.GetString("StrUpload", "Upload");
            Executed += ItemUpload_Executed;

            _status = status;
        }
Пример #13
0
        public ItemDelete(Status status)
        {
            ID        = "delete";
            MenuText  = StrRes.GetString("StrDelete", "Delete");
            Executed += ItemDelete_Executed;

            _status = status;
        }
Пример #14
0
		public ItemCreateDir(Status status)
		{
			ID = "createDir";
			MenuText = StrRes.GetString("StrCreateDir","CreateDir");
			Executed += ItemCreateDir_Executed;

			_status = status;
		}
Пример #15
0
        public ItemModifyTime(Status status)
        {
            ID        = "modifyTime";
            MenuText  = StrRes.GetString("StrModifyTime", "ModifyTime");
            Executed += ItemModifyTime_Executed;

            _status = status;
        }
Пример #16
0
 private void AddContextFunctions()
 {
     FunctionDescriptor.FunctionGroup grp = FunctionDescriptor.FunctionGroup.ContextGroup;
     AddFunction(
         "SetContext", grp, new[] { "SetzeKontext" },
         new Functions.ContextFunctions.SetContext(),
         StrRes.GetString(StrRes.STR_DESCR_CONTEXT)
         );
 }
Пример #17
0
        void Init()
        {
            //_textBoxUrl
            _textBoxUrl = new TextBox();

            //_buttonReadFile
            _buttonReadFile = new Button {
                Text = StrRes.GetString("StrLoad", "Load")
            };
            _buttonReadFile.Click += _buttonReadFile_Click;

            //_buttonSaveFile
            _buttonSaveFile = new Button {
                Text = StrRes.GetString("StrSave", "Save")
            };
            _buttonSaveFile.Click += _buttonSaveFile_Click;

            //_textAreaBody
            _textAreaBody = new TextArea();
            //rightMenu_Body
            var rightMenuBody = new ContextMenu();
            var findCommand   = new Command
            {
                MenuText = StrRes.GetString("StrFind", "Find"),
                Shortcut = Keys.F | Application.Instance.CommonModifier
            };

            findCommand.Executed += findCommand_Executed;
            rightMenuBody.Items.Add(findCommand);

            var layout = new DynamicLayout {
                Padding = new Padding(5, 5), Spacing = new Size(5, 5)
            };

            layout.BeginVertical();
            layout.BeginHorizontal();
            layout.AddCentered(_textBoxUrl, xscale: true, horizontalCenter: false);
            layout.AddCentered(_buttonReadFile, horizontalCenter: false);
            layout.AddCentered(_buttonSaveFile, horizontalCenter: false);
            layout.EndBeginHorizontal();
            layout.EndVertical();

            layout.AddRow(_textAreaBody);

            // bug in gtk2
            layout.ContextMenu = rightMenuBody;
            layout.MouseUp    += (sender, e) =>
            {
                if (e.Buttons == MouseButtons.Alternate)
                {
                    layout.ContextMenu.Show(_textAreaBody);
                }
            };

            Content = layout;
        }
Пример #18
0
        protected override double ExecuteTrigFunction(double arg)
        {
            double res = Math.Atan(arg);

            if (Double.IsNaN(res))
            {
                throw new ArgumentRangeException(String.Format(StrRes.GetString(StrRes.STR_BAD_PARAMETER_VALUE), GetType().Name));
            }
            return(res);
        }
Пример #19
0
        protected override double ExecuteTrigFunction(double arg)
        {
            double res = Math.Acos(arg);

            if (Double.IsNaN(res))
            {
                throw new ArgumentRangeException(String.Format(StrRes.GetString(StrRes.STR_VALUE_OUT_OF_RANGE), GetType().Name, -1, 1));
            }
            return(res);
        }
Пример #20
0
        /// <summary>
        /// Get an UInt64 value of an object with respect to a range given
        /// </summary>
        /// <param name="arg">Object to convert</param>
        /// <param name="minValue">Minimum expected value from <paramref name="arg"/></param>
        /// <param name="maxValue">Maximum expected value from <paramref name="arg"/></param>
        /// <returns></returns>
        public UInt64?GetRangedUInt64(ref object arg, UInt64 minValue, UInt64 maxValue)
        {
            UInt64 value = Convert.ToUInt64(arg.ToString());

            if ((value < minValue) || (value > maxValue))
            {
                throw new ArgumentRangeException(String.Format(
                                                     StrRes.GetString(StrRes.STR_VALUE_OUT_OF_RANGE),
                                                     functionName, minValue, maxValue));
            }
            return(value);
        }
Пример #21
0
        public PanelPluginManager(IHost host, PluginParameter data)
        {
            this._host = host;

            // init StrRes to translate string
            StrRes.SetHost(_host);
            Init();

            _updateXmlPath    = Path.Combine(_host.App.AppPluginDir, new PluginInfo().Name, "update.xml");
            _updateXmlUrl     = ReadConfigXml();
            _installedPlugins = PluginProvider.GetPlugins();
            DownloadUpdateXml();
            LoadInstalledPlugins();
        }
Пример #22
0
        public static void ImportCaidaoShell()
        {
            if (!Eto.EtoEnvironment.Platform.IsWindows)
            {
                MessageBox.Show("Sorry, only supports windows.");
                return;
            }

            var openFileDialog = new OpenFileDialog
            {
                Title   = "Select Caidao Databse To Import",
                Filters = { new FileDialogFilter("Caidao Databses", ".mdb") }
            };

            if (openFileDialog.ShowDialog(Application.Instance.MainForm) == DialogResult.Ok)
            {
                var srcfile = openFileDialog.FileName;
                //var pwd = "密" + (char) 13 + (char) 9 + (char) 10 + "码" + (char) 2;
                var pwd        = Encoding.GetEncoding(936).GetString(new byte[] { 0xc3, 0xdc, 0x0d, 0x09, 0x0a, 0xc2, 0xeb, 0x02 });
                var connString = string.Format("Provider=Microsoft.Jet.OLEDB.4.0;" +
                                               "Data Source={0};" +
                                               "Mode=Share Deny Read|Share Deny Write;Persist Security Info=False;" +
                                               "Jet OLEDB:Database Password=\"{1}\"", srcfile, pwd);
                AccessHelper.ConnString = connString;
                try
                {
                    var sites     = GetCaiDaoSite();
                    var shellList = new List <Shell>();
                    foreach (DataRow row in sites.Rows)
                    {
                        shellList.Add(ConvertCaiDaoDataRowToShell(row));
                    }
                    foreach (var shell in shellList)
                    {
                        ShellManager.Insert(shell);
                    }
                    if (shellList.Count > 0)
                    {
                        MessageBox.Show(string.Format("Imported {0} Shell(s)", shellList.Count));
                        MessageBox.Show(
                            StrRes.GetString("StrImportCaidaoShellInfo",
                                             "Although the data of caidao be imported successfully, but it's scriptType and Config are not compatible with altman, you may still need to modify some data manually."));
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
        }
Пример #23
0
 private void AddTrigonometricFunctions()
 {
     FunctionDescriptor.FunctionGroup grp = FunctionDescriptor.FunctionGroup.TrigonometricGroup;
     AddFunction(
         "Sin", grp, null,
         new Functions.TrigonometricFunctions.Sin(),
         StrRes.GetString(StrRes.STR_DESC_SIN)
         );
     AddFunction(
         "Cos", grp, null,
         new Functions.TrigonometricFunctions.Cos(),
         StrRes.GetString(StrRes.STR_DESC_COS)
         );
     AddFunction(
         "Tan", grp, null,
         new Functions.TrigonometricFunctions.Tan(),
         StrRes.GetString(StrRes.STR_DESC_TAN)
         );
     AddFunction(
         "SinH", grp, null,
         new Functions.TrigonometricFunctions.SinH(),
         StrRes.GetString(StrRes.STR_DESC_SINH)
         );
     AddFunction(
         "CosH", grp, null,
         new Functions.TrigonometricFunctions.CosH(),
         StrRes.GetString(StrRes.STR_DESC_COSH)
         );
     AddFunction(
         "TanH", grp, null,
         new Functions.TrigonometricFunctions.TanH(),
         StrRes.GetString(StrRes.STR_DESC_TANH)
         );
     AddFunction(
         "ASin", grp, null,
         new Functions.TrigonometricFunctions.ASin(),
         StrRes.GetString(StrRes.STR_DESC_ASIN)
         );
     AddFunction(
         "ACos", grp, null,
         new Functions.TrigonometricFunctions.ACos(),
         StrRes.GetString(StrRes.STR_DESC_ACOS)
         );
     AddFunction(
         "ATan", grp, null,
         new Functions.TrigonometricFunctions.ATan(),
         StrRes.GetString(StrRes.STR_DESC_ATAN)
         );
 }
Пример #24
0
        public override object Execute(object[] args, ExecutionContext ctx)
        {
            ArgumentChecker checker = new ArgumentChecker(this.GetType().Name);

            checker.CheckForNumberOfArguments(ref args, 2, 2);
            double b  = Convert.ToDouble(args[0]);
            double ex = Convert.ToDouble(args[1]);

            if ((b == 0) && (ex == -1))
            {
                throw new ArgumentRangeException(StrRes.GetString(StrRes.STR_DIV_BY_ZERO));
            }

            return(Math.Pow(b, ex));
        }
Пример #25
0
 private void _buttonDefault_Click(object sender, EventArgs e)
 {
     if (_dropDownScritpType.SelectedIndex != -1)
     {
         var conns = Altman.Webshell.Service.GetDbNodeInfoList(_dropDownScritpType.SelectedKey);
         _richTextBoxSetting.Text = ShellExtraStringHandle.CreateDefaultIniString(conns);
     }
     else
     {
         MessageBox.Show(
             this,
             StrRes.GetString("StrPleaseSelectScriptTypeFirst", "Please select script type first"),
             MessageBoxType.Error);
     }
 }
Пример #26
0
 private void AddCoordinateFunctions()
 {
     FunctionDescriptor.FunctionGroup grp = FunctionDescriptor.FunctionGroup.CoordinateGroup;
     AddFunction(
         "Bearing", grp, new[] { "Peilung" },
         new Functions.CoordinateFunctions.Bearing(),
         StrRes.GetString(StrRes.STR_DESCR_BEARING)
         );
     AddFunction(
         "Distance", grp, new[] { "Abstand" },
         new Functions.CoordinateFunctions.Distance(),
         StrRes.GetString(StrRes.STR_DESCR_DISTANCE)
         );
     AddFunction(
         "CrossBearing", grp, new[] { "Kreuzpeilung" },
         new Functions.CoordinateFunctions.Crossbearing(),
         StrRes.GetString(StrRes.STR_DESCR_CROSSBEARING)
         );
     AddFunction(
         "Intersection", grp, new[] { "Schnittpunkt" },
         new Functions.CoordinateFunctions.Intersection(),
         StrRes.GetString(StrRes.STR_DESCR_INTERSECTION)
         );
     AddFunction(
         "Projection", grp, new[] { "Projektion" },
         new Functions.CoordinateFunctions.Projection(),
         StrRes.GetString(StrRes.STR_DESCR_PROJECTION)
         );
     AddFunction(
         "Waypoint", grp, new[] { "Wegpunkt", "WP" },
         new Functions.CoordinateFunctions.Waypoint(),
         StrRes.GetString(StrRes.STR_DESCR_WAYPOINT)
         );
     AddFunction(
         "Latitude", grp, new[] { "Lat", "Längengrad" },
         new Functions.CoordinateFunctions.Latitude(),
         StrRes.GetString(StrRes.STR_DESCR_LATITUDE)
         );
     AddFunction(
         "Longitude", grp, new[] { "Lon", "Breitengrad" },
         new Functions.CoordinateFunctions.Longitude(),
         StrRes.GetString(StrRes.STR_DESCR_LONGITUDE)
         );
 }
Пример #27
0
 private void AddTextFunctions()
 {
     FunctionDescriptor.FunctionGroup grp = FunctionDescriptor.FunctionGroup.TextGroup;
     AddFunction(
         "AlphaSum", grp, new[] { "AS" },
         new Functions.TextFunctions.AlphaSum(),
         StrRes.GetString(StrRes.STR_DESCR_ALPHASUM)
         );
     AddFunction(
         "AlphaPos", grp, new[] { "AP" },
         new Functions.TextFunctions.AlphaPos(),
         StrRes.GetString(StrRes.STR_DESCR_ALPHAPOS)
         );
     AddFunction(
         "PhoneCode", grp, new[] { "HandyCode", "PC", "HC" },
         new Functions.TextFunctions.PhoneCode(),
         StrRes.GetString(StrRes.STR_DESCR_PHONECODE)
         );
     AddFunction(
         "PhoneSum", grp, new[] { "HS", "PS", "HandySum" },
         new Functions.TextFunctions.PhoneSum(),
         StrRes.GetString(StrRes.STR_DESCR_PHONESUM)
         );
     AddFunction(
         "Length", grp, new[] { "Len", "Länge" },
         new Functions.TextFunctions.TextLen(),
         StrRes.GetString(StrRes.STR_DESCR_LEN)
         );
     AddFunction(
         "Mid", grp, null,
         new Functions.TextFunctions.Mid(),
         StrRes.GetString(StrRes.STR_DESCR_MID)
         );
     AddFunction(
         "Reverse", grp, new[] { "Umkehr" },
         new Functions.TextFunctions.Reverse(),
         StrRes.GetString(StrRes.STR_DESCR_REVERSE)
         );
     AddFunction(
         "Rot13", grp, null,
         new Functions.TextFunctions.Rot13(),
         StrRes.GetString(StrRes.STR_DESCR_ROT13)
         );
 }
Пример #28
0
        private bool VerifyShell(Shell shell)
        {
            var success = true;

            if (shell.TargetId == "" ||
                shell.ShellType == "" ||
                shell.ShellUrl == "" ||
                shell.ShellPwd == "" ||
                shell.ServerCoding == "" ||
                shell.WebCoding == "")
            {
                success = false;
                MessageBox.Show(
                    this,
                    StrRes.GetString("StrPleaseFillOutTheProjectWith*", "Please fill out the project with *"),
                    MessageBoxType.Error);
            }
            return(success);
        }
Пример #29
0
 /// <summary>
 /// <para>Checks for the right number of elements in object array.</para>
 /// <para>Throws ArgumentCountException if number of elements in args is less than minNumber or more than maxNumber</para>
 /// </summary>
 /// <param name="args">Array of objects to check</param>
 /// <param name="minNumber">Minimal number of elements expected in <paramref name="args"/> (may be null if no check)</param>
 /// <param name="maxNumber">Maximal number of elements expected in <paramref name="args"/> (may be null if no check)</param>
 public void CheckForNumberOfArguments(ref object[] args, int?minNumber, int?maxNumber)
 {
     if (minNumber != null)
     {
         if (args.Length < minNumber)
         {
             throw new ArgumentCountException(
                       String.Format(StrRes.GetString(StrRes.STR_MISSING_ARGUMENT), functionName, minNumber)
                       );
         }
     }
     if (maxNumber != null)
     {
         if (args.Length > maxNumber)
         {
             throw new ArgumentCountException(
                       String.Format(StrRes.GetString(StrRes.STR_TO_MUCH_ARGUMENTS), functionName, maxNumber)
                       );
         }
     }
 }
Пример #30
0
        public override object Execute(object[] args, ExecutionContext ctx)
        {
            int digits = 14;

            if (args.Length > 0)
            {
                digits = Convert.ToInt32(args[0]);
            }
            if (digits < 0)
            {
                throw new ArgumentRangeException(StrRes.GetString(StrRes.STR_MIN_0_DIGITS));
            }
            if (digits > 1000)
            {
                throw new ArgumentRangeException(StrRes.GetString(StrRes.STR_MAX_1000_DIGITS));
            }
            if (digits == 0)
            {
                return("3");
            }
            return(pi.Substring(0, digits + 2));
        }