Пример #1
0
        public static MvcHtmlString GetAuthorizerScripts(this HtmlHelper helper, BaseType libraryBase, CommonResources includedResources)
        {
            UrlHelper Urls = new UrlHelper(helper.ViewContext.RequestContext);
            List<TagBuilder> LibrarySupportingElements = new List<TagBuilder>();

            TagBuilder OpenIdLibrary = new TagBuilder("script");
            OpenIdLibrary.Attributes.Add(new KeyValuePair<string,string>( "type", "text/javascript"));

            switch(libraryBase)
            {
                case BaseType.Jquery:
                    OpenIdLibrary.Attributes.Add(new KeyValuePair<string, string>("src", Urls.RouteUrl("AuthorizationResources", new {resourceType = "Scripts", resourceName = "openid-jquery.js"})));
                    TagBuilder LanguageFile = new TagBuilder("script");
                    LanguageFile.Attributes.Add(new KeyValuePair<string, string>("type", "text/javascript"));
                    LanguageFile.Attributes.Add(new KeyValuePair<string, string>("src", Urls.RouteUrl("AuthorizationResources", new { resourceType = "Scripts", resourceName = "openid-en.js" })));

                    LibrarySupportingElements.Add(LanguageFile);
                    break;
                default:
                    throw new InvalidOperationException();
            }

            string RawResult = OpenIdLibrary.ToString(TagRenderMode.Normal);
            LibrarySupportingElements.ForEach(Lib => RawResult += Lib.ToString(TagRenderMode.Normal));
            return MvcHtmlString.Create(RawResult);
        }
Пример #2
0
		public BreakPointsPad()
		{
			var res = new CommonResources();
			res.InitializeComponent();
			
			Grid grid = (Grid)this.Control;
			ToolBar toolbar = ToolBarService.CreateToolBar(grid, this, "/SharpDevelop/Pads/BreakpointPad/Toolbar");
			grid.Children.Add(toolbar);
			
			this.control.listView.View = (GridView)res["breakpointsGridView"];
			this.control.listView.SetValue(GridViewColumnAutoSize.AutoWidthProperty, "35;50%;50%");
		}
Пример #3
0
		public LoadedModulesPad()
		{
			var res = new CommonResources();
			res.InitializeComponent();
			
			listView = new ListView();
			listView.View = (GridView)res["loadedModulesGridView"];
			listView.SetValue(GridViewColumnAutoSize.AutoWidthProperty, "50%;70;50%;35;120");
			
			WindowsDebugger.RefreshingPads += RefreshPad;
			RefreshPad();
		}
Пример #4
0
        /// <summary>
        /// Identifies the indices of points in a set which are on the outer convex hull of the set.
        /// </summary>
        /// <param name="points">List of points in the set.</param>
        /// <param name="indices">List of indices composing the triangulated surface of the convex hull.
        /// Each group of 3 indices represents a triangle on the surface of the hull.</param>
        public static void GetConvexHull(IList <Vector3> points, IList <int> indices)
        {
            var rawPoints  = CommonResources.GetVectorList();
            var rawIndices = CommonResources.GetIntList();

            rawPoints.AddRange(points);
            GetConvexHull(rawPoints, rawIndices);
            CommonResources.GiveBack(rawPoints);
            for (int i = 0; i < rawIndices.Count; i++)
            {
                indices.Add(rawIndices[i]);
            }
            CommonResources.GiveBack(rawIndices);
        }
Пример #5
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(txtMinutes.Text.Trim()))
            {
                MessageBox.Show("Please enter a positive integer", CommonResources.GetString("Caption_Console"),
                                MessageBoxButtons.OK);
                return;
            }

            sRestartMunites = int.Parse(txtMinutes.Text.Trim());
            sRebootMsg      = richTextBoxMsg.Text.Trim();

            Close();
        }
Пример #6
0
        public ActionResult VolumeList(KendoGridRequest request = null)
        {
            if (Request.HttpMethod.ToUpper() == "GET")
            {
                return(View());
            }

            // Fetch the data
            using (var context = new KendoGridDataContext(ExigoDAL.Sql()))
            {
                var results = context.Query(request, @"
                    SELECT 
	                    pv.PeriodID
                        ,p.StartDate
                        ,p.EndDate
                        ,p.PeriodDescription
                        ,pv.PaidRankID
                        ,PaidRankDescription = ''
                        ,pv.Volume1
                        ,pv.Volume2
                        ,pv.Volume3 
	
                    FROM
	                    PeriodVolumes pv	
	                    INNER JOIN Periods p
		                    ON p.PeriodID = pv.PeriodID
	                    INNER JOIN Ranks r 
		                    ON r.RankID = pv.PaidRankID

                    WHERE
	                    pv.CustomerID = @customerid
	                    AND pv.PeriodTypeID = @periodtypeid
	                    AND p.StartDate <= @startdate
                ", new
                {
                    customerid   = Identity.Current.CustomerID,
                    periodtypeid = PeriodTypes.Default,
                    startdate    = DateTime.Now.ToCST()
                });

                // get the translated paid rank description
                foreach (var item in results.Data)
                {
                    item.PaidRankDescription = CommonResources.Ranks(item.PaidRankID, CommonResourceFormat.Default);
                }

                return(results);
            }
        }
Пример #7
0
		public CallStackPad()
		{
			var res = new CommonResources();
			res.InitializeComponent();
			
			listView = new ListView();
			listView.View = (GridView)res["callstackGridView"];
			listView.MouseDoubleClick += listView_MouseDoubleClick;
			listView.SetValue(GridViewColumnAutoSize.AutoWidthProperty, "100%");
			
			listView.ContextMenu = CreateMenu();
			
			WindowsDebugger.RefreshingPads += RefreshPad;
			RefreshPad();
		}
Пример #8
0
        ///<summary>
        /// Constructs a new convex hull shape.
        /// The point set will be recentered on the local origin.
        ///</summary>
        ///<param name="vertices">Point set to use to construct the convex hull.</param>
        /// <param name="center">Computed center of the convex hull shape prior to recentering.</param>
        ///<exception cref="ArgumentException">Thrown when the point set is empty.</exception>
        public ConvexHullShape(IList <Vector3> vertices, out Vector3 center)
        {
            if (vertices.Count == 0)
            {
                throw new ArgumentException("Vertices list used to create a ConvexHullShape cannot be empty.");
            }

            var surfaceVertices = CommonResources.GetVectorList();

            center        = ComputeCenter(vertices, surfaceVertices);
            this.vertices = new RawList <Vector3>(surfaceVertices);
            CommonResources.GiveBack(surfaceVertices);

            OnShapeChanged();
        }
Пример #9
0
		public LocalVarPad()
		{
			var res = new CommonResources();
			res.InitializeComponent();
			
			tree = new SharpTreeView();
			tree.Root = new SharpTreeNode();
			tree.ShowRoot = false;
			tree.View = (GridView)res["variableGridView"];
			tree.ItemContainerStyle = (Style)res["itemContainerStyle"];
			tree.SetValue(GridViewColumnAutoSize.AutoWidthProperty, "50%;25%;25%");
			
			WindowsDebugger.RefreshingPads += RefreshPad;
			RefreshPad();
		}
Пример #10
0
        public LocalVarPad()
        {
            var res = new CommonResources();

            res.InitializeComponent();

            tree                    = new SharpTreeView();
            tree.Root               = new SharpTreeNode();
            tree.ShowRoot           = false;
            tree.View               = (GridView)res["variableGridView"];
            tree.ItemContainerStyle = (Style)res["itemContainerStyle"];
            tree.SetValue(GridViewColumnAutoSize.AutoWidthProperty, "50%;25%;25%");

            WindowsDebugger.RefreshingPads += RefreshPad;
            RefreshPad();
        }
Пример #11
0
        private LevelDataDictionary <RigidAnalysis> GenerateRigidAnalyses()
        {
            var analyses = new LevelDataDictionary <RigidAnalysis>();

            foreach (BuildingLevelLateral2 level in _lateralLevels)
            {
                IEnumerable <AnalyticalWallLateral> wallsAtLevel = _lateralWallList.Where(w => w.TopLevel.Equals(level.Level));

                List <LateralLevelForce> forcesAtLevel = _elf.AppliedForces[level.Level];

                analyses.Add(new RigidAnalysis(level, wallsAtLevel, forcesAtLevel, CommonResources.ASCE7SeismicELFLoadCases(),
                                               _serializedModel.SeismicParameters.SystemParameters.Cd));
            }

            return(analyses);
        }
Пример #12
0
        // For more information on Bundling, visit http://go.microsoft.com/fwlink/?LinkId=254725
        public static void RegisterBundles(BundleCollection bundles)
        {
            var kendoResources = new KendoResources();

            var commonResources = new CommonResources();

            string[] defaultScripts = commonResources.GetCommonScriptResources().Resources
                                      .Concat(kendoResources.GetScriptsResources().Resources)
                                      .Concat(kendoResources.GetResourceScriptsResources(new Culture[] { Culture.Default, Culture.DE, Culture.ES, Culture.RU }).Resources)
                                      .Concat(kendoResources.GetCommonScriptResources().Resources)
                                      .ToArray();
            bundles.Add(new ScriptBundle(DefaultScripts).Include(defaultScripts));

            bundles.Add(new ScriptBundle(BaseStyles)
                        .Include("~/Content/Site.css"));
        }
Пример #13
0
        static void ValidateDeviceAuthenticationKey(string key, string paramName)
        {
            if (key != null)
            {
                int keyLength;
                if (!Utils.IsValidBase64(key, out keyLength))
                {
                    throw new ArgumentException(CommonResources.GetString(Resources.StringIsNotBase64, key), paramName);
                }

                if (keyLength < SecurityConstants.MinKeyLengthInBytes || keyLength > SecurityConstants.MaxKeyLengthInBytes)
                {
                    throw new ArgumentException(CommonResources.GetString(Resources.DeviceKeyLengthInvalid, SecurityConstants.MinKeyLengthInBytes, SecurityConstants.MaxKeyLengthInBytes));
                }
            }
        }
Пример #14
0
    public void EndOfGame()
    {
        var score   = _points / 10;
        var success = !(score < 6);

        if (success)
        {
            ProgressManager.Instance.Reward(CommonResources.Building.EbuTalib, score * 50);
            if (score == 10)
            {
                ProgressManager.Instance.UnlockAchievement(CommonResources.Extras(CommonResources.Building.EbuTalib), 250);
            }
        }

        Invoke("Back", 2);
    }
Пример #15
0
        /// <summary>
        /// Identifies the points on the surface of hull.
        /// </summary>
        /// <param name="points">List of points in the set.</param>
        /// <param name="outputTriangleIndices">List of indices into the input point set composing the triangulated surface of the convex hull.
        /// Each group of 3 indices represents a triangle on the surface of the hull.</param>
        /// <param name="outputSurfacePoints">Unique points on the surface of the convex hull.</param>
        public static void GetConvexHull(IList <Vector3> points, IList <int> outputTriangleIndices,
                                         IList <Vector3> outputSurfacePoints)
        {
            RawList <Vector3> rawPoints  = CommonResources.GetVectorList();
            RawList <int>     rawIndices = CommonResources.GetIntList();

            rawPoints.AddRange(points);
            GetConvexHull(rawPoints, rawIndices, outputSurfacePoints);
            CommonResources.GiveBack(rawPoints);
            for (int i = 0; i < rawIndices.Count; i++)
            {
                outputTriangleIndices.Add(rawIndices[i]);
            }

            CommonResources.GiveBack(rawIndices);
        }
        protected override void UpdateContainedPairs(float dt)
        {
            var         overlappedElements = CommonResources.GetIntList();
            BoundingBox localBoundingBox;

            System.Numerics.Vector3 sweep;
            Vector3Ex.Multiply(ref mobileMesh.entity.linearVelocity, dt, out sweep);
            mobileMesh.Shape.GetSweptLocalBoundingBox(ref mobileMesh.worldTransform, ref mesh.worldTransform, ref sweep, out localBoundingBox);
            mesh.Shape.TriangleMesh.Tree.GetOverlaps(localBoundingBox, overlappedElements);
            for (int i = 0; i < overlappedElements.Count; i++)
            {
                TryToAdd(overlappedElements.Elements[i]);
            }

            CommonResources.GiveBack(overlappedElements);
        }
Пример #17
0
        public CallStackPad()
        {
            var res = new CommonResources();

            res.InitializeComponent();

            listView                   = new ListView();
            listView.View              = (GridView)res["callstackGridView"];
            listView.MouseDoubleClick += listView_MouseDoubleClick;
            listView.SetValue(GridViewColumnAutoSize.AutoWidthProperty, "100%");

            listView.ContextMenu = CreateMenu();

            WindowsDebugger.RefreshingPads += RefreshPad;
            RefreshPad();
        }
Пример #18
0
        private void On_MenuClick(object sender, EventArgs args)
        {
            MenuItem mi = sender as MenuItem;

            switch (mi.Text.Trim())
            {
            case "New &User...":
            case "New &Group...":
                CreateDlg();
                break;

            case "&Add to Group...":
                ShowLUGPropertiesDlg();
                break;

            case "&Set Password...":
                SetPasswordDlg();
                break;

            case "&Rename...":
                ShowRenameDlg();
                break;

            case "&Properties...":
                ShowLUGPropertiesDlg();
                break;

            case "&Delete":
                DeleteDlg();
                break;

            case "&Refresh":
                treeNode.IsModified = true;
                treeNode.sc.ShowControl(treeNode);
                break;

            case "&Help":
                ProcessStartInfo psi = new ProcessStartInfo();
                psi.UseShellExecute = true;
                psi.FileName        = CommonResources.GetString("LAC_Help");
                psi.Verb            = "open";
                psi.WindowStyle     = ProcessWindowStyle.Normal;
                Process.Start(psi);
                break;
            }
        }
Пример #19
0
		public ThreadsPad()
		{
			var res = new CommonResources();
			res.InitializeComponent();
			
			ContextMenu contextMenu = new ContextMenu();
			contextMenu.Opened += FillContextMenuStrip;
			
			listView = new ListView();
			listView.View = (GridView)res["threadsGridView"];
			listView.ContextMenu = contextMenu;
			listView.MouseDoubleClick += listView_MouseDoubleClick;
			listView.SetValue(GridViewColumnAutoSize.AutoWidthProperty, "70;100%;75;75");
			
			WindowsDebugger.RefreshingPads += RefreshPad;
			RefreshPad();
		}
Пример #20
0
        /// <summary>
        /// Gets the language's description from the Languages global resource file
        /// </summary>
        public string GetLanguageDescription()
        {
            var result = this.LanguageDescription;

            try
            {
                var resourceValue = CommonResources.Languages(this.LanguageID);
                if (resourceValue != null)
                {
                    result = (string)resourceValue;
                    this.LanguageDescription = result;
                }
            }
            catch { }

            return(result);
        }
Пример #21
0
        /// <summary>
        /// Identifies the points on the surface of hull.
        /// </summary>
        /// <param name="points">List of points in the set.</param>
        /// <param name="outputTriangleIndices">List of indices into the input point set composing the triangulated surface of the convex hull.
        /// Each group of 3 indices represents a triangle on the surface of the hull.</param>
        /// <param name="outputSurfacePoints">Unique points on the surface of the convex hull.</param>
        public static void GetConvexHull(RawList <Vector3> points, RawList <int> outputTriangleIndices, IList <Vector3> outputSurfacePoints)
        {
            GetConvexHull(points, outputTriangleIndices);

            var alreadyContainedIndices = CommonResources.GetIntSet();

            for (int i = outputTriangleIndices.Count - 1; i >= 0; i--)
            {
                int index = outputTriangleIndices[i];
                if (alreadyContainedIndices.Add(index))
                {
                    outputSurfacePoints.Add(points[index]);
                }
            }

            CommonResources.GiveBack(alreadyContainedIndices);
        }
Пример #22
0
        /// <summary>
        /// Handles the prev button
        /// </summary>
        private void btnPrev_Click(object sender, EventArgs e)
        {
            if (_eventsListView == null ||
                _eventsListView.Items.Count == 0 ||
                _eventsListView.SelectedItems.Count != 1 ||
                !btnPrev.Enabled)
            {
                return;
            }

            int iEntry = _eventsListView.SelectedItems[0].Index;

            if (iEntry == 0)
            {
                DialogResult dlg = MessageBox.Show(this, "You have reached the beginning of the Event log. Do you want to continue from the end?",
                                                   CommonResources.GetString("Caption_Console"), MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                if (dlg == DialogResult.Yes)
                {
                    iEntry = _eventsListView.Items.Count;
                    btnPrev.Focus();
                }
                else
                {
                    btnPrev.Focus();
                    return;
                }
            }

            if (iEntry != 0)
            {
                // bump the count
                iEntry--;
            }

            // change the selection
            _eventsListView.SelectedItems[0].Selected = false;
            _eventsListView.Items[iEntry].Selected    = true;

            // scroll into view if necessary
            ScrollIntoView(iEntry);

            // update the button state
            SetButtonState();

            LoadData();
        }
Пример #23
0
        public override bool OnWizardFinish()
        {
            string           filterquery = string.Format("(&(objectClass=user)(name={0}))", this._userAddDlg.userInfo.fullName);
            List <LdapEntry> ldapEntries = null;

            string[] attrList = new string[]
            {
                "objectClass", null
            };

            int ret = _dirnode.LdapContext.ListChildEntriesSynchronous(
                _dirnode.DistinguishedName,
                Likewise.LMC.LDAP.Interop.LdapAPI.LDAPSCOPE.ONE_LEVEL,
                filterquery,
                attrList,
                false,
                out ldapEntries);

            if (ldapEntries != null && ldapEntries.Count != 0)
            {
                string sMsg = string.Format("LAC cannot create the new user object becuase the name {0} is already in use.\n" +
                                            "Select another name, and then try again", this._userAddDlg.userInfo.fullName);
                MessageBox.Show(this, sMsg, CommonResources.GetString("Caption_Console"),
                                MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return(false);
            }

            if (_userAddDlg.userInfo.passWord.Equals(string.Empty) || _userAddDlg.userInfo.retypedpassWord.Equals(string.Empty) || _userAddDlg.userInfo.passWord.Length < _userAddDlg.userInfo.MinPasswordLength)
            {
                string sMsg = string.Format(
                    "LAC cannot create the object {0} because:\n" +
                    "Unable to update the password.The value provided for " +
                    "the new password does not meet the length, complexity, or\n" +
                    "history requirement of the domain.",
                    _userAddDlg.userInfo.fullName);
                MessageBox.Show(
                    sMsg,
                    CommonResources.GetString("Caption_Console"),
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error);
                return(false);
            }
            _userAddDlg.userInfo.commit = true;
            return(base.OnWizardFinish());
        }
Пример #24
0
        private void btnClearEvtlog_Click(object sender, EventArgs e)
        {
            if (_plugin == null)
            {
                return;
            }

            UInt32 ret;

            string sMsg = string.Format("Are you sure do you want to clear the EventLog database?\n" +
                                        "\ni. Select on 'Yes' will clear the entire EventLog database." +
                                        "\nii. Select on 'No' clears all the records of the Log {0}", _parentPage.TreeNode.Text);

            DialogResult dlg = MessageBox.Show(this,
                                               sMsg,
                                               CommonResources.GetString("Caption_Console"),
                                               MessageBoxButtons.YesNoCancel,
                                               MessageBoxIcon.Question,
                                               MessageBoxDefaultButton.Button3);

            if (dlg == DialogResult.Yes)
            {
                ret = EventAPI.ClearEventLog(this._plugin.eventLogHandle.Handle);
                if (ret != 0)
                {
                    Logger.Log(string.Format("Unable to clear the events log database"));
                    return;
                }
                ClearListView();
            }
            else if (dlg == DialogResult.No)
            {
                ret = EventAPI.DeleteFromEventLog(this._plugin.eventLogHandle.Handle, string.Format("(EventTableCategoryId = '{0}')", _parentPage.TreeNode.Text));
                if (ret != 0)
                {
                    Logger.Log(string.Format("Unable to delete the events for the current log {0}", _parentPage.TreeNode.Text));
                    return;
                }
                ClearListView();
            }
            else
            {
                return;
            }
        }
Пример #25
0
        ///<summary>
        /// Tests a ray against the triangle mesh.
        ///</summary>
        ///<param name="ray">Ray to test against the mesh.</param>
        /// <param name="maximumLength">Maximum length of the ray in units of the ray direction's length.</param>
        /// <param name="sidedness">Sidedness to apply to the mesh for the ray cast.</param>
        ///<param name="hits">Hit data for the ray, if any.</param>
        ///<returns>Whether or not the ray hit the mesh.</returns>
        public bool RayCast(Ray ray, float maximumLength, TriangleSidedness sidedness, IList <RayHit> hits)
        {
            var hitElements = CommonResources.GetIntList();

            tree.GetOverlaps(ray, maximumLength, hitElements);
            for (int i = 0; i < hitElements.Count; i++)
            {
                Vector3 v1, v2, v3;
                data.GetTriangle(hitElements[i], out v1, out v2, out v3);
                RayHit hit;
                if (Toolbox.FindRayTriangleIntersection(ref ray, maximumLength, sidedness, ref v1, ref v2, ref v3, out hit))
                {
                    hits.Add(hit);
                }
            }
            CommonResources.GiveBack(hitElements);
            return(hits.Count > 0);
        }
        /// <summary>
        /// Adds the new entry in the listbox if it is not exists
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (bIsInt)
            {
                string value = txtAttrValue.Text.Trim();
                if ((value.Contains("-") && !value.StartsWith("-")) || !regNum.IsMatch(value))
                {
                    MessageBox.Show(this,
                                    "The value entered can contain only digits between 0 and 9.\nIf a negative value is desired a minus sign can be placed \nas the first character.",
                                    CommonResources.GetString("Caption_Console"), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
            }

            ListViewItem lviArr = null;

            if (!txtAttrValue.Text.ToString().Trim().Equals(string.Empty))
            {
                for (int i = 0; i < listViewAttrValues.Items.Count; i++)
                {
                    if (listViewAttrValues.Items[i].Text.Trim().Equals(txtAttrValue.Text.ToString().Trim()))
                    {
                        DialogResult dlg = MessageBox.Show(
                            this,
                            "This value already exists in the list. Do you want to add it anyway?",
                            CommonResources.GetString("Caption_Console"),
                            MessageBoxButtons.OKCancel,
                            MessageBoxIcon.Asterisk);
                        if (dlg == DialogResult.OK)
                        {
                            break;
                        }
                        else
                        {
                            return;
                        }
                    }
                }
                string[] values = { txtAttrValue.Text.ToString().Trim() };
                lviArr = new ListViewItem(values);
                this.listViewAttrValues.Items.Add(lviArr);
            }
            txtAttrValue.Text = "";
        }
Пример #27
0
        /// <summary>
        /// Validate the data
        /// </summary>
        /// <returns></returns>
        private bool ValidateData()
        {
            string value = this.txtAttrValue.Text.Trim();

            if (value.Trim().Equals("<not set>"))
            {
                return(true);
            }

            if (this.Text.Trim().Equals("Large Integer Attribute Editor"))
            {
                if (value.Length > 19 || value.Length == 0)
                {
                    string sMsg =
                        "The value entered can contain only digits between 0 and 9.\n " +
                        "If a negative value is desired a minus sign can be placed\n " +
                        "as the first character and value should not exceed more than 19 characters";
                    MessageBox.Show(
                        this,
                        sMsg,
                        CommonResources.GetString("Caption_Console"),
                        MessageBoxButtons.OK,
                        MessageBoxIcon.Warning);
                    return(false);
                }
            }
            else if (value.Length > 10 || value.Length == 0)
            {
                MessageBox.Show(this,
                                "The value entered can contain only digits between 0 and 9.\nIf a negative value is desired a minus sign can be placed \nas the first character and value should not exceed more than 10 characters",
                                CommonResources.GetString("Caption_Console"), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return(false);
            }

            if ((value.Contains("-") && !value.StartsWith("-")) || !regNum.IsMatch(value))
            {
                MessageBox.Show(this,
                                "The value entered can contain only digits between 0 and 9.\nIf a negative value is desired a minus sign can be placed \nas the first character.",
                                CommonResources.GetString("Caption_Console"), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return(false);
            }

            return(true);
        }
Пример #28
0
        /// <summary>
        /// Computes and applies a convex shape description for this MinkowskiSumShape.
        /// </summary>
        /// <returns>Description required to define a convex shape.</returns>
        public void UpdateConvexShapeInfo()
        {
            //Compute the volume distribution.
            RawList <Vector3> samples = CommonResources.GetVectorList();

            if (samples.Capacity < InertiaHelper.SampleDirections.Length)
            {
                samples.Capacity = InertiaHelper.SampleDirections.Length;
            }

            samples.Count = InertiaHelper.SampleDirections.Length;
            for (int i = 0; i < InertiaHelper.SampleDirections.Length; ++i)
            {
                GetLocalExtremePoint(InertiaHelper.SampleDirections[i], out samples.Elements[i]);
            }

            RawList <int> triangles = CommonResources.GetIntList();

            ConvexHullHelper.GetConvexHull(samples, triangles);

            float   volume;
            Vector3 center;

            InertiaHelper.ComputeShapeDistribution(samples, triangles, out center, out volume, out volumeDistribution);
            Volume = volume;

            //Recenter the shape.
            localOffset = -center;
            CommonResources.GiveBack(samples);
            CommonResources.GiveBack(triangles);

            //Compute the radii.
            float minRadius = 0, maxRadius = 0;

            for (int i = 0; i < Shapes.Count; i++)
            {
                minRadius += Shapes.WrappedList.Elements[i].CollisionShape.MinimumRadius;
                maxRadius += Shapes.WrappedList.Elements[i].CollisionShape.MaximumRadius;
            }

            MinimumRadius = minRadius + collisionMargin;
            MaximumRadius = maxRadius + collisionMargin;
        }
Пример #29
0
        ///<summary>
        /// Constructs a new convex hull shape.
        /// The point set will be recentered on the local origin.
        ///</summary>
        ///<param name="vertices">Point set to use to construct the convex hull.</param>
        /// <param name="center">Computed center of the convex hull shape prior to recentering.</param>
        ///<exception cref="ArgumentException">Thrown when the point set is empty.</exception>
        public ConvexHullShape(IList <Vector3> vertices, out Vector3 center)
        {
            if (vertices.Count == 0)
            {
                throw new ArgumentException("Vertices list used to create a ConvexHullShape cannot be empty.");
            }

            var surfaceVertices     = CommonResources.GetVectorList();
            var hullTriangleIndices = CommonResources.GetIntList();

            UpdateConvexShapeInfo(ComputeDescription(vertices, collisionMargin, out center, hullTriangleIndices, surfaceVertices));
            this.vertices = surfaceVertices.ToArray();

            CommonResources.GiveBack(hullTriangleIndices);
            CommonResources.GiveBack(surfaceVertices);

            unexpandedMaximumRadius = MaximumRadius - collisionMargin;
            unexpandedMinimumRadius = MinimumRadius - collisionMargin;
        }
Пример #30
0
        public TextChange(
            int oldPosition,
            int oldLength,
            ITextBuffer oldBuffer,
            int newPosition,
            int newLength,
            ITextBuffer newBuffer)
            : this()
        {
            if (oldBuffer == null)
            {
                throw new ArgumentNullException(nameof(oldBuffer));
            }

            if (newBuffer == null)
            {
                throw new ArgumentNullException(nameof(newBuffer));
            }

            if (oldPosition < 0)
            {
                throw new ArgumentOutOfRangeException(nameof(oldPosition), CommonResources.FormatArgument_Must_Be_GreaterThanOrEqualTo(0));
            }
            if (newPosition < 0)
            {
                throw new ArgumentOutOfRangeException(nameof(newPosition), CommonResources.FormatArgument_Must_Be_GreaterThanOrEqualTo(0));
            }
            if (oldLength < 0)
            {
                throw new ArgumentOutOfRangeException(nameof(oldLength), CommonResources.FormatArgument_Must_Be_GreaterThanOrEqualTo(0));
            }
            if (newLength < 0)
            {
                throw new ArgumentOutOfRangeException(nameof(newLength), CommonResources.FormatArgument_Must_Be_GreaterThanOrEqualTo(0));
            }

            OldPosition = oldPosition;
            NewPosition = newPosition;
            OldLength   = oldLength;
            NewLength   = newLength;
            NewBuffer   = newBuffer;
            OldBuffer   = oldBuffer;
        }
Пример #31
0
 public ApiActionResult Create(CommonResourcesCreateModel model)
 {
     try
     {
         CommonResources obj = new CommonResources();
         obj = _mapper.Map <CommonResources>(model);
         _dbConfigContext.CommonResources.Add(obj);
         var flag = _dbConfigContext.SaveChanges();
         if (flag != 0)
         {
             return(ApiActionResult.Success());
         }
         return(ApiActionResult.Failed("Created Failed!!"));
     }
     catch (Exception ex)
     {
         return(ApiActionResult.Failed(ex.Message));
     }
 }
Пример #32
0
 public BaseResponse <bool> Create(CommonResourceCreateModel model)
 {
     try
     {
         if (model != null && !string.IsNullOrEmpty(model.ResourceKey) && !string.IsNullOrEmpty(model.ResourceValue))
         {
             var entity = new CommonResources();
             entity.InjectFrom(model);
             _commonContext.CommonResources.Add(entity);
             _commonContext.SaveChanges();
             return(BaseResponse <bool> .Success(true));
         }
         return(BaseResponse <bool> .BadRequest());
     }
     catch (Exception ex)
     {
         return(BaseResponse <bool> .InternalServerError(ex));
     }
 }
Пример #33
0
 private void btnOk_Click(object sender, EventArgs e)
 {
     Logger.Log(
         "newparent DN is " + moveInfo.newParentDn,
         Logger.ldapLogLevel);
     if (moveInfo.newParentDn.Equals("", StringComparison.InvariantCultureIgnoreCase))
     {
         MessageBox.Show(
             this,
             "Please select a location to move this object, or click \"Cancel\" to cancel the move operation.",
             CommonResources.GetString("Caption_Console"),
             MessageBoxButtons.OK);
     }
     else
     {
         this.DialogResult = DialogResult.OK;
         this.Close();
     }
 }
Пример #34
0
 /// <summary>
 /// Gives the specified attribute value
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnOk_Click_1(object sender, EventArgs e)
 {
     if (txtAttrValue.Text.Trim() == "")
     {
         MessageBox.Show(
             this,
             "Value can not be empty",
             CommonResources.GetString("Caption_Console"),
             MessageBoxButtons.OK,
             MessageBoxIcon.Asterisk);
         return;
     }
     else
     {
         stringAttrValue   = txtAttrValue.Text;
         this.DialogResult = DialogResult.OK;
         this.Close();
     }
 }
Пример #35
0
    /// <summary>
    /// Gets the language's description from the Languages global resource file
    /// </summary>
    public string GetLanguageDescription()
    {
        var result = this.LanguageDescription;
        var x      = System.Globalization.CultureInfo.CurrentUICulture;
        var y      = System.Globalization.CultureInfo.CurrentCulture;

        try
        {
            var resourceValue = CommonResources.Languages(this.LanguageID);
            if (resourceValue != null)
            {
                result = (string)resourceValue;
                this.LanguageDescription = result;
            }
        }
        catch { }

        return(result);
    }
Пример #36
0
        internal AmqpIoTConnection(AmqpTransportSettings amqpTransportSettings, string hostName, bool disableServerCertificateValidation)
        {
            _amqpTransportSettings = amqpTransportSettings;

            _amqpSettings = new AmqpSettings();
            var amqpTransportProvider = new AmqpTransportProvider();

            amqpTransportProvider.Versions.Add(amqpVersion_1_0_0);
            _amqpSettings.TransportProviders.Add(amqpTransportProvider);

            _amqpConnectionSettings = new AmqpConnectionSettings()
            {
                MaxFrameSize = AmqpConstants.DefaultMaxFrameSize,
                ContainerId  = CommonResources.GetNewStringGuid(),
                HostName     = hostName
            };

            _amqpIoTTransport = new AmqpIoTTransport(_amqpSettings, _amqpTransportSettings, hostName, disableServerCertificateValidation);
        }