Search Results

Search found 7595 results on 304 pages for 'functionality'.

Page 9/304 | < Previous Page | 5 6 7 8 9 10 11 12 13 14 15 16  | Next Page >

  • MVVM - implementing 'IsDirty' functionality to a ModelView in order to save data

    - by Brendan
    Hi, Being new to WPF & MVVM I struggling with some basic functionality. Let me first explain what I am after, and then attach some example code... I have a screen showing a list of users, and I display the details of the selected user on the right-hand side with editable textboxes. I then have a Save button which is DataBound, but I would only like this button to display when data has actually changed. ie - I need to check for "dirty data". I have a fully MVVM example in which I have a Model called User: namespace Test.Model { class User { public string UserName { get; set; } public string Surname { get; set; } public string Firstname { get; set; } } } Then, the ViewModel looks like this: using System.Collections.ObjectModel; using System.Collections.Specialized; using System.Windows.Input; using Test.Model; namespace Test.ViewModel { class UserViewModel : ViewModelBase { //Private variables private ObservableCollection<User> _users; RelayCommand _userSave; //Properties public ObservableCollection<User> User { get { if (_users == null) { _users = new ObservableCollection<User>(); //I assume I need this Handler, but I am stuggling to implement it successfully //_users.CollectionChanged += HandleChange; //Populate with users _users.Add(new User {UserName = "Bob", Firstname="Bob", Surname="Smith"}); _users.Add(new User {UserName = "Smob", Firstname="John", Surname="Davy"}); } return _users; } } //Not sure what to do with this?!?! //private void HandleChange(object sender, NotifyCollectionChangedEventArgs e) //{ // if (e.Action == NotifyCollectionChangedAction.Remove) // { // foreach (TestViewModel item in e.NewItems) // { // //Removed items // } // } // else if (e.Action == NotifyCollectionChangedAction.Add) // { // foreach (TestViewModel item in e.NewItems) // { // //Added items // } // } //} //Commands public ICommand UserSave { get { if (_userSave == null) { _userSave = new RelayCommand(param => this.UserSaveExecute(), param => this.UserSaveCanExecute); } return _userSave; } } void UserSaveExecute() { //Here I will call my DataAccess to actually save the data } bool UserSaveCanExecute { get { //This is where I would like to know whether the currently selected item has been edited and is thus "dirty" return false; } } //constructor public UserViewModel() { } } } The "RelayCommand" is just a simple wrapper class, as is the "ViewModelBase". (I'll attach the latter though just for clarity) using System; using System.ComponentModel; namespace Test.ViewModel { public abstract class ViewModelBase : INotifyPropertyChanged, IDisposable { protected ViewModelBase() { } public event PropertyChangedEventHandler PropertyChanged; protected virtual void OnPropertyChanged(string propertyName) { PropertyChangedEventHandler handler = this.PropertyChanged; if (handler != null) { var e = new PropertyChangedEventArgs(propertyName); handler(this, e); } } public void Dispose() { this.OnDispose(); } protected virtual void OnDispose() { } } } Finally - the XAML <Window x:Class="Test.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:vm="clr-namespace:Test.ViewModel" Title="MainWindow" Height="350" Width="525"> <Window.DataContext> <vm:UserViewModel/> </Window.DataContext> <Grid> <ListBox Height="238" HorizontalAlignment="Left" Margin="12,12,0,0" Name="listBox1" VerticalAlignment="Top" Width="197" ItemsSource="{Binding Path=User}" IsSynchronizedWithCurrentItem="True"> <ListBox.ItemTemplate> <DataTemplate> <StackPanel> <TextBlock Text="{Binding Path=Firstname}"/> <TextBlock Text="{Binding Path=Surname}"/> </StackPanel> </DataTemplate> </ListBox.ItemTemplate> </ListBox> <Label Content="Username" Height="28" HorizontalAlignment="Left" Margin="232,16,0,0" Name="label1" VerticalAlignment="Top" /> <TextBox Height="23" HorizontalAlignment="Left" Margin="323,21,0,0" Name="textBox1" VerticalAlignment="Top" Width="120" Text="{Binding Path=User/UserName}" /> <Label Content="Surname" Height="28" HorizontalAlignment="Left" Margin="232,50,0,0" Name="label2" VerticalAlignment="Top" /> <TextBox Height="23" HorizontalAlignment="Left" Margin="323,52,0,0" Name="textBox2" VerticalAlignment="Top" Width="120" Text="{Binding Path=User/Surname}" /> <Label Content="Firstname" Height="28" HorizontalAlignment="Left" Margin="232,84,0,0" Name="label3" VerticalAlignment="Top" /> <TextBox Height="23" HorizontalAlignment="Left" Margin="323,86,0,0" Name="textBox3" VerticalAlignment="Top" Width="120" Text="{Binding Path=User/Firstname}" /> <Button Content="Button" Height="23" HorizontalAlignment="Left" Margin="368,159,0,0" Name="button1" VerticalAlignment="Top" Width="75" Command="{Binding Path=UserSave}" /> </Grid> </Window> So basically, when I edit a surname, the Save button should be enabled; and if I undo my edit - well then it should be Disabled again as nothing has changed. I have seen this in many examples, but have not yet found out how to do it. Any help would be much appreciated! Brendan

    Read the article

  • What does WIX's CloseApplication functionality do and how would can the application respond to such

    - by tronda
    In the WIX setup I've got, when upgrading the application I have set a requirement to close down applications which might hold on to files which needs to be updated: <util:CloseApplication Id="CloseMyApp" Target="[MyAppExe]" CloseMessage="no" Description="!(loc.MyAppStillRunning)" RebootPrompt="no" ElevatedCloseMessage="no" /> The application on the other hand will capture closing down the window with a "user friendly" dialog box where the user can confirm that he or she wants to close down the application. I've experienced problems with the CloseApplication, and one theory is that the dialog box stops the application from closing. So the question is: Could this be a possible problem? If so - how can I have this confirmation dialog box and still behave properly when the installer asks the application to close down? Must I listen to Win32 messages (such as WM_QUIT/WM_CLOSE) or is there a .NET API which I can use to respond properly to these events?

    Read the article

  • Inbox Functionality with MYSQL

    - by Faisal Abid
    So I am writing a simple inbox private message system, my table schema is as follows - messageID - message - sender id - receiver id - date sent - read ( 0 = no , 1 = yes) now I am able to show the messages for the user by relating his userID to receiverID. However I also want to show the messages he has sent in the inbox to the user. For example his inbox should show Darth Vader - 3 New messages Luke - 0 new messages (0 because either I read all of them OR i sent him the message and he has not replied). But what i can only come up with is Darth Vader - 3 New messages. Can I get any help with how I can accomplish this SQL call?

    Read the article

  • Managed (.net) library with html-tidy like functionality?

    - by Eamon Nerbonne
    Does anybody know of an html cleaner for .NET that can parse html and (for instance) convert it to a more machine friendly format such as xhtml? I've tried the HTML Agility Pack, but that fails to correctly parse even fairly simple examples. To give an example of html that should be parsed correctly: <html><body> <ul><li>TestElem1 <li>TestElem2 <li>TestElem3 List: <ul><li>Nested1 <li>Nested2</li> <li>Nested3 </ul> <li>TestElem4 </ul> <p>paragraph 1 <p>paragraph 2 <p>paragraph 3 </body></html> li tags don't need to be closed (see spec), and neither do P tags. In other words, the above sample should be parsed as: <html><body> <ul><li>TestElem1</li> <li>TestElem2</li> <li>TestElem3 List: <ul><li>Nested1</li> <li>Nested2</li> <li>Nested3</li> </ul></li> <li>TestElem4</li> </ul> <p>paragraph 1</p> <p>paragraph 2</p> <p>paragraph 3</p> </body></html> Since the aim is to use the library on various machines, it's a big disadvantage to need to fall back to native code (such as a wrapper around html tidy) which would require extra deployment hassle and sacrifice platform independance. Any suggestions? To recap, I'm looking for: An html cleaner ala HTML tidy Must be able to deal with real world html, not just xhtml, at the very least correctly reading valid html 4 Must be able to convert to a more easily processable xml format Should be a purely managed app.

    Read the article

  • Django app that can provide user friendly, multiple / mass file upload functionality to other apps

    - by hopla
    Hi, I'm going to be honest: this is a question I asked on the Django-Users mailinglist last week. Since I didn't get any replies there yet, I'm reposting it on Stack Overflow in the hope that it gets more attention here. I want to create an app that makes it easy to do user friendly, multiple / mass file upload in your own apps. With user friendly I mean upload like Gmail, Flickr, ... where the user can select multiple files at once in the browse file dialog. The files are then uploaded sequentially or in parallel and a nice overview of the selected files is shown on the page with a progress bar next to them. A 'Cancel' upload button is also a possible option. All that niceness is usually solved by using a Flash object. Complete solutions are out there for the client side, like: SWFUpload http://swfupload.org/ , FancyUpload http://digitarald.de/project/fancyupload/ , YUI 2 Uploader http://developer.yahoo.com/yui/uploader/ and probably many more. Ofcourse the trick is getting those solutions integrated in your project. Especially in a framework like Django, double so if you want it to be reusable. So, I have a few ideas, but I'm neither an expert on Django nor on Flash based upload solutions. I'll share my ideas here in the hope of getting some feedback from more knowledgeable and experienced people. (Or even just some 'I want this too!' replies :) ) You will notice that I make a few assumptions: this is to keep the (initial) scope of the application under control. These assumptions are of course debatable: All right, my idea's so far: If you want to mass upload multiple files, you are going to have a model to contain each file in. I.e. the model will contain one FileField or one ImageField. Models with multiple (but ofcourse finite) amount of FileFields/ ImageFields are not in need of easy mass uploading imho: if you have a model with 100 FileFields you are doing something wrong :) Examples where you would want my envisioned kind of mass upload: An app that has just one model 'Brochure' with a file field, a title field (dynamically created from the filename) and a date_added field. A photo gallery app with models 'Gallery' and 'Photo'. You pick a Gallery to add pictures to, upload the pictures and new Photo objects are created and foreign keys set to the chosen Gallery. It would be nice to be able to configure or extend the app for your favorite Flash upload solution. We can pick one of the three above as a default, but implement the app so that people can easily add additional implementations (kinda like Django can use multiple databases). Let it be agnostic to any particular client side solution. If we need to pick one to start with, maybe pick the one with the smallest footprint? (smallest download of client side stuff) The Flash based solutions asynchronously (and either sequentially or in parallel) POST the files to a url. I suggest that url to be local to our generic app (so it's the same for every app where you use our app in). That url will go to a view provided by our generic app. The view will do the following: create a new model instance, add the file, OPTIONALLY DO EXTRA STUFF and save the instance. DO EXTRA STUFF is code that the app that uses our app wants to run. It doesn't have to provide any extra code, if the model has just a FileField/ImageField the standard view code will do the job. But most app will want to do extra stuff I think, like filling in the other fields: title, date_added, foreignkeys, manytomany, ... I have not yet thought about a mechanism for DO EXTRA STUFF. Just wrapping the generic app view came to mind, but that is not developer friendly, since you would have to write your own url pattern and your own view. Then you have to tell the Flash solutions to use a new url etc... I think something like signals could be used here? Forms/Admin: I'm still very sketchy on how all this could best be integrated in the Admin or generic Django forms/widgets/... (and this is were my lack of Django experience shows): In the case of the Gallery/Photo app: You could provide a mass Photo upload widget on the Gallery detail form. But what if the Gallery instance is not saved yet? The file upload view won't be able to set the foreignkeys on the Photo instances. I see that the auth app, when you create a user, first asks for username and password and only then provides you with a bigger form to fill in emailadres, pick roles etc. We could do something like that. In the case of an app with just one model: How do you provide a form in the Django admin to do your mass upload? You can't do it with the detail form of your model, that's just for one model instance. There's probably dozens more questions that need to be answered before I can even start on this app. So please tell me what you think! Give me input! What do you like? What not? What would you do different? Is this idea solid? Where is it not? Thank you!

    Read the article

  • Strange thing about .NET 4.0 filesystem enumeratation functionality

    - by codymanix
    I just read a page of "Whats new .NET Framework 4.0". I have trouble understanding the last paragraph: To remove open handles on enumerated directories or files Create a custom method (or function in Visual Basic) to contain your enumeration code. Apply the MethodImplAttribute attribute with the NoInlining option to the new method. For example: [MethodImplAttribute(MethodImplOptions.NoInlining)] Private void Enumerate() Include the following method calls, to run after your enumeration code: * The GC.Collect() method (no parameters). * The GC.WaitForPendingFinalizers() method. Why the attribute NoInlining? What harm would inlining do here? Why call the garbage collector manually, why not making the enumerator implement IDisposable in the first place? I suspect they use FindFirstFile()/FindNextFile() API calls for the imlementation, so FindClose() has to be called in any case if the enumeration is done.

    Read the article

  • Python class design - Splitting up big classes into multiple ones to group functionality

    - by Ivo Wetzel
    OK I've got 2 really big classes 1k lines each that I currently have split up into multiple ones. They then get recombined using multiple inheritance. Now I'm wondering, if there is any cleaner/better more pythonic way of doing this. Completely factoring them out would result in endless amounts of self.otherself.do_something calls, which I don't think is the way it should be done. To make things clear here's what it currently looks like: from gui_events import GUIEvents # event handlers from gui_helpers import GUIHelpers # helper methods that don't directly modify the GUI # GUI.py class GUI(gtk.Window, GUIEvents, GUIHelpers): # general stuff here stuff here One problem that is result of this is Pylint complaining giving me trillions of "init not called" / "undefined attribute" / "attribute accessed before definition" warnings.

    Read the article

  • jQuery Javascript array 'contains' functionality?

    - by YourMomzThaBomb
    I'm trying to use the jQuery $.inArray function to iterate through an array and if there's an element whose text contains a particular keyword, remove that element. $.inArray is only returning the array index though if the element's text is equal to the keyword. For example given the following array named 'tokens': - tokens {...} Object [0] "Starbucks^25^http://somelink" String [1] "McDonalds^34^" String [2] "BurgerKing^31^https://www.somewhere.com" String And a call to removeElement(tokens, 'McDonalds'); would return the following array: - tokens {...} Object [0] "Starbucks^25^http://somelink" String [1] "BurgerKing^31^https://www.somewhere.com" String I'm guessing this may be possible using the jQuery $.grep or $.each function, or maybe regex. However, I'm not familiar enough with jQuery to accomplish this. Any help would be appreciated!

    Read the article

  • Qt::X11BypassWindowManagerHint functionality on Windows

    - by Hector
    Hi I'm currently developing a cross-plataform virtual keyboard. In linux i was able to do whatever i want, but in Windows i'm having problems to prevent the widget to obtain the keyboard focus. In linux, using the window flag Qt::X11BypassWindowManagerHint the widget never gets the keyboard input, but of course, that flag does not work on Windows Is there something equivalent to that flag or some method i can use instead? any ideas would be appreciated thanks in advance

    Read the article

  • WPF Copy / Paste functionality

    - by Wasim
    Hi all , I want to supply copy funtionality to my WPF app. I display texts in textblocks whitch comes from the server . The user cann't copy this texts and use them. How can do it ? Please you help. Thanks...

    Read the article

  • Loading an external SWF App in a new Air window with resize functionality

    - by t.stamm
    Hello everyone, i'm trying to load a local SWF Application in my Air Application via the SWFLoader class. The SWFLoader class is displayed in a new Window. Therefore, i'm trying to resize the window automatically, when the Flash Application is resizing. But here's the problem. The SWFLoader does not get any events when the loader App has been resized. The Problem seems to be the Sandbox Restrictions. I'm able to call methods in the childSandboxBridge and parentSandboxBridge Objects that i've set in the LoaderInfo of the SWFLoaders content (the loaded SWF Application). But i cannot listen to any ResizeEvents or something like that when i'm resizing the loaded App. I'm aware of the workaround with the Loader Class and the codeExecution Property, but i don't want to bypass the Air Sandbox - if possible. Can anyone help me with this? Thanks in advance

    Read the article

  • Itertools group by functionality

    - by Nil
    I want to group by on dict key >>> x [{'a': 10, 'b': 90}, {'a': 20}, {'a': 30}, {'a': 10}] >>> [(name, list(group)) for name, group in groupby(x, lambda p:p['a'])] [(10, [{'a': 10, 'b': 90}]), (20, [{'a': 20}]), (30, [{'a': 30}]), (10, [{'a': 10}])] This must group on key 10 :(

    Read the article

  • Formula parsing / evaluation routine or library with generic DLookup functionality

    - by tbone
    I am writing a .Net application where I must support user-defined formulas that can perform basic mathematics, as well as accessing data from any arbitrary table in the database. I have the math part working, using JScript Eval(). What I haven't decided on is what a nice way is to do the generic table lookups. For example, I may have a formula something like: Column: BonusAmount Formula: {CurrentSalary} * 1.5 * {[SystemSettings][Value][SettingName=CorpBonus AND Year={Year}]} So, in this example I would replace {xxx} and {Year} with the value of Column xxx from the current table, and I would replace the second part with the value of (select Value from SystemSettings WHERE SettingName='CorpBonus' AND Year=2008) So, basically, I am looking for something very much like the MS Access DLookup function: DLookup ( expression, domain, [criteria] ) DLookup("[UnitPrice]", "Order Details", "OrderID = 10248") But, I also need to overall parsing routine that can tell whether to just look up in the current row, or to look into another table. Would also be nice to support aggregate functions (ie: DAvg, DMax, etc), as well as all the weird edge cases handled. So I wonder if anyone knows of any sort of an existing library, or has a nice routine that can handle this formula parsing and database lookup / aggregate function resolution requirements.

    Read the article

  • how to implement more functionality in webpage

    - by trans
    Dear All, I have a website in front page i m displaying 5 records ,for different options,i want that when user licks more he should be able to view next records.i would i keep track as whicg list has already been shown to user,since i m using an arraylist,can i ipmlement it through that.

    Read the article

  • How do I duplicate Facebook picture tagging functionality?

    - by marcamillion
    I asked this question in another post - http://stackoverflow.com/questions/2597773/how-do-i-put-a-div-box-around-my-cursor-on-click I got a wonderful answer. See the code below: <script type="text/javascript"> $(document).ready(function() { $("#image-wrapper").click(function(e){ var ele = $("<div>"); ele.css({width:"50px", height:"50px", border:"1px solid green", position:"absolute", left: e.pageX - 25, top: e.pageY -25}); $("body").append(ele); }); }); </script> <div id="image-wrapper" style="border: 1px solid red; width: 300px; height: 200px;"> </div> The issue I am having is that when I implement this snippet, on every click a box appears and stays there. So if I click on the image 10 times, I get 10 boxes. How do I get the previous box to disappear once I click somewhere else (i.e. have the box move to another place on the image (just like with Facebook Picture Tagging))? Thanks.

    Read the article

  • How to implement Excel Solver functionality in C#?

    - by Vic
    Hi, I have an application in C#, I need to do some optimization calculations, like Excel Solver Add-in does, one option is certainly to write my own solver implementation, but I'm kind of short of time, so I'm looking into libraries that already exist that can help me with this. I've been trying the Microsoft Solver Foundation, which seems pretty neat and cool, the problem is that it doesn't seem to work with the kind of calculations that I need to do. At the end of this question I'm adding the information about the calculations I need to perform and optimize. So basically my question is if any of you know of any other library that I can use for this purpose, or any tutorial that can help to do my own solver, or any idea that gives me a lead to solve this issue. Thanks. Additional Info: This is the data I need to calculate: I have 7 variables, lets call them var1, var2,...,var7 The constraints for these variables are: All of them need to be 0 <= varn <= 0.5 (where n is the number of the variable) The sum of all the variables should be equal to 1 The objective is to maximize the target formula, which in Excel looks like this: (MMULT(TRANSPOSE(L26:L32),M14:M20)) / (SQRT(MMULT(MMULT(TRANSPOSE(L26:L32),M4:S10),L26:L32))) The range that you see in this formula, L26:L32, is actually the range with the variables from above, var1, var2,..., varn. M14:M20 and M4:S10 are ranges with data that I get from different sources, there are more likely decimal values. As I said before, I was using Microsoft Solver Foundation, I modeled pretty much everything with it, I created functions that handle the operations of the target formula, but when I tried to solve the model it always fail, I think it is because of the complexity of the operations. In any case, I just wanted to show these data so you can have an idea about the kind of calculations that I need to implement.

    Read the article

  • RIA: how to get functionality, not a data

    - by Budda
    On the server side I have the following class: public class Customer { [Key] public int Id { get; set; } public string FirstName { get; set; } public string SecondName { get; set; } public string FullName { get { return string.Concat(FirstName, " ", SecondName); } } } The problem is that each field is calculated and transferred to the client, for example 'FullName' property: [DataMember()] [Editable(false)] [ReadOnly(true)] public string FullName { get { return this._fullName; } set { if ((this._fullName != value)) { this.ValidateProperty("FullName", value); this.OnFullNameChanging(value); this._fullName = value; this.RaisePropertyChanged("FullName"); this.OnFullNameChanged(); } } } Instead of data transferring (that is traffic consuming, in some cases it introduces significant overhead). I would like to have a calculation on the client side. Is this possible without manual duplication of the property implementation? Thank you.

    Read the article

  • How to insert JSP functionality in Servlets?

    - by chustar
    How can I use Servlets to access the HTML uses of having JSP without having to have all my client-facing pages called *.jsp? I would rather do this than using all the response.write() stuff because I think it is easier to read and maintain when it is all clean "HTML". Is this is fair assesment?

    Read the article

  • Android - Camera functionality howto

    - by teepusink
    Hi, I'm using the example from the SDK (CameraPreview) and also the example from this site http://marakana.com/forums/android/android_examples/39.html When I run it, both gives this error "The application AppName(appname) has stopped unexpectedly. Please try again". I can't run the debugger either because it's always "Waiting for debugger. Force close". (I have debuggable=true in the manifest file) The phone I have is a Nexus One. Running on the emulator gives me the black and white squares with a moving square. (So I assume it works on the emulator?). Even on the emulator it gives me the "stopped unexpectedly" error 50% of the time. Does anyone know what caused it? Thanks, Tee

    Read the article

  • Adding Previous/Next Functionality to jQuery Map Highlight Plugin

    - by Keith
    As you can see in my jsFiddle example, I have a diagram that uses jQuery Map Highlight plugin to allow users to click to different parts of the diagram and see the corresponding text to the left. Right now, the only way to interact with the diagram is by clicking on it. I'd like to give users the ability to hit previous and next buttons to control it as well. I'm just not sure how to go about it. Any help would be appreciated: http://jsfiddle.net/keith/jkLH7/1/

    Read the article

< Previous Page | 5 6 7 8 9 10 11 12 13 14 15 16  | Next Page >