Search Results

Search found 3677 results on 148 pages for 'cs 79'.

Page 56/148 | < Previous Page | 52 53 54 55 56 57 58 59 60 61 62 63  | Next Page >

  • Importing from referenced assembly - MEF

    - by cmaduro
    I have the following simplified code: namespace Silverbits.Applications { public partial class SilverbitsApplication : Application { [Import("MainPage")] public UserControl MainPage { get { return RootVisual as UserControl; } set { RootVisual = value; } } public SilverbitsApplication() { this.Startup += this.SilverbitsApplication_StartUp; this.Exit += new EventHandler(SilverbitsApplication_Exit); this.UnhandledException += this.SilverbitsApplication_UnhandledException; InitializeComponent(); } private void SilverbitsApplication_StartUp(object sender, StartupEventArgs e) { CompositionInitializer.SatisfyImports(this); } } namespace Manpower4U { public class App : SilverbitsApplication { public App() : base() { } } } namespace Manpower4U { [Export("MainPage")] public partial class MainPage : UserControl { public MainPage() { InitializeComponent(); } } } The idea is that I have a Silverbits Library which is a completely different solution. And I have Manpower4U silverlight application that references my Silverbits library. I want to export MainPage from Manpower4U and set it to the RootVisual in my SilverbitsApplication class. SilverbitsApplication class is basically App.xaml/App.cs from the silverlight application, only I put it in a class library and subclassed App.cs file in Manpower4U, which is now the entry point of Manpower4U. MEF cannot resolve the import. How do I get this to work?

    Read the article

  • How to create databinding over two xaml files?

    - by BionicGecko
    Hello, I am trying to come to a working understanding of how databinding works, but even after several tutorials I only have a basic understanding of how databinding works. Thus this question might seem fundamental to those more familiar with silverlight. Even if it is trivial, please point me to some tutorial that deals with this problem. All that I could find simply solved this via adding the data binding on a parent page.xaml (that i must not use in my case). For the sake of this example let us assume, that we have 5 files: starter.cs button1.xaml + codeBehind button2.xaml + codeBehind The two buttons are generated in code in the starter(.cs) file, and then added to some MapLayer button1 my_button1 = new button1(); button2 my_button1 = new button2(); someLayer.Children.Add(my_button1); someLayer.Children.Add(my_button2); My aim is to connect the two buttons, so that they always display the same "text" (i.e. my_button1.content==my_button2.content = true;). Thus when something changes my_button1.content this change should be propagated to the other button (two way binding). At the moment my button1.xaml looks like this: <Grid x:Name="LayoutRoot"> <Button x:Name="x_button1" Margin="0,0,0,0" Content="{Binding ElementName=x_button2, Path=Content}" ClickMode="Press" Click="button1_Click"/> </Grid> But everthing that i get out of that is a button with no content at all, it is just blank as the binding silently fails. How could I create the databinding in the context I described? Preferably in code and not XAML ;) Thanks in advance

    Read the article

  • How to prevent linq-to-sql designer undo my changing

    - by anonim.developer
    Dear All, Thanks for your attention in advance, I’ve met an issue with LINQ-2-SQL designer in VS 2008 SP1 which has made me CRAZY. I use Linq2sql as my DAL. It seems Linq2sql speeds up coding in the first step but lots of issues arise in feature specifically with table or object inheritance. In this case I have a class Entity that all other entity classes generated by Linq2sql designer inherit from. public abstract class Entity { public virtual Guid ID { get; protected set; } } public partial class User : monius.Data.Entity { } And the following generated by L2S designer (DataModel.designer.cs) [Column(Storage = "_ID", AutoSync = AutoSync.OnInsert, DbType = "UniqueIdentifier NOT NULL", IsPrimaryKey = true, IsDbGenerated = true, UpdateCheck = UpdateCheck.Never)] [DataMember(Order = 1)] public System.Guid ID { get { return this._ID; } set { if ((this._ID != value)) { this.OnIDChanging(value); this.SendPropertyChanging(); this._ID = value; this.SendPropertyChanged("ID"); this.OnIDChanged(); } } } When I compile the code VS warns me that Warning 1 'User.ID' hides inherited member 'Entity.ID'. To make the current member override that mplementation, add the override keyword. Otherwise add the new keyword. That warning is obvious and I have to change the code generated by L2S designer (DataModel.designer.cs) to […] public override System.Guid ID { … protected set … } And the code compiled with no error or warning and everyone is happy. But that is not the end of story. As soon as I made changes to entities of the diagram (dbml) or even I open dbml file to view it, any change manually I made to designer has been vanished and POOF! Redo AGAIN. That is a painful job. Now I wonder if there is a way to force L2S designer not changing portions of auto-generated code. I’ll be appreciated if someone kindly helps me with this issue.

    Read the article

  • Using Reflection.Emit to emit a "using (x) { ... }" block?

    - by Lasse V. Karlsen
    I'm trying to use Reflection.Emit in C# to emit a using (x) { ... } block. At the point I am in code, I need to take the current top of the stack, which is an object that implements IDisposable, store this away in a local variable, implement a using block on that variable, and then inside it add some more code (I can deal with that last part.) Here's a sample C# piece of code I tried to compile and look at in Reflector: public void Test() { TestDisposable disposable = new TestDisposable(); using (disposable) { throw new Exception("Test"); } } This looks like this in Reflector: .method public hidebysig instance void Test() cil managed { .maxstack 2 .locals init ( [0] class LVK.Reflection.Tests.UsingConstructTests/TestDisposable disposable, [1] class LVK.Reflection.Tests.UsingConstructTests/TestDisposable CS$3$0000, [2] bool CS$4$0001) L_0000: nop L_0001: newobj instance void LVK.Reflection.Tests.UsingConstructTests/TestDisposable::.ctor() L_0006: stloc.0 L_0007: ldloc.0 L_0008: stloc.1 L_0009: nop L_000a: ldstr "Test" L_000f: newobj instance void [mscorlib]System.Exception::.ctor(string) L_0014: throw L_0015: ldloc.1 L_0016: ldnull L_0017: ceq L_0019: stloc.2 L_001a: ldloc.2 L_001b: brtrue.s L_0024 L_001d: ldloc.1 L_001e: callvirt instance void [mscorlib]System.IDisposable::Dispose() L_0023: nop L_0024: endfinally .try L_0009 to L_0015 finally handler L_0015 to L_0025 } I have no idea how to deal with that ".try ..." part at the end there when using Reflection.Emit. Can someone point me in the right direction?

    Read the article

  • Error when decoding image C# asp

    - by Wayneio
    I am trying to use MessagingToolkit to decode an image in C#/ASP. I have managed to encode a qr using this package, but when i try to decode, using the code below it comes up with 2 errors (at the bottom of the page) I believe this is because I am not getting the image correctly after uploading, but can someone point out exactly where I have gone wrong. Thanks. protected void CreateCode_OnClick(object sender, EventArgs e) { string path = "C:\\Users\\Wayneio\\Documents\\Visual Studio 2012\\Projects\\BAMSystem\\BAMSystem\\"; if (QRUpload.HasFiles == true) { FileInfo fi = new FileInfo(QRUpload.FileName); string extA = fi.Extension; if (extA == ".jpg" || extA == ".png") { QRCodeDecoder decoder = new QRCodeDecoder(); QRUpload.SaveAs(path + QRUpload.FileName); System.Drawing.Image myImg = System.Drawing.Image.FromFile(path + QRUpload.FileName); decoder.Decode(myImg); } else { error.Text = "You have uploaded a " + extA + " file. Please upload either a PNG or a JPG"; } } else { error.Text = "You have not uploaded an image."; } } Error1: Error 2 Argument 1: cannot convert from 'System.Drawing.Image' to 'MessagingToolkit.QRCode.Codec.Data.QRCodeImage' c:\users\wayneio\documents\visual studio 2012\Projects\BAMSystem\BAMSystem\default.aspx.cs 38 35 BAMSystem Error2: Error 1 The best overloaded method match for 'MessagingToolkit.QRCode.Codec.QRCodeDecoder.Decode(MessagingToolkit.QRCode.Codec.Data.QRCodeImage)' has some invalid arguments c:\users\wayneio\documents\visual studio 2012\Projects\BAMSystem\BAMSystem\default.aspx.cs 38 20 BAMSystem P.S if anyone has documentation on this MessagingToolkit QR package, it would be useful

    Read the article

  • how to get the source code as register user.

    - by nir143
    hi. i downloaded a sourcecode of a site,but i downloaded it i saw it identify my program as a guest,i search at google and figure out that i can send a cookie when i "ask" the source code. that what i have managed to do and it still dont identify me as register user: CookieContainer cj = new CookieContainer(); string all = ""; HttpWebRequest req = (HttpWebRequest)WebRequest.Create(Url); req.CookieContainer = cj; HttpWebResponse res = (HttpWebResponse)req.GetResponse(); CookieCollection cs=cj.GetCookies(req.RequestUri); CookieContainer cc = new CookieContainer(); cc.Add(cs); req.CookieContainer = cc; StreamReader read = new StreamReader(res.GetResponseStream()); all = read.ReadToEnd(); read.Close(); return all; what is wrong here? tyvm for help:) (if that help,i can have a simple details of a register user of the site).

    Read the article

  • Operation is not valid due to the current state of the object?

    - by Bill
    I am programming in C#; the code was working about a week ago, however it throws an exception and I don't understand at all what could be wrong with it. Var root = new CalculationNode(); -> Throw exception. In the call stack thats the only thing listed, I've been told that it could be that I need a clean build, but I am open to any ideas or suggestions. Thanks, -Bill Update: Exception's Detail System.InvalidOperationException was unhandled by user code Message=Operation is not valid due to the current state of the object. Source=Calculator.Logic StackTrace: at ~.Calculator.Logic.MyBaseExpressionParser.Parse(String expression) in ~\Source\Calculator.Logic\MyBaseExpressionParser.cs:line 44 at ~.Calculator.Logic.Tests.MyBaseCalculatorServiceTests.BasicMathDivision() in ~\Projects\Tests\Calculator.Logic.Tests\MyBaseCalculatorServiceTests.cs:line 60 InnerException: CalculationNode's code: public sealed calss CalculationNode { public CalculationNode() { this.Left = null; this.Right = null; this.Element = new CalculationElement(); } public CalculationNode Left {get;set;} public CalculationNode Right {get;set;} public CalculationElement Element {get; set;} } CalculationElement's code: public sealed class CalculationElement { public CalculationElement() { Value = string.Empty; IsOperator = false; } public string Value {get; set} public bool IsOperator {get; set} }

    Read the article

  • ListBox and Listview problem

    - by Anu
    Hi, I have listbox in my applcation and corresponding coding.. XAML: <DataTemplate x:Key="menuItemTemplate"> <WrapPanel> <TextBlock Text="{Binding Path = Menu}" /> </WrapPanel> </DataTemplate> <ListBox x:Name="menubox" ItemsSource="{Binding}" ItemTemplate="{StaticResource menuItemTemplate}" Margin="0,5,0,0"> .CS : public void Add(string[] menu) { ItemList items = ItemList.Load(menu); DataContext = items; } It works fine.Later i add Listview for another purpose and i coded like the same way of listbox XAML: <DataTemplate x:Key="ListItemTemplate"> <WrapPanel> <TextBlock Text="{Binding Path = Title}" /> </WrapPanel> </DataTemplate> <ListView ItemsSource="{Binding}" ItemTemplate="{StaticResource ListItemTemplate}" Name="listView1" /> .cs coding: public void SetTree(string Title,int BoxNo ) { TreeList items1 = TreeList.Load(Title,BoxNo); DataContext = items1; } After adding Listview,what happended this ListView show data,but Listbox didnot show anything.When i click the listbox it perfectly executing the clicking event of listbox.Only problem it doesnot display the text.What can i do for that. Here i added corresponding list class pls see tht. namespace Tabcontrol { public class TreeList : Collection<TreeItems> { public int size; public TreeList() { size = 0; } public int Count { get { return size; } } public static TreeList Load(string pmenu,int Box) { TreeList result = new TreeList(); TreeItems item = TreeItems.Load(pmenu,Box); result.Add(item); return result; } } } The ItemList class also the same thing, only variable names are getting differred.

    Read the article

  • State Animation on ListBox ItemTemplate

    - by Peanut
    I have a listbox which reads from Observable collection, and is ItemTemplate'ed: <DataTemplate x:Key="DataTemplate1"> <Grid x:Name="grid" Height="47.333" Width="577" Opacity="0.495"> <Image HorizontalAlignment="Left" Margin="10.668,8,0,8" Width="34" Source="{Binding ImageLocation}"/> <TextBlock Margin="56,8,172.334,8" TextWrapping="Wrap" Text="{Binding ApplicationName}" FontSize="21.333"/> <Grid x:Name="grid1" HorizontalAlignment="Right" Margin="0,10.003,-0.009,11.33" Width="26" Opacity="0" RenderTransformOrigin="0.5,0.5"> <Image HorizontalAlignment="Stretch" Margin="0" Source="image/downloads.png" Stretch="Fill" MouseDown="Image_MouseDown" /> </Grid> </Grid> </DataTemplate> <ListBox x:Name="searchlist" Margin="8" ItemTemplate="{DynamicResource DataTemplate1}" ItemsSource="{Binding SearchResults}" SelectionChanged="searchlist_SelectionChanged" ItemContainerStyle="{DynamicResource ListBoxItemStyle1}" /> In general, my question is "What is the easiest way to do Animation on Particular Items in this listbox As they are selected? Basically the image inside the "grid1" will be setting its opacity to 1, slowly. I would prefer to use states, but I do not know of any way to just tell blend and xaml to "When a selected item is changed, change the image opacity to 1 over a period of .3 seconds". Infact, I have been doing this in the .cs file using the VisualStateManager. Also, there is another issue. When the selected index is changed, we goto the CS file and look at SelectedItem. SelectedItem returns an instance of the Object in which it was bound to (The object inside the observable collection), and NOT an instance of the DataTemplate/ListItem etc. So how am I able to pull the correct image out of this list? State animation with VisualStateManager I can handle fine if its just normal things, but when it comes to generated listboxes' items, I'm lost. Thanks

    Read the article

  • How can I map stored procedure result into a custom class with linq-to-sql?

    - by Remnant
    I have a stored procedure that returns a result set (4 columns x n Rows). The data is based on multiple tables within my database and provides a summary for each department within a corporate. Here is sample: usp_GetDepartmentSummary DeptName EmployeeCount Male Female HR 12 5 7 etc... I am using linq-to-sql to retrieve data from my database (nb - have to use sproc as it is something I have inherited). I would like to call the above sproc and map into a department class: public class Department { public string DeptName {get; set;} public int EmployeeCount {get; set;} public int MaleCount {get; set;} public int FemaleCount {get; set;} } In VS2008, I can drag and drop my sproc onto the methods pane of the linq-to-sql designer. When I examine the designer.cs the return type for this sproc is defined as: ISingleResult<usp_GetDepartmentSummaryResult> What I would like to do is amend this somehow so that it returns a Department type so that I can pass the results of the sproc as a strongly typed view: <% foreach (var dept in Model) { %> <ul> <li class="deptname"><%= dept.DeptName %></li> <li class="deptname"><%= dept.EmployeeCount %></li> etc... Any ideas how to achieve this? NB - I have tried amending the designer.cs and dbml xml file directly but with limited success. I admit to being a little out of my depth when it comes to updating those files directly and I am not sure it is best practice? Would be good to get some diretion. Thanks much

    Read the article

  • ADODB.Connection undefined

    - by Wes Groleau
    Reference http://stackoverflow.com/questions/1690622/excel-vba-to-sql-server-without-ssis After I got the above working, I copied all the global variables/constants from the routine, which included Const CS As String = "Driver={SQL Server};" _ & "Server=**;" _ & "Database=**;" _ & "UID=**;" _ & "PWD=**" Dim DB_Conn As ADODB.Connection Dim Command As ADODB.Command Dim DB_Status As Stringinto a similar module in another spreadsheet. I also copied Sub Connect_To_Lockbox() If DB_Status < "Open" Then Set DB_Conn = New Connection DB_Conn.ConnectionString = CS DB_Conn.Open ' problem! DB_Status = "Open" End If End SubI added the same reference (ADO 2.8) The first spreadsheet still works; the seccond at DB_Conn.Open pops up "Run-time error '-214767259 (80004005)': [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified" Removing the references on both, saving files, re-opening, re-adding the references doesn't help. The one still works and the other gets the error. ?!?

    Read the article

  • hiding buttons in master page

    - by pankaj
    Hi, I am working on an app where i am having some linkbuttons in master page. I want to display them depending upon the authorization given to them once they logs in. I have initially made all of them visible false and then i am checking the authorisation in the aspx.cs class of master page. I make the link button visible depending upon the right granted to the user. But it is making all the link buttons visible. Instead it should only make two of them visible and rest should be hidden. Following is my code from MasterPage.aspx.cs: ArrayList arrlstUserRoles = new ArrayList(); arrlstUserRoles = (ArrayList)Session["Roles"]; for (int j = 0; j < arrlstUserRoles.Count; j++) { if (int.Parse(arrlstUserRoles[j].ToString()) == 1) { lbtnRetailer.Visible = true; } else if (int.Parse(arrlstUserRoles[j].ToString()) == 2) { lbtnCategory.Visible = true; } else if (int.Parse(arrlstUserRoles[j].ToString()) == 3) { lbtnCouponTemplate.Visible = true; } else if (int.Parse(arrlstUserRoles[j].ToString()) == 4) { //lbtnStoreManagement.Visible = true; } else if (int.Parse(arrlstUserRoles[j].ToString()) == 5) { lbtnStoreManagement.Visible = true; } else if (int.Parse(arrlstUserRoles[j].ToString()) == 6) { lbtnContentManagement.Visible = true; } else if (int.Parse(arrlstUserRoles[j].ToString()) == 7) { //lbtnStoreManagement.Visible = true; } }

    Read the article

  • A generic error occurred in GDI+, JPEG Image to MemoryStream

    - by madcapnmckay
    Hi, This seems to be a bit of an infamous error all over the web. So much so that I have been unable to find an answer to my problem as my scenario doesn't fit. An exception gets thrown when I save the image to the stream. Weirdly this works perfectly with a png but gives the above error with jpg and gif which is rather confusing. Most similar problem out there relate to saving images to files without permissions. Ironically the solution is to use a memory stream as I am doing.... public static byte[] ConvertImageToByteArray(Image imageToConvert) { using (var ms = new MemoryStream()) { ImageFormat format; switch (imageToConvert.MimeType()) { case "image/png": format = ImageFormat.Png; break; case "image/gif": format = ImageFormat.Gif; break; default: format = ImageFormat.Jpeg; break; } imageToConvert.Save(ms, format); return ms.ToArray(); } } More detail to the exception. The reason this causes so many issues is the lack of explanation :( System.Runtime.InteropServices.ExternalException was unhandled by user code Message="A generic error occurred in GDI+." Source="System.Drawing" ErrorCode=-2147467259 StackTrace: at System.Drawing.Image.Save(Stream stream, ImageCodecInfo encoder, EncoderParameters encoderParams) at System.Drawing.Image.Save(Stream stream, ImageFormat format) at Caldoo.Infrastructure.PhotoEditor.ConvertImageToByteArray(Image imageToConvert) in C:\Users\Ian\SVN\Caldoo\Caldoo.Coordinator\PhotoEditor.cs:line 139 at Caldoo.Web.Controllers.PictureController.Croppable() in C:\Users\Ian\SVN\Caldoo\Caldoo.Web\Controllers\PictureController.cs:line 132 at lambda_method(ExecutionScope , ControllerBase , Object[] ) at System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClassa.<InvokeActionMethodWithFilters>b__7() at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) InnerException: OK things I have tried so far. Cloning the image and working on that. Retrieving the encoder for that MIME passing that with jpeg quality setting. Please can anyone help.

    Read the article

  • getting CS1502 compiler error on dev environment but not production.

    - by nw
    When I try to run my ASP.NET app from my development environment I get the following error message: Compiler Error Message: CS1502: The best overloaded method match for 'mmars.Printing.printFunctions.SetPrintSummaryProperties(mmars.contextInfo, ref mmars.Printing.printObjSummary)' has some invalid arguments. When I publish and run on our production server I don't get this error. It seems to compile fine when I build from the build menu (in fact if I change the second argument of the bolded function call below, i get a compiler error in visual studio), but now i've suddenly started getting this error message at runtime. So another question I have in addition to getting rid of the error is why is the .NET development server even trying to do JIT compilation on my project if it is already compiled into a DLL? Printing.printObjSummary myPrintObj = new Printing.printObjSummary(); Printing.printFunctions.SetPrintSummaryProperties(ci, ref myPrintObj); printObjects.Add(myPrintObj); This seems to have just suddenly appeared from nowhere today and it's extremely frustrating. Also, though there are no warnings at compile-time, when I get redirected to the page with that first compilation error there are many warnings like the following: Warning: CS0436: The type 'mmars.MMARSSummaryDataItem' in 'c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\3dad423c\40569048\App_Code.b0rgpkzr.4.cs' conflicts with the imported type 'mmars.MMARSSummaryDataItem' in 'c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\3dad423c\40569048\assembly\dl3\7179c19a\345f948c_ece7ca01\mmars.DLL'. Using the type defined in 'c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\3dad423c\40569048\App_Code.b0rgpkzr.4.cs'. What's the deal with that? Is the webserver complaining about name conflicts in the source file and dll resulting from the source file?

    Read the article

  • Windows 7 Create Folder in "Program Files" failing in C# code even thought I have admin rights!

    - by Shiva
    Hi, I am unable to create a file under "program files" folder on my Windows 7 64-bit machine in VS 2008 WPF C# code. The error I get on the following code myFile = File.Create(logFile); is the following. (this is the innerException stack trace). at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options) at System.IO.File.Create(String path) at MyFirm.MyPricingApp.UI.App.InitializeLogging() in C:\Projects\MyPricingApp\App.xaml.cs:line 150 at MyFirm.MyPricingApp.UI.App.Application_Startup(Object sender, StartupEventArgs e) in C:\Projects\MyPricingApp\App.xaml.cs:line 38 at System.Windows.Application.OnStartup(StartupEventArgs e) at System.Windows.Application.<.ctor>b__0(Object unused) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler) this seems like it has something to do with UAC in Windows 7, because why else would I get this since my user is already Admin on the machine ?! Also since the WinIOError has SECURITY_ATTRIBUTES, I am thinking this has something to do with a "new way" security is handled in Windows 7. I tried to browse to the "Program Files" folder, under which the log folder and file were to be created. I can create the folder by hand, but when i try to create the file, I get the similar "Access Denied" exception.

    Read the article

  • error message The URI does not identify an external Java class

    - by iHeartGreek
    Hi! I am new to XSL, and thus new to using scripts within the XSL. I have taken example code (also using C#) and adapted it for my own use.. but it does not work. The error message is: The URI urn:cs-scripts does not identify an external Java class The relevant code I have is: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl" xmlns:strTok="urn:cs-scripts"> ... ... ... </xsl:template> <xsl:variable name="temp"> <xsl:value-of select="tok:getList('AAA BBB CCC', ' ')"/> </xsl:variable> <msxsl:script language="C#" implements-prefix="tok"> <![CDATA[ public string[] getList(string str, char[] delim) { return str.Split(delim, StringSplitOptions.None); } public string getString(string[] list, int i) { return list[i]; } ]]> </msxsl:script> </xsl:stylesheet>

    Read the article

  • Flex 3 - Image cache

    - by BS_C3
    Hello Community. I'm doing an Image Cache following this method: http://www.brandondement.com/blog/2009/08/18/creating-an-image-cache-with-actionscript-3/ I copied the two as classes, renaming them CachedImage and CachedImageMap. The thing is that I don't want to store the image after being loaded a first time, but while the application is being loaded. For that, I've created a function that is called by the application pre-initialize event. This is how it looks: private function loadImages():void { var im:CachedImage = new CachedImage; var sources:ArrayCollection = new ArrayCollection; for each(var cs in divisionData.division.collections.collection.collectionSelection) { sources.addItem(cs.toString()); } for each(var se in divisionData.division.collections.collection.searchEngine) { sources.addItem(se.toString()); } for each( var source:String in sources) { im.source = source; im.load(source); } } The sources are properly retrieved. However, even if I use the load method, I do not get the "complete" event... As if the image is not being loaded... How is that? Any help would be appreciated. Thanks in advance. Regards, BS_C3

    Read the article

  • In Visual Studio (2008) is there a way to have a custom dependent file on another custom file?

    - by rball
    Instead of a *.cs code behind or beside I'd like to have a *.js file. I'm developing a MVC application an have no need for a code beside because I have controllers, but in certain cases it'd be nice to have a JavaScript code beside or some way to associate the file to the page it's being used on. I suppose I could just name them similarly, but I'm wanting to show the association if possible so there's no question about what the file is for. Typically what I'm talking about is within Visual Studio now under your Global.asax file you will have a plus sign to the left: + Global.asax Once you expand it you'll get - Global.asax Global.asax.cs I'd like the same thing to happen: + Home.spark - Home.spark Home.spark.js Updated: My existing csproj file has a path to the actual file, not sure if that's screwing it up. I've currently got: <ItemGroup> <Content Include="Views\User\Profile.spark.js"> <DependentUpon>Views\User\Profile.spark</DependentUpon> </Content> </ItemGroup> <ItemGroup> <Content Include="Views\User\Profile.spark" /> </ItemGroup> and it's simply just showing the files besides each other.

    Read the article

  • Castle windsor security exception

    - by Sunil
    I developed a small WCF service that uses Castle Windsor IoC container and it works fine on my PC. When I deploy it onto a Win 2008 R2 server and host the WCF service in IIS 7 it fails with the following error. I checked the server level web.config and the trust level is set to "Full". What do I need to do to get this to work. As a test I deployed the same service as it is onto a Windows 2003 server with the trust level set to "Full" and it works fine. I am unable to figure out what setting/configuration I am missing on the 2008 server that is making the service fail. Stack Trace: [SecurityException: That assembly does not allow partially trusted callers.] Castle.Windsor.WindsorContainer..ctor() +0 WMS.ServiceContractImplementation.IoC.IoCInstanceProvider..ctor(Type serviceType) in D:\WCF\WCFProofOfConcept\WMSServices \WMS.ServiceContractImplementation\IoC\IoCInstanceProvider.cs:19 WMS.ServiceContractImplementation.IoC.IoCServiceBehavior.ApplyDispatchBehav­ior(ServiceDescription serviceDescription, ServiceHostBase serviceHostBase) in D:\WCF \WCFProofOfConcept\WMSServices\WMS.ServiceContractImplementation\IoC \IoCServiceBehavior.cs:24 System.ServiceModel.Description.DispatcherBuilder.InitializeServiceHost(Ser­viceDescription description, ServiceHostBase serviceHost) +377 System.ServiceModel.ServiceHostBase.InitializeRuntime() +37 System.ServiceModel.ServiceHostBase.OnBeginOpen() +27 System.ServiceModel.ServiceHostBase.OnOpen(TimeSpan timeout) +49 System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) +261 System.ServiceModel.HostingManager.ActivateService(String normalizedVirtualPath) +121 System.ServiceModel.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath) +479

    Read the article

  • Does/Will autofac's ASP.NET integration support PreInit or Init events?

    - by David Rubin
    I see from poking around in the 1.4.4 source that Autofac's ASP.NET integration (via Autofac.Integration.Web) peforms injection of properties on the Page as part of the HttpContext.PreRequestHandlerExecute event handling, but that the page's child controls don't get their properties injected until Page.PreLoad. What this means, though is that the injected properties of child controls are unavailable for use in the OnInit event handler. For example, this works fine: HelloWorld.aspx: <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="HelloWorld.aspx.cs" Inherits="HelloWorld" %> <html> <body> <asp:Label runat="server" id="lblMsg" OnInit="HandleInit"/> </body> </html> HelloWorld.aspx.cs: ... protected void HandleInit() { lblMsg.Text = _msgProvider.GetMessage(); } public IMsgProvider _msgProvider { private get; set; } // <-- Injected But changing the HelloWorld Page to a UserControl (.acsx) and putting the UserControl in another page doesn't work because _msgProvider isn't injected early enough. Is there a way to make Autofac inject properties of child controls earlier? Or is this something that can be addressed in a future build? Thanks!

    Read the article

  • Adventures on Enterprise Library 5.0: Who moved my cheese (namespace)

    - by Junior Mayhé
    Jesus, Krishna, Budda! I've migrated to EntLib 5.0, but classes like ISymmetricCryptoProvider are not recognized anymore. Funny to say that Data, Logging and other blocks are working compiling fine. Here's the problematic class: using System; using System.Collections.Generic; using System.Text; using Microsoft.Practices.EnterpriseLibrary.Common.Configuration;//-->it's not working anymore using Microsoft.Practices.EnterpriseLibrary.Security.Cryptography;//-->it's not working anymore namespace MyClassLibrary.Security.EnterpriseLibrary { public sealed class Crypto { public static ISymmetricCryptoProvider MyProvider { get { //IConfigurationSource is not recognized either, neither SystemConfigurationSource IConfigurationSource cs = new SystemConfigurationSource(); SymmetricCryptoProviderFactory scpf = new SymmetricCryptoProviderFactory(cs); ISymmetricCryptoProvider p = scpf.CreateDefault(); return p; } } The references are fine on project too. I really don't know why this particular project it's causing too many trouble on VS2010! Older references were deleted, project was cleaned, rebuilt, but can't make it compile :-( The references are: Microsoft.Practices.EnterpriseLibrary.Common Microsoft.Practices.EnterpriseLibrary.Logging Microsoft.Practices.EnterpriseLibrary.Logging.Database Microsoft.Practices.EnterpriseLibrary.Security Microsoft.Practices.EnterpriseLibrary.Security.Cryptography Why some namespaces can be found while others can't?

    Read the article

  • ASP.NEt MVC 2 application error on IIS7 works fine on local machine

    - by aspCoolguy
    My ASP.NET MVC2 application is developed using 1. VS 2010 2. Linq To SQL for Models Here is Call controller code: namespace CallTrackMVC.Controllers { public class CallController : Controller { private CallTrackRepository repository; public CallController():this(new CallTrackRepository()) { } public CallController(CallTrackRepository newRepository) { repository = newRepository; } } } Error on IIS7 when browsing the Call Create page is NullReferenceException: Object reference not set to an instance of an object.] CallTrackMVC.Models.ExecOfficeDataContext..ctor() in C:\ClearCase\rartadi_view\STS_Dev_TEST\CallTrackMVC\Models\ExecOffice.designer.cs:71 CallTrackMVC.Controllers.CallController..ctor() in C:\ClearCase\rartadi_view\STS_Dev_TEST\CallTrackMVC\Controllers\CallController.cs:16 [TargetInvocationException: Exception has been thrown by the target of an invocation.] System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) +0 System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache) +117 System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean skipCheckThis, Boolean fillCache) +247 System.Activator.CreateInstance(Type type, Boolean nonPublic) +106 System.Web.Mvc.DefaultControllerFactory.GetControllerInstance(RequestContext requestContext, Type controllerType) +102 [InvalidOperationException: **An error occurred when trying to create a controller of type 'CallTrackMVC.Controllers.CallController'. Make sure that the controller has a parameterless public constructor.**] System.Web.Mvc.DefaultControllerFactory.GetControllerInstance(RequestContext requestContext, Type controllerType) +541 System.Web.Mvc.DefaultControllerFactory.CreateController(RequestContext requestContext, String controllerName) +85 System.Web.Mvc.MvcHandler.ProcessRequestInit(HttpContextBase httpContext, IController& controller, IControllerFactory& factory) +165 System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object state) +80 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +389 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +371 Code in Global.asax is protected void Application_Start() { AreaRegistration.RegisterAllAreas(); RegisterRoutes(RouteTable.Routes); } Any suggestion would be a great help.

    Read the article

  • Why is my user control not instanciated on a postback?

    - by Antoine
    Hi, I'd like to set the trigger of an UpdatePanel to a user control outside the UpdatePanel on the same page . The user control is added at design time, not at runtime. If I statically declare the trigger, I get an error "A control with ID 'xx' cannot be found for the trigger in UpdatePanel". I tried to add the trigger at runtime in Page_Init or Page_Load, but it fails with the user control being null, although it has ViewState enabled. Has someone an idea on how to solve this? Here is the code of the user control: <%@ Control Language="C#" AutoEventWireup="true" CodeFile="ComponentDropDownControl.ascx.cs" Inherits="ComponentDropDownControl" EnableViewState="true" %> <asp:DropDownList ID="ComponentDropDown" runat="server" DataSourceID="ComponentFile" DataTextField="name" DataValueField="name" OnSelectedIndexChanged="ComponentDropDown_SelectedIndexChanged" AutoPostBack="True" EnableTheming="True"> </asp:DropDownList><asp:XmlDataSource ID="ComponentFile" runat="server" DataFile="~/App_Data/Components.xml" XPath="//component"></asp:XmlDataSource> And here it is in the aspx page: <%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="create.aspx.cs" Inherits="create" Title="Create task" %> <%@ Register Src="ComponentDropDownControl.ascx" TagName="ComponentDropDownControl" TagPrefix="uc1" %> ... <uc1:ComponentDropDownControl ID="CustomComponentDropDown" runat="server" EnableViewState="true" /> In the Page_Load function of the aspx page, the following lines work at first time, but fail on the first PostBack (line 2, CustomComponentDropDown is null). AsyncPostBackTrigger trigger = new AsyncPostBackTrigger(); trigger.ControlID = CustomComponentDropDown.UniqueID.ToString(); UpdatePanel1.Triggers.Add(trigger);

    Read the article

  • How to use custom UITableViewCell from Interface Builder?

    - by Krumelur
    I want to be able to design my own UITableViewCell in IB. But I keep getting a null ref exception when trying to access the label I defined in IB. Here's what I'm doing: In Interface Builder: I removed the "View" and added a UITableViewCell instead. Changed the class of the UITableViewCell to "TestCellView". Added a UILabel to the cell. Added an outlet "oLblText" to TestCellView and connected the UILabel to it. Changed the identifier of the class to "TestCellView". Implement TestCellView.xib.cs public partial class TestCellView : UITableViewCell { public TestCellView(string sKey) : base(UITableViewCellStyle.Default, sKey) { } public TestCellView(IntPtr oHandle) : base(oHandle) { } public string TestText { get { return this.oLblText.Text; } set { // HERE I get the null ref exception! this.oLblText.Text = value; } } } ** The TestCellView.designer.cs** [MonoTouch.Foundation.Register("TestCellView")] public partial class TestCellView { private MonoTouch.UIKit.UILabel __mt_oLblText; #pragma warning disable 0169 [MonoTouch.Foundation.Connect("oLblText")] private MonoTouch.UIKit.UILabel oLblText { get { this.__mt_oLblText = ((MonoTouch.UIKit.UILabel)(this.GetNativeField("oLblText"))); return this.__mt_oLblText; } set { this.__mt_oLblText = value; this.SetNativeField("oLblText", value); } } } In my table's source: public override UITableViewCell GetCell (UITableView tableView, NSIndexPath indexPath) { TestCellView oCell = (TestCellView)tableView.DequeueReusableCell("myCell"); if(oCell == null) { // I suppose this is wrong but how to do it correctly? // this == my UITableViewSource. NSBundle.MainBundle.LoadNib("TestCellView", this, null); oCell = new TestCellView("myCell"); } oCell.TestText = "Cell " + indexPath.Row; return oCell; } Please note that I do NOT want a solution that involves a UIViewController for every cell. I have seen a couple of examples on the web doing this. I just think it is total overkill. What am I doing wrong?

    Read the article

  • Help with use of .NET Generics/Dictionary in replacing my Arrays

    - by Rollo R
    Hello, I have these code: Mypage.cs string[] strParameterName = new string[2] {"?FirstName", "?LastName"}; string[] strParameterValue = new string[2] {"Josef", "Stalin"}; MyConnection.MySqlLink(strConnection, strCommand, strParameterName, strParameterValue, dtTable); Myclass.cs public static void MySqlLink(string strConnection, string strCommand, string[] strParameterName, string[] strParameterValue, DataTable dtTable) { dtTable.Clear(); MySqlConnection MyConnection = new MySqlConnection(strConnection); MySqlCommand MyCommand = new MySqlCommand(strCommand, MyConnection); for (int i = 0; i < strParameterName.Length; i++) { MyCommand.Parameters.AddWithValue(strParameterName[i].ToString(), strParameterValue[i].ToString()); } MySqlDataAdapter MyDataAdapter = new MySqlDataAdapter(MyCommand); MyDataAdapter.Fill(dtTable); } And then my Sql Command will be something like "SELECT * FROM MyTable WHERE FirstName=?FirstName AND LastName=?LastName" As you can see, I am using arrays for the Parameter Name and Parameter Value and they both have to "match" with each other and ofcourse the Sql Command. Someone recommended to me that I use .NET "Dictionary" instead of arrays. Now I have never used that before. Can someone show me a relative example of how I am to use .NET Dictionary here?

    Read the article

< Previous Page | 52 53 54 55 56 57 58 59 60 61 62 63  | Next Page >