text
stringlengths
0
30.5k
title
stringclasses
1 value
embeddings
listlengths
768
768
} } } /// <id guid="08e034e7-5872-4a31-a771-84cac1dcd53d" /> /// <owner alias="MarkWal"> /// </owner> [SharePointPermission(SecurityAction.Demand, ObjectModel = true)] protected override void OnPreRender(System.EventArgs e) { SiteMapDataS...
[ -0.26583245396614075, -0.39232707023620605, 0.35314124822616577, -0.06293625384569168, 0.6963719129562378, -0.3035610616207123, 0.5230224132537842, 0.021108634769916534, -0.06663540750741959, -0.7039122581481934, -0.5521319508552551, 0.6300789713859558, -0.34945592284202576, 0.450158774852...
SiteMapDataSource; SiteMapProvider provider = (dataSource != null) ? dataSource.Provider : null; if (useCompactMenus && dataSource != null && provider != null) { showStartingNode = dataSource.ShowStartingNode; SiteMapNodeCollection rootChildNodes = p...
[ -0.35288554430007935, -0.3497457504272461, 0.4618716835975647, 0.0288727805018425, 0.28493717312812805, 0.10519197583198547, 0.47312143445014954, -0.030001144856214523, 0.08438640087842941, -0.8889015316963196, -0.4122357666492462, 0.08977385610342026, -0.058069318532943726, 0.287072151899...
if (provider.CurrentNode.Equals(provider.RootNode)) { //** Store original site map for future use in compacting menus **// if (originalSiteMap == null) {
[ 0.052337512373924255, -0.17602819204330444, 0.5872724056243896, -0.10640104860067368, 0.5695988535881042, -0.16037972271442413, 0.1660984605550766, 0.20002345740795135, -0.12637610733509064, -1.0204657316207886, -0.20510169863700867, 0.2993128299713135, -0.1373450607061386, 0.4212418198585...
//Store original SiteMapXML for future adjustments: XmlDocument newSiteMapDoc = new XmlDocument(); newSiteMapDoc.LoadXml("<?xml version='1.0' ?>"
[ 0.3649231791496277, -0.19365710020065308, 0.8493343591690063, -0.16894924640655518, 0.10691694915294647, -0.3788231611251831, 0.05939985811710358, -0.0041973767802119255, -0.33847829699516296, -0.6961943507194519, -0.4923373758792877, 0.2364349216222763, -0.3868029713630676, 0.088372655212...
+ "<siteMapNode title='" + provider.RootNode.Title + "' url='" + provider.RootNode.Url + "' />"); foreach
[ 0.0678284540772438, 0.09787430614233017, 0.691918134689331, -0.5048410892486572, 0.3878606855869293, -0.10265318304300308, 0.3789628744125366, 0.03829210251569748, 0.15282410383224487, -0.7483476400375366, -0.860473096370697, 0.23475413024425507, -0.055076129734516144, 0.4870407283306122, ...
(SiteMapNode node in rootChildNodes) { XmlNode newNode = GetXmlSiteMapNode(newSiteMapDoc.DocumentElement, node); newSiteMapDoc.DocumentElement.AppendChild(newNode);
[ -0.18638259172439575, -0.18468959629535675, 0.7668485045433044, -0.1669783890247345, 0.02658209763467312, -0.2221287488937378, 0.429389625787735, -0.10009808093309402, -0.1431046426296234, -0.8139965534210205, -0.5924100875854492, 0.1533551812171936, -0.15740352869033813, 0.336523681879043...
//Create XML for all the child nodes for selected menu item: NavigateSiteMap(newNode, node); }
[ -0.4431948959827423, -0.22715432941913605, -0.034972891211509705, 0.17882922291755676, 0.4068549573421478, 0.45640671253204346, 0.18694059550762177, 0.28231334686279297, 0.23037287592887878, -1.2029696702957153, -0.3190126121044159, 0.2599422037601471, -0.14297039806842804, 0.1183184012770...
originalSiteMap = newSiteMapDoc.OuterXml; } //This is set to only display the child nodes of the root node on first view: this.StaticDisplayLevels = 1; }
[ 0.09159908443689346, -0.19531987607479095, 0.598547637462616, 0.11524433642625809, 0.2860659062862396, -0.17414076626300812, 0.2054971605539322, -0.012114484794437885, -0.3770100474357605, -0.8212695717811584, -0.043365973979234695, 0.3760956823825836, -0.27603012323379517, 0.2303304523229...
else { // //Adjust site map for this page //
[ 0.13380327820777893, 0.07206667214632034, 0.10975100845098495, -0.24288935959339142, 0.3159823417663574, -0.07659528404474258, 0.265373170375824, 0.3421163856983185, -0.01507160346955061, -0.6959434747695923, -0.20911048352718353, 0.6627298593521118, -0.09847813844680786, -0.21073465049266...
XmlDocument newSiteMapDoc = InitializeNewSiteMapXml(provider, rootChildNodes); //Clear the current default site map: this.DataSourceID = null; //Create the new site map data source
[ 0.12273810058832169, -0.10704220086336136, 0.7070382833480835, 0.04048113524913788, 0.012718801386654377, -0.4618516266345978, -0.09450960904359818, 0.13465408980846405, -0.18268057703971863, -0.785240113735199, -0.6646623015403748, 0.13539747893810272, -0.3222784399986267, 0.3090676069259...
XmlDataSource newSiteMap = new XmlDataSource(); newSiteMap.ID = "XmlDataSource1"; newSiteMap.EnableCaching = false; //Required to prevent redisplay of the previous menu //Add bindings for dynamic site map:
[ -0.026069490239024162, -0.32903236150741577, 0.4578133225440979, 0.03344026207923889, -0.2059778869152069, -0.2459930032491684, 0.09030444175004959, -0.2219569832086563, -0.2369983196258545, -0.6985578536987305, -0.46901223063468933, 0.3772194981575012, -0.45299047231674194, 0.011372547596...
MenuItemBindingCollection bindings = this.DataBindings; bindings.Clear(); MenuItemBinding binding = new MenuItemBinding(); binding.DataMember = "siteMapNode";
[ -0.17031823098659515, -0.329211562871933, 0.7016565203666687, -0.40335723757743835, 0.13256818056106567, -0.16000044345855713, 0.3011360466480255, -0.2223266214132309, -0.2725176215171814, -0.7145162224769592, -0.45671212673187256, 0.20352642238140106, -0.6172463297843933, 0.38506293296813...
binding.TextField = "title"; binding.Text = "title"; binding.NavigateUrlField = "url"; binding.NavigateUrl = "url"; binding.ValueField = "url";
[ -0.37427887320518494, 0.4715441167354584, 0.8241613507270813, -0.1311534196138382, -0.07971928268671036, -0.34852319955825806, 0.2181686908006668, -0.059171102941036224, 0.21529723703861237, -0.7062151432037354, -0.6580386757850647, 0.5789437890052795, -0.4995626211166382, 0.43849420547485...
binding.Value = "url"; bindings.Add(binding); //Bind menu to new site map: this.DataSource = newSiteMap;
[ 0.3126726448535919, 0.012339185923337936, 0.867682933807373, -0.03888925537467003, 0.0536813959479332, -0.283710777759552, 0.14354461431503296, -0.03727543354034424, -0.23587393760681152, -0.942746639251709, -0.45819157361984253, 0.054656028747558594, -0.6108596324920654, 0.538519799709320...
//Assign the newly created dynamic site map: ((XmlDataSource)this.DataSource).Data = newSiteMapDoc.OuterXml; /** this expression removes the root if initialized: **/ if (!showStartingNode)
[ 0.19301080703735352, -0.22343407571315765, 0.5093924403190613, -0.14632417261600494, -0.19863824546337128, -0.2790371775627136, 0.19853760302066803, 0.06519529968500137, -0.27365419268608093, -0.4074645936489105, -0.4164360761642456, 0.28828001022338867, -0.4068222641944885, 0.201708123087...
((XmlDataSource)this.DataSource).XPath = "/siteMapNode/siteMapNode"; /** Re-initialize menu data source with new site map: **/ this.DataBind(); /** Find depth of current node: **/ int depth
[ -0.3898000717163086, -0.3314434587955475, 0.6122473478317261, -0.1652170568704605, 0.3674536347389221, 0.05439862981438637, 0.07932550460100174, 0.1578885167837143, -0.07152065634727478, -0.8571398258209229, -0.40482956171035767, 0.3192199766635895, -0.027133340016007423, 0.159336447715759...
= 0; SiteMapNode currNode = provider.CurrentNode; do { depth++;
[ 0.049961306154727936, -0.40361765027046204, 0.731185257434845, -0.6310529708862305, 0.31117895245552063, -0.05598287656903267, 0.2259969264268875, 0.2735465168952942, 0.16257809102535248, -0.6392350792884827, -0.40411436557769775, 0.37255048751831055, -0.341509610414505, 0.5434756278991699...
currNode = currNode.ParentNode; } while (currNode != null); //Set the StaticDisplayLevels to match the current depth:
[ -0.36639055609703064, -0.3914373815059662, 0.3767286241054535, -0.22184590995311737, 0.12952736020088196, 0.1521279215812683, 0.19038617610931396, 0.0331861786544323, 0.004848264157772064, -0.3548097312450409, -0.09071756154298782, 0.59255051612854, -0.1163257583975792, 0.2802763283252716,...
if (depth >= this.StaticDisplayLevels) this.StaticDisplayLevels = depth; } } base.OnPreRender(e); // output some script to override the default menu flyout behaviour; this helps to avoid
[ 0.012065622955560684, -0.3345561921596527, 0.37008315324783325, -0.280015230178833, 0.543507993221283, -0.16371428966522217, 0.4485994279384613, -0.19076934456825256, 0.07288532704114914, -0.5235534906387329, -0.3430100083351135, 0.7795094847679138, -0.37951183319091797, 0.0757200717926025...
// intermittent "Operation Aborted" errors Page.ClientScript.RegisterStartupScript( typeof(MossMenu), "overrideMenu_HoverStatic", "if (typeof(overrideMenu_HoverStatic) == 'function' && typeof(Menu_HoverStatic) == 'function')\n" + "{\n"
[ -0.6675129532814026, -0.00906942319124937, 0.6000867486000061, -0.3295120298862457, 0.5544250011444092, 0.18181748688220978, 0.5232172608375549, -0.046357546001672745, -0.3460422158241272, -0.512050211429596, -0.0903945341706276, 0.5154919624328613, -0.24847742915153503, -0.083771899342536...
+ "_spBodyOnLoadFunctionNames.push('enableFlyoutsAfterDelay');\n" + "Menu_HoverStatic = overrideMenu_HoverStatic;\n" + "}\n", true); // output some script to avoid a known issue with SSL Termination
[ -0.0802241787314415, -0.24791893362998962, 0.8169096112251282, -0.4305408298969269, 0.22285263240337372, -0.19351613521575928, 0.4931074380874634, -0.34519800543785095, -0.015097561292350292, -0.5855194926261902, -0.46070852875709534, 0.4442359209060669, -0.3398308753967285, -0.03890689462...
and the ASP.NET // Menu implementation. http://support.microsoft.com/?id=910444 Page.ClientScript.RegisterStartupScript( typeof(MossMenu), "MenuHttpsWorkaround_" + this.ClientID, this.ClientID + "_Data.iframeUrl='/_layouts/images/blank.gif';", ...
[ -0.5357137322425842, -0.20295454561710358, 0.5880981087684631, -0.2877431809902191, 0.10825973749160767, 0.347447007894516, 0.11600643396377563, 0.05591285601258278, -0.42624735832214355, -0.6583394408226013, -0.6040295362472534, 0.6148202419281006, -0.42598798871040344, -0.086287163197994...
// adjust the fly-out indicator arrow direction for locale if not already set if (this.Orientation == System.Web.UI.WebControls.Orientation.Vertical && ((string.IsNullOrEmpty(this.StaticPopOutImageUrl) && this.StaticEnableDefaultPopOutImage) || (string.IsNullOrEmpty(this....
[ -0.17001070082187653, -0.19887131452560425, 0.8683245778083801, -0.36460092663764954, 0.3749954104423523, 0.3674789071083069, 0.4589043855667114, -0.1284303069114685, -0.023795505985617638, -0.41733500361442566, -0.45120152831077576, 0.42842552065849304, -0.40933579206466675, -0.1293427497...
SPWeb currentWeb = SPContext.Current.Web; if (currentWeb != null) { uint localeId = currentWeb.Language; bool isBidiWeb = SPUtility.IsRightToLeft(currentWeb, currentWeb.Language);
[ -0.43924829363822937, -0.3699284493923187, 0.8530845046043396, -0.39707624912261963, 0.34543514251708984, -0.22694912552833557, 0.2746204733848572, -0.13234002888202667, -0.5543144345283508, -0.5489628314971924, -0.3766668438911438, 0.030761048197746277, -0.6354711055755615, 0.562041044235...
string arrowUrl = "/_layouts/images/" + (isBidiWeb ? "largearrowleft.gif" : "largearrowright.gif"); if (string.IsNullOrEmpty(this.StaticPopOutImageUrl) && this.StaticEnableDefaultPopOutImage) { this.StaticPopOutImageUrl = arrowUrl;
[ -0.35301312804222107, -0.19930896162986755, 0.6622676253318787, -0.5684952735900879, -0.05728697031736374, 0.35917600989341736, 0.4955228567123413, -0.43997079133987427, -0.005291941575706005, -0.24292880296707153, -0.21500325202941895, 0.4379020929336548, -0.5140608549118042, 0.0072916508...
} if (string.IsNullOrEmpty(this.DynamicPopOutImageUrl) && this.DynamicEnableDefaultPopOutImage) { this.DynamicPopOutImageUrl = arrowUrl; }
[ -0.472525417804718, -0.5455753207206726, 0.6665276288986206, -0.4580008387565613, 0.15781833231449127, 0.4178394079208374, 0.4865366816520691, -0.23626454174518585, -0.15212440490722656, -0.15452533960342407, -0.2479625642299652, 0.5588995218276978, -0.42963069677352905, -0.011138243600726...
} } if (provider == null) { // if we're not attached to a SiteMapDataSource we'll just leave everything alone return;
[ 0.49845659732818604, -0.18950237333774567, 0.2978051006793976, -0.11817386746406555, 0.5484920740127563, -0.2851445972919464, 0.5624919533729553, 0.09624237567186356, 0.3307932913303375, -0.48140692710876465, -0.3590264618396759, 0.36269885301589966, -0.45192644000053406, 0.463633507490158...
} else if (this.customSelectionEnabled) { MenuItem selectedMenuItem = this.SelectedItem; SiteMapNode currentNode = provider.CurrentNode; // if no menu item is presently selected, we need to
[ 0.09960267692804337, -0.6430047750473022, 0.48653846979141235, 0.05379130318760872, 0.6630359888076782, -0.07946910709142685, -0.010020327754318714, 0.14944195747375488, -0.2943859398365021, -0.6412222385406494, -0.25347989797592163, 0.12432727962732315, -0.1904953420162201, 0.300109386444...
work our way up from the current // node until we can find a node in the menu item dictionary while (selectedMenuItem == null && currentNode != null) { this.menuItemDictionary.TryGetValue(currentNode.Url, out selectedMenuItem);
[ -0.20234714448451996, -0.5196433067321777, 0.6323680877685547, -0.0792241171002388, 0.5980026125907898, 0.16205766797065735, 0.21911346912384033, -0.12305065244436264, 0.021023185923695564, -0.6835289001464844, -0.2337494194507599, 0.5025889277458191, -0.15240678191184998, 0.29016777873039...
currentNode = currentNode.ParentNode; } if (this.selectStaticItemsOnly) { // only static items may be selected, keep moving up until we find
[ -0.2682981789112091, -0.7274624705314636, 0.5358025431632996, 0.030004752799868584, 0.3936086595058441, 0.054448772221803665, -0.0730997696518898, 0.026248931884765625, -0.34002435207366943, -0.6060665845870972, -0.13006560504436493, 0.12030313909053802, -0.2939075529575348, 0.591173529624...
an item // that falls within the static range while (selectedMenuItem != null && selectedMenuItem.Depth >= this.StaticDisplayLevels) { selectedMenuItem =
[ -0.09392066299915314, -0.5701309442520142, 0.22838841378688812, 0.09650049358606339, 0.344641774892807, 0.14657598733901978, 0.3082917332649231, -0.46203523874282837, 0.002708550775423646, -0.22034955024719238, -0.44188523292541504, 0.3733552098274231, -0.049682214856147766, 0.124334737658...
selectedMenuItem.Parent; } // if we found an item to select, go ahead and select (highlight) it if (selectedMenuItem != null && selectedMenuItem.Selectable) {
[ -0.17276233434677124, -0.709854006767273, -0.08869390934705734, 0.18079593777656555, 0.25427719950675964, 0.3059810996055603, -0.018682042136788368, -0.04780072346329689, -0.1015699952840805, -0.5104050040245056, -0.2723606824874878, 0.12492647767066956, -0.14406390488147736, 0.14918251335...
selectedMenuItem.Selected = true; } } } } private XmlDocument InitializeNewSiteMapXml(SiteMapProvider provider, SiteMapNodeCollection rootChildNodes)
[ -0.23217293620109558, -0.5703731775283813, 0.1854652762413025, 0.1133468747138977, 0.19949212670326233, -0.09451699256896973, 0.05688133090734482, -0.2100924551486969, 0.006700112018734217, -0.7132904529571533, -0.20586076378822327, 0.030466072261333466, -0.12655049562454224, 0.33278471231...
{ /** Find the level 1 ancestor node of the current node: **/ SiteMapNode levelOneAncestorOfSelectedNode = null; SiteMapNode currNode = provider.CurrentNode; do { levelOneAncestorOfSelectedNode = (currNode.ParentNode == null ?
[ -0.6554155945777893, -0.1317826360464096, 0.2677643597126007, -0.05011789873242378, 0.521337628364563, 0.06878215074539185, 0.3812422454357147, 0.29196906089782715, 0.0415591262280941, -0.8330596089363098, -0.055042535066604614, -0.18883055448532104, -0.16240385174751282, 0.524846076965332...
levelOneAncestorOfSelectedNode : currNode); currNode = currNode.ParentNode; } while (currNode != null); /** Initialize base SiteMapXML **/ XmlDocument newSiteMapDoc = new XmlDocument(); newSiteMapDoc.LoadXml(originalSiteMap);
[ -0.3008935749530792, -0.17659428715705872, 0.8853530883789062, -0.005025420803576708, 0.1514388769865036, -0.34790149331092834, 0.29514965415000916, 0.02465621754527092, -0.0802067369222641, -0.8473052978515625, -0.5134719610214233, 0.4234165847301483, -0.14506486058235168, 0.2925700247287...
/** Prune out the childern nodes that shouldn't display: **/ currNode = provider.CurrentNode; do { if (currNode.ParentNode != null) {
[ -0.15448541939258575, -0.2520919144153595, 0.36206310987472534, -0.21743619441986084, 0.3197888731956482, 0.4604562819004059, 0.31823036074638367, 0.2870207726955414, 0.0060094138607382774, -0.647075891494751, -0.22591151297092438, 0.37028399109840393, -0.16057202219963074, 0.4857836961746...
SiteMapNodeCollection currNodeSiblings = currNode.ParentNode.ChildNodes; foreach (SiteMapNode siblingNode in currNodeSiblings) { if (siblingNode.HasChildNodes)
[ -0.6553056836128235, -0.04809725657105446, 0.5370210409164429, -0.13271838426589966, 0.1163487508893013, 0.23980151116847992, 0.3061603009700775, 0.15819187462329865, -0.2139773666858673, -0.5612863302230835, -0.4033687114715576, -0.25074318051338196, 0.4234650731086731, 0.61277836561203, ...
{ if (provider.CurrentNode.Equals(siblingNode)) { //Remove all the childerns child nodes from display:
[ -0.40407124161720276, -0.27274882793426514, 0.4655747711658478, -0.0905207097530365, 0.4979041516780853, 0.36262962222099304, 0.16082753241062164, 0.41983702778816223, -0.10197751224040985, -0.6749693155288696, -0.026430724188685417, 0.06339404731988907, -0.31055858731269836, 0.63181251287...
SiteMapNodeCollection currNodesChildren = siblingNode.ChildNodes; foreach (SiteMapNode childNode in currNodesChildren)
[ -0.5175833702087402, 0.025581739842891693, 0.4425000250339508, -0.2022215574979782, 0.048666104674339294, 0.42158985137939453, 0.0814703032374382, 0.14138758182525635, -0.31658610701560974, -0.47669917345046997, -0.5955727696418762, -0.2307538092136383, 0.4612916111946106, 0.47938755154609...
{ XmlNode currentXmNode = GetCurrentXmlNode(newSiteMapDoc, childNode); DeleteChildNodes(currentXmNode);
[ -0.26768621802330017, -0.2907242774963379, 0.6245256066322327, 0.003091862890869379, 0.26634275913238525, -0.06483776867389679, 0.07041070610284805, 0.025722645223140717, -0.04612569883465767, -0.6101085543632507, -0.40754786133766174, 0.4707133173942566, -0.11846031248569489, 0.5218829512...
} } else if (!provider.CurrentNode.IsDescendantOf(siblingNode) && !levelOneAncestorOfSelectedNode.Equals(siblingNode))
[ -0.695701003074646, -0.3358342945575714, 0.4716646671295166, 0.012705044820904732, 0.40553370118141174, -0.10542327910661697, 0.28180572390556335, 0.01704772375524044, -0.10479459166526794, -0.6691488027572632, 0.1044732928276062, 0.3382774591445923, -0.07975300401449203, 0.244715869426727...
{ XmlNode currentXmNode = GetCurrentXmlNode(newSiteMapDoc, siblingNode); DeleteChildNodes(currentXmNode);
[ -0.42781704664230347, -0.34162425994873047, 0.572926938533783, -0.0040684049017727375, 0.08340807259082794, -0.14266373217105865, 0.22510261833667755, 0.1239735558629036, -0.14538897573947906, -0.5391823649406433, -0.2983745336532593, 0.452811598777771, -0.1435808539390564, 0.5361806750297...
} } } } currNode
[ -0.42844757437705994, -0.15216492116451263, 0.3010050654411316, -0.3677745759487152, -0.2743064761161804, 0.0719340443611145, 0.05936274304986, 0.26929956674575806, 0.08210279792547226, -0.37879329919815063, -0.05765208601951599, 0.7313069105148315, -0.3161216676235199, 0.5672780275344849,...
= currNode.ParentNode; } while (currNode != null); return newSiteMapDoc; } private XmlNode GetCurrentXmlNode(XmlDocument newSiteMapDoc, SiteMapNode node) { //Find this node in the original site map:
[ -0.1269676238298416, -0.23047737777233124, 0.4933820068836212, -0.15782380104064941, -0.014413527213037014, -0.14278538525104523, 0.1049274429678917, 0.24563123285770416, -0.1760910302400589, -0.7584024667739868, -0.41412317752838135, 0.17900803685188293, -0.22737374901771545, 0.4817269742...
XmlNode currentXmNode = newSiteMapDoc.DocumentElement.SelectSingleNode( "//siteMapNode[@url='" + node.Url + "']"); return currentXmNode; } private void DeleteChildNodes(XmlNode currentXmNode) {
[ -0.15304136276245117, -0.2179572433233261, 0.5802039504051208, -0.009664594195783138, 0.20691123604774475, -0.1661873608827591, 0.055394869297742844, -0.03987559676170349, -0.23931021988391876, -0.42488235235214233, -0.4228513538837433, 0.37349411845207214, -0.17449350655078888, 0.50493371...
if (currentXmNode != null && currentXmNode.HasChildNodes) { //Remove child nodes: XmlNodeList xmlNodes = currentXmNode.ChildNodes; int lastNodeIndex = xmlNodes.Count - 1; for (int i
[ -0.3868718445301056, -0.40385785698890686, 0.5783658027648926, -0.009609634056687355, 0.5400541424751282, -0.04483284801244736, -0.06937125325202942, -0.23646865785121918, -0.26177555322647095, -0.499463826417923, -0.3627767264842987, 0.19414973258972168, -0.09705863147974014, 0.3760433495...
= lastNodeIndex; i >= 0; i--) { currentXmNode.RemoveChild(xmlNodes[i]); } } } private XmlNode GetXmlSiteMapNode(XmlNode currentDocumentNode, SiteMapNode currentNode) {
[ -0.2917656898498535, -0.4909149408340454, 0.9505685567855835, -0.12554261088371277, 0.26088273525238037, -0.3426564633846283, -0.009250106289982796, -0.1445031613111496, -0.26954010128974915, -0.48250123858451843, -0.3326435089111328, 0.32073378562927246, -0.20018762350082397, 0.3466827869...
XmlElement newNode = currentDocumentNode.OwnerDocument.CreateElement("siteMapNode"); XmlAttribute newAttr = currentDocumentNode.OwnerDocument.CreateAttribute("title"); newAttr.InnerText = currentNode.Title; newNode.Attributes.Append(newAttr); newAttr = currentDocumentNo...
[ -0.2951366901397705, -0.26264524459838867, 0.7149783372879028, 0.07341478765010834, -0.13571250438690186, -0.006170755717903376, -0.25852152705192566, -0.09805361926555634, -0.06974673271179199, -0.5294142961502075, -0.759986162185669, 0.3072512745857239, -0.030662504956126213, 0.250732868...
return newNode; } private void NavigateSiteMap(XmlNode currentDocumentNode, SiteMapNode currentNode) { foreach (SiteMapNode node in currentNode.ChildNodes) { //Add this node to structure:
[ -0.3949408531188965, -0.1560511589050293, 0.590026319026947, -0.19389115273952484, 0.5596645474433899, -0.15210793912410736, 0.15265890955924988, 0.13768473267555237, -0.12419897317886353, -1.1919275522232056, -0.19655804336071014, 0.08088028430938721, -0.21522942185401917, 0.5800033211708...
XmlNode newNode = GetXmlSiteMapNode(currentDocumentNode, node); currentDocumentNode.AppendChild(newNode); if (node.HasChildNodes) { //Make a recursive call to add any child nodes:
[ -0.30963149666786194, -0.5076135396957397, 0.6755998134613037, -0.015697026625275612, 0.281676709651947, -0.08073478937149048, -0.0603502094745636, -0.16974392533302307, -0.26459407806396484, -0.6461292505264282, -0.35867229104042053, 0.18413569033145905, -0.18443062901496887, 0.3762039542...
NavigateSiteMap(newNode, node); } } } } [PermissionSet(SecurityAction.LinkDemand, Name = "FullTrust")] [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes")] public sealed class MossMenuDesigner : Me...
[ -0.9764376282691956, -0.14647293090820312, 0.671203076839447, 0.19409382343292236, 0.3171408176422119, 0.07613378763198853, 0.623573899269104, 0.11011894047260284, 0.28748205304145813, -0.8771645426750183, -0.3550702929496765, 0.39700713753700256, -0.3689887225627899, 0.10515440255403519, ...
try { dataBoundControl.DataBind(); } catch { base.DataBind(dataBoundControl);
[ 0.007169992662966251, -0.6827691197395325, 0.01527793612331152, -0.12204116582870483, 0.31835874915122986, -0.1773788034915924, 0.2275305986404419, -0.15026898682117462, 0.12834319472312927, -0.30981728434562683, -0.41798779368400574, 0.18017366528511047, -0.6033821105957031, -0.1519008129...
} } [PermissionSet(SecurityAction.Demand, Name = "FullTrust")] public override string GetDesignTimeHtml() { System.Web.UI.WebControls.Menu menu = (System.Web.UI.WebControls.Menu)ViewControl; int oldDisplayLevels = menu.MaximumDynamicDisplayLevels; str...
[ -0.11374471336603165, -0.34987449645996094, 0.41435375809669495, 0.016163330525159836, 0.5635748505592346, -0.2215183675289154, 0.543548047542572, -0.503010630607605, -0.02335456572473049, -0.6334580779075623, -0.3984590172767639, 0.6361715793609619, -0.4749637246131897, 0.3472563028335571...
{ menu.MaximumDynamicDisplayLevels = 0; // ASP.NET MenuDesigner has some dynamic/static item trick in design time // to show dynamic item in design time. We only want to show preview without //
[ -0.11102902144193649, -0.41900625824928284, 0.4262424409389496, 0.2759472727775574, -0.08282575756311417, -0.009229457005858421, 0.24129131436347961, -0.08811303228139877, -0.46529531478881836, -0.5213963985443115, -0.009939274750649929, 0.6145954728126526, -0.0618247352540493, -0.09434213...
dynamic menu items. designTimeHtml = base.GetDesignTimeHtml(); } catch (Exception e) { designTimeHtml = GetErrorDesignTimeHtml(e); }
[ -0.10738685727119446, -0.6814320683479309, 0.23688210546970367, -0.09672178328037262, 0.2534615397453308, 0.2460753172636032, 0.15012849867343903, -0.20173238217830658, -0.3116730749607086, -0.5388368964195251, -0.4337838888168335, 0.4990801215171814, -0.7222346663475037, 0.228912040591239...
finally { menu.MaximumDynamicDisplayLevels = oldDisplayLevels; } return designTimeHtml; } } } ```
[ -0.11284241825342178, -0.3163277804851532, 0.6677930355072021, 0.02828960306942463, 0.22525863349437714, -0.20730097591876984, 0.049485787749290466, -0.1929263025522232, -0.32177355885505676, -0.7084904313087463, -0.09865797311067581, 0.9069602489471436, -0.19868263602256775, 0.26333832740...
I'm working on a project that will be distributed with GNU autoconf/automake, and I have a set of bash scripts which call awk scripts. I would like the bash scripts to end up in the $PATH, but not the awk scripts. How should I insert these into the project? Should they be put in with other binaries? Also, is there a w...
[ 0.5261025428771973, 0.03936674818396568, -0.012947953306138515, 0.05206621438264847, -0.19925233721733093, -0.3344952166080475, 0.17249824106693268, -0.20248869061470032, -0.0006629587151110172, -0.8923202753067017, -0.000469252816401422, 0.552503228187561, -0.23104451596736908, -0.0005532...
(you can also use $(bindir)). Note: Dont forget that the first should be named name + dir (scripts -> scriptsdir) and the second should be name + \_DATA (scripts -> scripts\_DATA).
[ -0.18064139783382416, -0.17156414687633514, -0.031472984701395035, -0.2829779386520386, -0.016534380614757538, -0.14002978801727295, 0.27641376852989197, 0.03758101910352707, 0.2544660270214081, -0.8157732486724854, -0.04543239623308182, 0.5883801579475403, -0.3670024275779724, 0.054199561...
In C#.Net WPF During UserControl.Load -> What is the best way of showing a whirling circle / 'Loading' Indicator on the UserControl until it has finished gathering data and rendering it's contents? I generally would create a layout like this: ``` <Grid> <Grid x:Name="MainContent" IsEnabled="False"> ... </...
[ -0.07782413810491562, -0.13368895649909973, 0.6413816213607788, -0.23804593086242676, -0.2942400574684143, -0.2723107933998108, -0.07768547534942627, -0.10776901245117188, -0.3234870731830597, -0.8336287140846252, -0.15599940717220306, 0.45831507444381714, -0.006012445781379938, -0.1899784...
is what you were asking or if you wanted to know how to show an animation in the loading label. If it's the animation you're after, please update your question to be more specific.
[ 0.43505239486694336, -0.04972350224852562, 0.17980855703353882, 0.5333016514778137, 0.2586619257926941, 0.00043779858970083296, -0.36011484265327454, 0.5254223942756653, -0.37733274698257446, -0.5304368734359741, -0.24884925782680511, 0.17461922764778137, 0.09737043082714081, 0.05418041348...
I have the following XAML: ``` <TextBlock Text="{Binding ElementName=EditListBox, Path=SelectedItems.Count}" Margin="0,0,5,0"/> <TextBlock Text="items selected"> <TextBlock.Style> <Style TargetType="{x:Type TextBlock}"> <Style.Triggers> <DataTrigger Binding="{Binding ElementNam...
[ -0.06535239517688751, 0.20146718621253967, 0.5616599917411804, -0.08160927891731262, 0.10800768435001373, -0.024436142295598984, 0.025986364111304283, -0.5851497650146484, 0.18096773326396942, -0.743402898311615, 0.11943013966083527, 0.23926383256912231, -0.29295676946640015, 0.15044200420...
</Style.Triggers> </Style> </TextBlock.Style> </TextBlock> ``` The first text block happily changes with SelectedItems.Count, showing 0,1,2, etc. The datatrigger on the second block never seems to fire to change the text. Any thoughts? The DataTrigger is firing but the Text field for your second TextBloc...
[ 0.004525688476860523, 0.01308411080390215, 0.3698664605617523, -0.013864224776625633, -0.12653735280036926, -0.05977742001414299, 0.25230205059051514, -0.3425685465335846, -0.28858482837677, -0.7973688840866089, 0.013495010323822498, 0.5468162894248962, -0.3126677870750427, -0.179782867431...
it to set the Text to what you want. **Create this ValueConverter:** ``` public class CountToSelectedTextConverter : IValueConverter { #region IValueConverter Members public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { if ((int)value...
[ 0.25751009583473206, -0.504652202129364, 0.8275953531265259, -0.04153023660182953, -0.10420005023479462, -0.08185748010873795, 0.08376779407262802, -0.0012784189311787486, -0.04716745391488075, -0.6646683216094971, -0.23522478342056274, 0.3095971643924713, -0.4793865382671356, 0.2554755508...
parameter, System.Globalization.CultureInfo culture) { throw new NotImplementedException(); } #endregion } ``` **Add the namespace reference to your the assembly the converter is located:** ``` xmlns:local="clr-namespace:ValueConverterExample" ``` **Add the converter to your resources:** ``` ...
[ -0.105780228972435, -0.18876299262046814, 0.8191232085227966, -0.027990926057100296, -0.11031045764684677, 0.103230319917202, -0.0788021832704544, -0.23394809663295746, -0.21302057802677155, -0.8196433782577515, -0.2763819992542267, 0.3559177815914154, -0.4495975971221924, 0.21209952235221...
I'm looking to have a couple of plugins in a Flex project I'm working on. I know I can load a SWF using the SWFLoader, but I thought in Flex3 you can now have Runtime Shared Libraries or something. Does anyone have any good documentation on loading a plugin at runtime? Ideally I'd like to be able to load a plugin from ...
[ 0.6992241740226746, -0.19748076796531677, 0.19021129608154297, 0.10266263037919998, -0.35890862345695496, -0.3564503788948059, -0.06767302751541138, 0.06077757477760315, -0.6476987600326538, -0.7522881627082825, -0.0512838177382946, 0.5523392558097839, -0.3008977472782135, -0.0653076022863...
around longer. Modules are easier to create and use. I have used modules and had issues with modules failing to load (code needs to handle that case). I haven't tried RSLs yet. Here is some documentation on creating RSLs <http://labs.adobe.com/wiki/index.php/Flex_3:Feature_Introductions:Flex_3_RSLs>
[ 0.8832716941833496, -0.12410948425531387, 0.4681081175804138, -0.33163148164749146, -0.30698639154434204, -0.3800225555896759, 0.0410335473716259, -0.2583346366882324, -0.7638826370239258, -0.5330130457878113, -0.14535075426101685, 0.49838414788246155, -0.2371760606765747, -0.5517975091934...
What is the best python framework to create distributed applications? For example to build a P2P app. You could checkout [pyprocessing](http://pyprocessing.berlios.de/) which will be included in the standard library as of 2.6. It allows you to run tasks on multiple processes using an API similar to threading.
[ 0.2040492445230484, -0.1954006403684616, 0.1530444622039795, 0.3865819573402405, 0.10855147987604141, 0.07234536111354828, -0.0801173597574234, 0.0726601704955101, -0.5603975057601929, -0.5058653950691223, 0.0637323409318924, 0.11788702011108398, -0.37914568185806274, -0.15411964058876038,...
What are the best practices for using Java's `@Override` annotation and why? It seems like it would be overkill to mark every single overridden method with the `@Override` annotation. Are there certain programming situations that call for using the `@Override` and others that should never use the `@Override`? Use it ...
[ 0.30813923478126526, 0.07195775210857391, -0.25801488757133484, 0.21644148230552673, -0.20225639641284943, -0.4555617868900299, 0.46146366000175476, -0.23649589717388153, -0.058195408433675766, -0.3014437258243561, -0.02826124057173729, 0.5262289047241211, -0.299406498670578, -0.1140558347...
matching the parameters, you will be warned that you method does not actually override as you think it does. Secondly, it makes your code easier to understand because it is more obvious when methods are overwritten. Additionally, in Java 1.6 you can use it to mark when a method implements an interface for the same ben...
[ 0.2701612710952759, -0.13925346732139587, 0.06179650500416756, 0.009180198423564434, -0.3104216158390045, -0.2345540076494217, 0.3482215404510498, -0.30035874247550964, -0.16350282728672028, -0.5572509765625, 0.24110466241836548, 0.6012434363365173, -0.2730109691619873, -0.2564828395843506...
I'm using gvim on Windows. In my \_vimrc I've added: ``` set shell=powershell.exe set shellcmdflag=-c set shellpipe=> set shellredir=> function! Test() echo system("dir -name") endfunction command! -nargs=0 Test :call Test() ``` If I execute this function (:Test) I see nonsense characters (non number/letter ASC...
[ 0.3065532147884369, 0.23191623389720917, 0.23105022311210632, -0.04937469959259033, -0.06241457164287567, -0.43833354115486145, 0.6243422031402588, -0.5464461445808411, -0.28281715512275696, -0.5238136053085327, -0.22194112837314606, 0.7507327795028687, -0.37211257219314575, 0.158601060509...
works as expected. Also, I've tried using iconv in case it was an encoding problem: ``` :echo iconv( system("dir -name"), "unicode", &enc ) ``` But this didn't make any difference. I could be using the wrong encoding types though. Anyone know how to make this work? It is a bit of a hack, but the following works in...
[ 0.04340212419629097, 0.009040632285177708, 0.5380539298057556, -0.15675440430641174, 0.11311224848031998, -0.46474605798721313, 0.5627074837684631, -0.39331963658332825, -0.06036803126335144, -0.6556220650672913, -0.16237755119800568, 0.8514444231987, -0.24733711779117584, -0.0114956479519...
Test()`
[ 0.08803999423980713, 0.2947160303592682, 0.039617933332920074, 0.04044319689273834, 0.0603385791182518, -0.22021301090717316, 0.6663839817047119, -0.2382519692182541, -0.017259929329156876, -0.6351947784423828, -0.2241136133670807, 0.48665210604667664, -0.22219550609588623, 0.1593516170978...
More specifically, when the exception contains custom objects which may or may not themselves be serializable. Take this example: ``` public class MyException : Exception { private readonly string resourceName; private readonly IList<string> validationErrors; public MyException(string resourceName, IList...
[ -0.02658929117023945, 0.12414288520812988, 0.106678806245327, -0.02414327673614025, 0.13625410199165344, 0.1929626315832138, 0.44349756836891174, -0.053583044558763504, -0.3637939989566803, -0.5072228312492371, -0.4090510606765747, 0.43073728680610657, -0.2689794600009918, 0.40235704183578...
public IList<string> ValidationErrors { get { return this.validationErrors; } } } ``` If this Exception is serialized and de-serialized, the two custom properties (`ResourceName` and `ValidationErrors`) will not be preserved. The properties will return `null`. **Is there a common code pattern for imp...
[ -0.11996044963598251, -0.03895846754312515, 0.2914998531341553, 0.15229764580726624, -0.04468447342514992, 0.10483104735612869, 0.08753994107246399, -0.239434152841568, -0.038255348801612854, -0.615599513053894, 0.014854947105050087, 0.5803853869438171, -0.5187838673591614, 0.1395966261625...
fail with a SerializationException stating that // "Type X in Assembly Y is not marked as serializable." public class SerializableExceptionWithoutCustomProperties : Exception { public SerializableExceptionWithoutCustomProperties() { } public SerializableExceptionWithoutCusto...
[ -0.21787887811660767, 0.2585914134979248, 0.10107940435409546, -0.12165876477956772, 0.28243502974510193, 0.08215264976024628, 0.8497732281684875, -0.2276410460472107, -0.16053201258182526, -0.37883809208869934, -0.5018238425254822, 0.5415385365486145, -0.450499027967453, 0.021449651569128...
public SerializableExceptionWithoutCustomProperties(string message, Exception innerException) : base(message, innerException) { } // Without this constructor, deserialization will fail protected SerializableExceptionWithoutCustomProperties(SerializationInfo info, StreamingC...
[ -0.27275916934013367, -0.065116286277771, 0.29254481196403503, 0.126860111951828, 0.24220891296863556, 0.03891490027308464, 0.3764234781265259, -0.005436701700091362, -0.19143006205558777, -0.47618529200553894, -0.21074630320072174, 0.6812840700149536, -0.45829126238822937, 0.3658197522163...
} } ``` Full implementation, with custom properties ------------------------------------------- Complete implementation of a custom serializable exception (`MySerializableException`), and a derived `sealed` exception (`MyDerivedSerializableException`). The main points about this implementation are summarized here: ...
[ -0.11974701285362244, 0.0762539803981781, 0.2323799729347229, -0.030650224536657333, 0.35582467913627625, -0.30533337593078613, 0.18009594082832336, -0.17423111200332642, -0.15158851444721222, -0.7818425893783569, -0.4490191638469696, 0.6483423113822937, -0.18205775320529938, 0.10788428038...
a serialization constructor**. This constructor should be `private` if your class is `sealed`, otherwise it should be `protected` to allow access to derived classes. 2. **Override GetObjectData()** and make sure you call through to `base.GetObjectData(info, context)` at the end, in order to let the base class save its...
[ -0.12968496978282928, -0.04480414092540741, 0.3673861622810364, 0.28505265712738037, 0.13141684234142303, -0.3662557005882263, 0.3800075352191925, -0.04879153147339821, -0.4062660038471222, -0.6580057740211487, -0.34928563237190247, 0.4551159143447876, -0.418515145778656, 0.440910786390304...
a SerializationException stating that // "Type X in Assembly Y is not marked as serializable." public class SerializableExceptionWithCustomProperties : Exception { private readonly string resourceName; private readonly IList<string> validationErrors; public SerializableExceptionWith...
[ -0.18653185665607452, 0.08423663675785065, 0.21972055733203888, 0.07713215798139572, 0.05018767714500427, 0.08161348849534988, 0.5249314904212952, -0.1727469563484192, -0.3807987868785858, -0.3549986183643341, -0.3697420060634613, 0.6022879481315613, -0.3508319556713104, 0.3387065529823303...
base(message) { } public SerializableExceptionWithCustomProperties(string message, Exception innerException) : base(message, innerException) { } public SerializableExceptionWithCustomProperties(string message, string resourceName, IList<string> validationErr...
[ 0.14823183417320251, 0.029170269146561623, 0.3828641474246979, -0.026045585051178932, 0.06133938953280449, 0.24495556950569153, 0.443345844745636, -0.3937285244464874, -0.13107170164585114, -0.29430297017097473, -0.20724894106388092, 0.5958899259567261, -0.47490090131759644, 0.078245937824...
this.resourceName = resourceName; this.validationErrors = validationErrors; } public SerializableExceptionWithCustomProperties(string message, string resourceName, IList<string> validationErrors, Exception innerException) : base(message, innerException) { thi...
[ -0.13535262644290924, 0.08646127581596375, 0.36711689829826355, -0.03142706677317619, 0.26212626695632935, 0.19466382265090942, 0.5402172803878784, -0.22803252935409546, -0.23074890673160553, -0.24958162009716034, -0.24417227506637573, 0.5552822351455688, -0.3913899064064026, 0.36381679773...
} [SecurityPermissionAttribute(SecurityAction.Demand, SerializationFormatter = true)] // Constructor should be protected for unsealed classes, private for sealed classes. // (The Serializer invokes this constructor through reflection, so it can be private) protected SerializableExceptio...
[ -0.1333794742822647, -0.2853411138057709, 0.1518074870109558, 0.09440664947032928, 0.3173638582229614, -0.17344728112220764, 0.5562413334846497, -0.11683334410190582, -0.07541263848543167, -0.6119122505187988, -0.1973578929901123, 0.633782684803009, -0.20509468019008636, 0.1774307042360305...
= info.GetString("ResourceName"); this.validationErrors = (IList<string>)info.GetValue("ValidationErrors", typeof(IList<string>)); } public string ResourceName { get { return this.resourceName; } } public IList<string> ValidationErrors { ...
[ 0.13706739246845245, -0.14184507727622986, 0.3144816756248474, -0.019787665456533432, 0.1873856782913208, 0.3141744136810303, 0.2732715606689453, -0.3423028588294983, 0.029330307617783546, -0.5549226999282837, -0.34020596742630005, 0.7153694033622742, -0.3282523453235626, 0.089053563773632...
} } [SecurityPermissionAttribute(SecurityAction.Demand, SerializationFormatter = true)] public override void GetObjectData(SerializationInfo info, StreamingContext context) { if (info == null) { throw new ArgumentNullException("info"); ...
[ 0.03361538425087929, -0.6267480254173279, 0.4271519184112549, -0.04901876673102379, 0.5850396156311035, -0.05392909049987793, 0.41591498255729675, -0.1582694798707962, 0.08039776235818863, -0.4687497019767761, -0.39324140548706055, 0.8738884925842285, -0.4489345848560333, 0.114837460219860...
info.AddValue("ResourceName", this.ResourceName); // Note: if "List<T>" isn't serializable you may need to work out another // method of adding your list, this is just for show... info.AddValue("ValidationErrors", this.ValidationErrors, typeof(IList<string>)); // ...
[ 0.13642537593841553, -0.2683354616165161, 0.34839022159576416, 0.017004625871777534, 0.16176986694335938, -0.10485703498125076, 0.23230086266994476, -0.15039438009262085, -0.02691095508635044, -0.5955988168716431, -0.18533213436603546, 0.7359932065010071, -0.5485918521881104, 0.00970666669...
save its own state base.GetObjectData(info, context); } } } ``` ***DerivedSerializableExceptionWithAdditionalCustomProperties.cs:*** ``` namespace SerializableExceptions { using System; using System.Collections.Generic; using System.Runtime.Serialization; using System.Security...
[ -0.11546418815851212, 0.004400812089443207, 0.38975369930267334, 0.10875086486339569, 0.24316948652267456, 0.06004864349961281, 0.410699725151062, -0.28908124566078186, -0.05731223151087761, -0.5939731597900391, -0.3011857569217682, 0.35636767745018005, -0.15805181860923767, 0.431904375553...
} public DerivedSerializableExceptionWithAdditionalCustomProperty(string message) : base(message) { } public DerivedSerializableExceptionWithAdditionalCustomProperty(string message, Exception innerException) : base(message, innerException) { } ...
[ -0.14658251404762268, -0.152176633477211, 0.200691357254982, -0.06534672528505325, 0.10977990180253983, 0.11107860505580902, 0.39517301321029663, -0.46095266938209534, 0.2818622589111328, -0.33293581008911133, -0.07459138333797455, 0.6126829385757446, -0.14883680641651154, 0.10029243677854...
validationErrors) : base(message, resourceName, validationErrors) { this.username = username; } public DerivedSerializableExceptionWithAdditionalCustomProperty(string message, string username, string resourceName, IList<string> validationErrors, Exception innerException...
[ 0.062402889132499695, 0.012628369964659214, 0.40928345918655396, -0.05132678896188736, -0.0244586318731308, 0.2273603081703186, 0.39639246463775635, -0.356815367937088, 0.2345218062400818, -0.08070380985736847, -0.11528012156486511, 0.5015662908554077, -0.2566002309322357, 0.16877309978008...
this.username = username; } [SecurityPermissionAttribute(SecurityAction.Demand, SerializationFormatter = true)] // Serialization constructor is private, as this class is sealed private DerivedSerializableExceptionWithAdditionalCustomProperty(SerializationInfo info, StreamingContext cont...
[ -0.03888394311070442, -0.46850427985191345, 0.5558316111564636, 0.022857658565044403, 0.3390699028968811, -0.13635101914405823, 0.4974232017993927, -0.12219439446926117, -0.020051265135407448, -0.4554649293422699, -0.3084584176540375, 0.6272264719009399, -0.3368263244628906, 0.251976788043...
public string Username { get { return this.username; } } public override void GetObjectData(SerializationInfo info, StreamingContext context) { if (info == null) {
[ 0.15384042263031006, -0.5258511900901794, 0.39808937907218933, 0.052040666341781616, 0.3309057354927063, -0.14333701133728027, 0.3003882169723511, 0.1655326634645462, 0.07822725921869278, -0.5922031998634338, -0.4271961748600006, 0.7162147760391235, -0.5575280785560608, 0.26374903321266174...
throw new ArgumentNullException("info"); } info.AddValue("Username", this.username); base.GetObjectData(info, context); } } } ``` --- Unit Tests ---------- MSTest unit tests for the three exception types defined above. ***UnitTests.cs:*** ``` namespace SerializableE...
[ 0.08041983842849731, 0.02193225920200348, 0.20174606144428253, 0.1374444216489792, -0.01608474925160408, 0.20428325235843658, 0.2272300124168396, -0.3053882420063019, -0.08682800084352493, -0.7703365683555603, -0.3788939118385315, 0.4934111535549164, -0.1460123062133789, 0.2300327569246292...
UnitTests { private const string Message = "The widget has unavoidably blooped out."; private const string ResourceName = "Resource-A"; private const string ValidationError1 = "You forgot to set the whizz bang flag."; private const string ValidationError2 = "Wally cannot operate in z...
[ 0.3461551070213318, -0.16627949476242065, 0.421118825674057, 0.39159318804740906, 0.17587299644947052, 0.07556313276290894, 0.6702309846878052, -0.2970406115055084, -0.07726579904556274, -0.20691542327404022, -0.26360830664634705, 0.6336057186126709, -0.3424241840839386, 0.3766607344150543...
"Barry"; public UnitTests() { validationErrors.Add(ValidationError1); validationErrors.Add(ValidationError2); } [TestMethod] public void TestSerializableExceptionWithoutCustomProperties() { Exception ex =
[ 0.34982988238334656, 0.026777561753988266, 0.2529585361480713, -0.028162328526377678, 0.2934398949146271, 0.3637310564517975, 0.5875963568687439, -0.2923987805843353, -0.015891315415501595, -0.3273136615753174, -0.20113034546375275, 0.6563823819160461, -0.14577890932559967, 0.2485817223787...
new SerializableExceptionWithoutCustomProperties( "Message", new Exception("Inner exception.")); // Save the full ToString() value, including the exception message and stack trace. string exceptionToString = ex.ToString(); // Round-trip the exception: Serialize ...
[ -0.2897503972053528, -0.18173177540302277, 0.25386759638786316, -0.008176526986062527, 0.28072452545166016, 0.17272412776947021, 0.3632386028766632, -0.3599514067173004, -0.34526798129081726, -0.19843719899654388, -0.2346327006816864, 0.535490870475769, -0.31056109070777893, 0.195858135819...
BinaryFormatter bf = new BinaryFormatter(); using (MemoryStream ms = new MemoryStream()) { // "Save" object state bf.Serialize(ms, ex); // Re-use the same stream for de-serialization
[ -0.09329130500555038, -0.46758031845092773, 0.4839363098144531, -0.16866834461688995, 0.14007088541984558, 0.5239660739898682, 0.32634931802749634, -0.24480211734771729, -0.27647846937179565, -0.4261244535446167, -0.178897887468338, 0.33978188037872314, -0.4543416500091553, 0.1381723284721...
ms.Seek(0, 0); // Replace the original exception with de-serialized one ex = (SerializableExceptionWithoutCustomProperties)bf.Deserialize(ms); } // Double-check that the exception message and stack trace (owned by the base Exception) are preserved
[ -0.11346746981143951, -0.25642699003219604, 0.38328441977500916, -0.011411836370825768, 0.3428424298763275, 0.15013127028942108, 0.5827745795249939, -0.2898401916027069, -0.3017353415489197, -0.6990482807159424, -0.3711635172367096, 0.5334590077400208, -0.4866372346878052, 0.30537778139114...
Assert.AreEqual(exceptionToString, ex.ToString(), "ex.ToString()"); } [TestMethod] public void TestSerializableExceptionWithCustomProperties() { SerializableExceptionWithCustomProperties ex = new SerializableExceptionWithCustomProperties(Message, ResourceNam...
[ -0.03098149411380291, 0.03637579828500748, 0.2376675009727478, 0.2081543654203415, 0.1998107135295868, -0.008649870753288269, 0.672132670879364, -0.474530965089798, -0.11486626416444778, -0.31664642691612244, -0.09643598645925522, 0.8074148893356323, 0.04041120037436485, 0.4300273060798645...
Assert.AreEqual(Message, ex.Message, "Message"); Assert.AreEqual(ResourceName, ex.ResourceName, "ex.ResourceName"); Assert.AreEqual(2, ex.ValidationErrors.Count, "ex.ValidationErrors.Count"); Assert.AreEqual(ValidationError1, ex.ValidationErrors[0], "ex.ValidationErrors[0]"); ...
[ -0.12122417986392975, -0.002310539595782757, 0.33614450693130493, -0.15596343576908112, -0.26686254143714905, 0.2780159115791321, 0.5985216498374939, -0.9780771136283875, 0.10542352497577667, -0.02646692283451557, -0.221251979470253, 0.8293150663375854, -0.2640864849090576, -0.166477397084...
exceptionToString = ex.ToString(); // Round-trip the exception: Serialize and de-serialize with a BinaryFormatter BinaryFormatter bf = new BinaryFormatter(); using (MemoryStream ms = new MemoryStream()) { // "Save" object state
[ -0.36923301219940186, -0.31187912821769714, 0.2716626226902008, -0.012525195255875587, 0.1283363699913025, 0.14429984986782074, 0.4469352066516876, -0.2656904458999634, -0.36817336082458496, -0.2089778333902359, -0.1550569236278534, 0.399596244096756, -0.4929134249687195, -0.00563302356749...
bf.Serialize(ms, ex); // Re-use the same stream for de-serialization ms.Seek(0, 0); // Replace the original exception with de-serialized one ex = (SerializableExceptionWithCustomProperties)bf.Deserialize(ms); }
[ 0.032730065286159515, -0.4832893908023834, 0.3081597089767456, 0.011440932750701904, 0.13124273717403412, 0.34918102622032166, 0.5198531746864319, -0.3756566047668457, -0.29713740944862366, -0.774383544921875, -0.3174704611301422, 0.6407259106636047, -0.6825957298278809, 0.3173699080944061...