Search Results

Search found 15579 results on 624 pages for 'transfer settings'.

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

  • Persisting settings without using Options dialog in Visual Studio

    - by Utkarsh Shigihalli
    Originally posted on: http://geekswithblogs.net/onlyutkarsh/archive/2013/11/02/persisting-settings-without-using-options-dialog-in-visual-studio.aspxIn one of my previous blog post we have seen persisting settings using Visual Studio's options dialog. Visual Studio options has many advantages in automatically persisting user options for you. However, during our latest Team Rooms extension development, we decided to provide our users; ability to use our preferences directly from Team Explorer. The main reason was that we had only one simple option for user and we thought it is cumbersome for user to go to Tools –> Options dialog to change this. Another reason was, we wanted to highlight this setting to user as soon as he is using our extension.   So if you are in such a scenario where you do not want to use VS options window, but still would like to persist the settings, this post will guide you through. Visual Studio SDK provides two ways to persist settings in your extensions. One is using DialogPage as shown in my previous post. Another way is to use by implementing IProfileManager interface which I will explain in this post. Please note that the class implementing IProfileManager should be independent class. This is because, VS instantiates this class during Tools –> Import and Export Settings. IProfileManager provides 2 different sets of methods (total 4 methods) to persist the settings. They are LoadSettingsFromXml and SaveSettingsToXml – Implement these methods to persist settings to disk from VS settings storage. The VS will persist your settings along with other options to disk. LoadSettingsFromStorage and SaveSettingsToStorage – Implement these methods to persist settings to local storage, usually it be registry. VS calls LoadSettingsFromStorage method when it is initializing the package too. We are going to use the 2nd set of methods for this example. First, we are creating a separate class file called UserOptions.cs. Please note that, we also need to implement IComponent, which can be done by inheriting Component along with IProfileManager. [ComVisible(true)] [Guid("XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX")] public class UserOptions : Component, IProfileManager { private const string SUBKEY_NAME = "TForVS2013"; private const string TRAY_NOTIFICATIONS_STRING = "TrayNotifications"; ... } Define the property so that it can be used to set and get from other classes. public bool TrayNotifications { get; set; } Implement the members of IProfileManager. public void LoadSettingsFromStorage() { RegistryKey reg = null; try { using (reg = Package.UserRegistryRoot.OpenSubKey(SUBKEY_NAME)) { if (reg != null) { // Key already exists, so just update this setting. TrayNotifications = Convert.ToBoolean(reg.GetValue(TRAY_NOTIFICATIONS_STRING, true)); } } } catch (TeamRoomException exception) { TrayNotifications = true; ExceptionReporting.Report(exception); } finally { if (reg != null) { reg.Close(); } } } public void LoadSettingsFromXml(IVsSettingsReader reader) { reader.ReadSettingBoolean(TRAY_NOTIFICATIONS_STRING, out _isTrayNotificationsEnabled); TrayNotifications = (_isTrayNotificationsEnabled == 1); } public void ResetSettings() { } public void SaveSettingsToStorage() { RegistryKey reg = null; try { using (reg = Package.UserRegistryRoot.OpenSubKey(SUBKEY_NAME, true)) { if (reg != null) { // Key already exists, so just update this setting. reg.SetValue(TRAY_NOTIFICATIONS_STRING, TrayNotifications); } else { reg = Package.UserRegistryRoot.CreateSubKey(SUBKEY_NAME); reg.SetValue(TRAY_NOTIFICATIONS_STRING, TrayNotifications); } } } catch (TeamRoomException exception) { ExceptionReporting.Report(exception); } finally { if (reg != null) { reg.Close(); } } } public void SaveSettingsToXml(IVsSettingsWriter writer) { writer.WriteSettingBoolean(TRAY_NOTIFICATIONS_STRING, TrayNotifications ? 1 : 0); } Let me elaborate on the method implementation. The Package class provides UserRegistryRoot (which is HKCU\Microsoft\VisualStudio\12.0 for VS2013) property which can be used to create and read the registry keys. So basically, in the methods above, I am checking if the registry key exists already and if not, I simply create it. Also, in case there is an exception I return the default values. If the key already exists, I update the value. Also, note that you need to make sure that you close the key while exiting from the method. Very simple right? Accessing and settings is simple too. We just need to use the exposed property. UserOptions.TrayNotifications = true; UserOptions.SaveSettingsToStorage(); Reading settings is as simple as reading a property. UserOptions.LoadSettingsFromStorage(); var trayNotifications = UserOptions.TrayNotifications; Lastly, the most important step. We need to tell Visual Studio shell that our package exposes options using the UserOptions class. For this we need to decorate our package class with ProvideProfile attribute as below. [ProvideProfile(typeof(UserOptions), "TForVS2013", "TeamRooms", 110, 110, false, DescriptionResourceID = 401)] public sealed class TeamRooms : Microsoft.VisualStudio.Shell.Package { ... } That's it. If everything is alright, once you run the package you will also see your options appearing in "Import Export settings" window, which allows you to export your options.

    Read the article

  • Blackberry - application settings save/load

    - by Max Gontar
    Hi! I know two ways to save/load application settings: use PersistentStore use filesystem (store, since SDCard is optional) I'd like to know what are you're practicies of working with application settings? Using PersistentStore to save/load application settings The persistent store provides a means for objects to persist across device resets. A persistent object consists of a key-value pair. When a persistent object is committed to the persistent store, that object's value is stored in flash memory via a deep copy. The value can then be retrieved at a later point in time via the key. Example of helper class for storing and retrieving settings: class PSOptions { private PersistentObject mStore; private LongHashtableCollection mSettings; private long KEY_URL = 0; private long KEY_ENCRYPT = 1; private long KEY_REFRESH_PERIOD = 2; public PSOptions() { // "AppSettings" = 0x71f1f00b95850cfeL mStore = PersistentStore.getPersistentObject(0x71f1f00b95850cfeL); } public String getUrl() { Object result = get(KEY_URL); return (null != result) ? (String) result : null; } public void setUrl(String url) { set(KEY_URL, url); } public boolean getEncrypt() { Object result = get(KEY_ENCRYPT); return (null != result) ? ((Boolean) result).booleanValue() : false; } public void setEncrypt(boolean encrypt) { set(KEY_ENCRYPT, new Boolean(encrypt)); } public int getRefreshPeriod() { Object result = get(KEY_REFRESH_PERIOD); return (null != result) ? ((Integer) result).intValue() : -1; } public void setRefreshRate(int refreshRate) { set(KEY_REFRESH_PERIOD, new Integer(refreshRate)); } private void set(long key, Object value) { synchronized (mStore) { mSettings = (LongHashtableCollection) mStore.getContents(); if (null == mSettings) { mSettings = new LongHashtableCollection(); } mSettings.put(key, value); mStore.setContents(mSettings); mStore.commit(); } } private Object get(long key) { synchronized (mStore) { mSettings = (LongHashtableCollection) mStore.getContents(); if (null != mSettings && mSettings.size() != 0) { return mSettings.get(key); } else { return null; } } } } Example of use: class Scr extends MainScreen implements FieldChangeListener { PSOptions mOptions = new PSOptions(); BasicEditField mUrl = new BasicEditField("Url:", "http://stackoverflow.com/"); CheckboxField mEncrypt = new CheckboxField("Enable encrypt", false); GaugeField mRefresh = new GaugeField("Refresh period", 1, 60 * 10, 10, GaugeField.EDITABLE|FOCUSABLE); ButtonField mLoad = new ButtonField("Load settings", ButtonField.CONSUME_CLICK); ButtonField mSave = new ButtonField("Save settings", ButtonField.CONSUME_CLICK); public Scr() { add(mUrl); mUrl.setChangeListener(this); add(mEncrypt); mEncrypt.setChangeListener(this); add(mRefresh); mRefresh.setChangeListener(this); HorizontalFieldManager hfm = new HorizontalFieldManager(USE_ALL_WIDTH); add(hfm); hfm.add(mLoad); mLoad.setChangeListener(this); hfm.add(mSave); mSave.setChangeListener(this); loadSettings(); } public void fieldChanged(Field field, int context) { if (field == mLoad) { loadSettings(); } else if (field == mSave) { saveSettings(); } } private void saveSettings() { mOptions.setUrl(mUrl.getText()); mOptions.setEncrypt(mEncrypt.getChecked()); mOptions.setRefreshRate(mRefresh.getValue()); } private void loadSettings() { mUrl.setText(mOptions.getUrl()); mEncrypt.setChecked(mOptions.getEncrypt()); mRefresh.setValue(mOptions.getRefreshPeriod()); } }

    Read the article

  • ASP.NET file transfer from local machine to another machine

    - by Imcl
    I basically want to transfer a file from the client to the file storage server without actual login to the server so that the client cannot access the storage location on the server directly. I can do this only if i manually login to the storage server through windows login. I dont want to do that. This is a Web-Based Application. Using the link below, I wrote a code for my application. I am not able to get it right though, Please refer the link and help me ot with it... http://stackoverflow.com/questions/263518/c-uploading-files-to-file-server The following is my code:- protected void Button1_Click(object sender, EventArgs e) { filePath = FileUpload1.FileName; try { WebClient client = new WebClient(); NetworkCredential nc = new NetworkCredential(uName, password); Uri addy = new Uri("\\\\192.168.1.3\\upload\\"); client.Credentials = nc; byte[] arrReturn = client.UploadFile(addy, filePath); Console.WriteLine(arrReturn.ToString()); } catch (Exception ex) { Console.WriteLine(ex.Message); } } The following line doesn't execute... byte[] arrReturn = client.UploadFile(addy, filePath); This is the error I get: An exception occurred during a WebClient request

    Read the article

  • C# ASP.NET FILE TRANSFER FROM LOCAL MACHINE TO ANOTHER MACHINE

    - by Imcl
    I basically want to transfer a file from the client to the file storage server without actual login to the server so that the client cannot access the storage location on the server directly. I can do this only if i manually login to the storage server through windows login. I dont want to do that. This is a Web-Based Application. Using the link below, I wrote a code for my application. I am not able to get it right though, Please refer the link and help me ot with it... http://stackoverflow.com/questions/263518/c-uploading-files-to-file-server The following is my code:- protected void Button1_Click(object sender, EventArgs e) { filePath = FileUpload1.FileName; try { WebClient client = new WebClient(); NetworkCredential nc = new NetworkCredential(uName, password); Uri addy = new Uri("\\\\192.168.1.3\\upload\\"); client.Credentials = nc; byte[] arrReturn = client.UploadFile(addy, filePath); Console.WriteLine(arrReturn.ToString()); } catch (Exception ex) { Console.WriteLine(ex.Message); } } The following line doesn't execute... byte[] arrReturn = client.UploadFile(addy, filePath); THIS IS THE ERROR I GET :- "An exception occurred during a WebClient request"

    Read the article

  • Windows 7 forgets my default settings

    - by j-t-s
    Hi All I recently bought a new computer and Windows 7 Home Premium. I only have one small problem though. I have the option "Show Window Contents While Dragging" enabled, but everytime I restart the computer, it reverts back to DISabled. The only thing i could think of is the system requirements etc. But this is not the case as my computer more than meets the full requirements. Can somebody help me please? Thank you

    Read the article

  • How to Make Red zone Network settings to Endian OS

    - by Gash
    Please help me, Currently we have about 10 pc's sharing internet. and We have CISCO 800 series router that connect the ADSL, to the lan Segment it connect switch throw the switch all pc's are getting connecting. all user pc's having 192.168.3.--- range ips and gateway is 192.168.3.254 now i install the endian firewall to one PC, it must work as firewall,VPN & proxy i made green zone ip as 192.168.3.222 then how to give red zone IP? i know that is static IP but it cant be same range so please help me out to sort this without changing anything in router, if want i can change the internal IP sets instead of 3.-- 10.-- or something like that and also please state me at present i tried Endian firewall red and green zone cables are pluged in to network switch only please help me to overcome this its urgent

    Read the article

  • Force the computer to always use current display settings

    - by sazpaz
    So I'm having a terrible black screen problem with my new installation of Windows 8. The screen basically goes to black every time I turn it on or sleep, or connect to an external or monitor. I dont really know what steps actually cause the problem and cant seem to figure what steps allow the screen to come back, besides forcing restarts, going to sleep and waking up, and smashing Win + P. I have a strong feeling it's because the Switchable graphics I have (Intel HD + Radeon 5060), so I'm looking for a way to make the computer always use a specified mode (i.e the current mode I'm on, that does show stuff on the screen) and force it to use it everytime? Any ideas? EDIT: I've Installed all the latest drivers I've found. Tried most of the solutions around the web for this problem. Updated the BIOS to UEFI (from HP Support Assistant), etc. Laptop is an HP- Envy 14

    Read the article

  • Git for Application Settings

    - by devians
    I use a lot of tools at work and at home, and im constantly tweaking them in one location or the other. It's somewhat common practice for people to use Git to version their .vim, .vimrc, and other . files, since you can host your config files on github and have the share-ability and all the other advantages that implies. Being able to version and branch my configs sounds like a grand idea, since I'm always messing about with them. I'd like to discuss the best practice for doing this on a slightly wider scope. How would you implement it? Have your configfiles repo in ~/Library/Configs or similar, and symlink the appropriate files? How to handle preference files for Applications, ie iTerm2. These files are recreated every time, so you'd have to symlink 'backwards' and put a link in the repo? rather than symlinking to the repo, since it would just delete the symlink.

    Read the article

  • Is it possible to have non-English regional settings with English day/month names?

    - by Indrek
    I live in Estonia where most regional settings (number, currency and date formats) differ from those used in English-speaking countries. For instance, decimal symbol is comma, thousands separator is space, date format is day-month-year, etc. However, if I set my regional settings to Estonian, then day and month names are also shown in Estonian everywhere: This is slightly annoying since the language used for the rest of Windows is English and I'd like the day and month names to be consistent with it. Is this possible while still keeping the local regional settings? One workaround I've tried is to set regional settings to, say, English (UK) and then customise them to match Estonian settings, but that messes up alphabetic sorting - accented letters like "ö" and "ä" are no longer distinguished from their non-accented versions, and "z" is sorted as last rather than at its correct position in the Estonian alphabet (between "s" and "t"). OS is Windows 7 Professional, in case that matters. Edit: alternatively, if there's no built-in way to accomplish what I want, is it possible to create a custom set of regional settings (like one can create custom keyboard layouts)?

    Read the article

  • Mono doesn't write settings defaults

    - by Petar Minchev
    Hi guys! Here is my problem. If I use only one Windows Forms project and call only - Settings.Default.Save() when running it, Mono creates a user.config file with the default value for each setting. It is fine, so far so good. But now I add a class library project, which is referenced from the Windows Forms project and I move the settings from the Windows Forms project to the Class Library one. Now I do the same - Settings.Default.Save() and to my great surprise, Mono creates a user.config file with EMPTY values(NOT the default ones) for each setting?! What's the difference between having the settings in the Windows Forms Project or in the class library one? And by the way it is not a operating system issue. It is a Mono issue, because it doesn't work both under Windows and Linux. If I don't use Mono everything is fine, but I have to port my application to Linux, so I have to use Mono. I am really frustrated, it is blocking a project:( Thanks in advance for any suggestion you have. Regards, Petar

    Read the article

  • OpenCV: Getting and Setting Camera Settings

    - by jhaip
    I have been searching around and can't find an example of how to get and set the camera capturing settings. For example the capturing resolution, fps, color balance, etc. I have only seen examples of how to change the settings when saving the captured video but I want to be able to find all the camera's capturing modes and choose which one I want. For example, I am using the PS3eye webcam and in the test program it allows you to change the settings (320x240 at 15,30,60,120 fps, 640x480 at 15,30,60,75 fps). So is there a function in OpenCV for getting all the camera's capture modes and choosing one? I remember in OpenFrameworks there was a function to change these settings but I would like to know how to do it in OpenCV. Here is the code for OpenFrameworks with OpenCV that does sort of what I want: vidGrabber.setDeviceID( 4 ); vidGrabber.setDesiredFrameRate( 30 ); //I want this vidGrabber.videoSettings(); vidGrabber.setVerbose(true); vidGrabber.initGrabber(320,240); //And this

    Read the article

  • Set default tab url in firefox 14

    - by sebster
    In the latest firefox update, new tabs show -instead of the previously default blank page- a window of recently viewed pages. Before this was available, I had installed an 'addon' to allow this (called 'fvd speed dial'). It worked fine however I have since delete.d this as it is no longer needed but still loads the page where the addon was housed:'chrome://fvd.speeddial/content/fvd_about_blank.html'. I have reinstalled firefox yet the same problem still occurs. On the 'about:config' page I have found the setting 'browser.newtab.url' but do not know the default url. Is there any way to remedy this? I will just add, I appologise if this is not the case with the new tab feature. It is all I have gathered from the firefox update page. Also, I do not want to, ideally, simply restore my settings as I have changed some of them (such as the search bar, that work fine. I am on windows-xp, home edition. Not sure of what service pack.

    Read the article

  • [Android] Change language settings (locale) for the device

    - by raychenon
    Hi, I know it's possible to have multiple languages in a single application through the res/string and depending on Locale. Here is a case http://stackoverflow.com/questions/2078289/android-controling-the-user-language Now how can I change the language in the phone ? Like I'd do by Menu Settings Language & Keyboard Select locale languages Is there some real code to access to these settings ? Or should I create intent for a shortcut to the language settings. Please post some code Edit : With Locale class developer.android.com/intl/fr/reference/java/util/Locale.html The constructor is at least Locale(String language) The input is language. How can you retrieve the current language used on the device ?

    Read the article

  • Rails application settings?

    - by Danny McClelland
    Hi Everyone, I am working on a Rails application that has user authentication which provides an administrators account. Within the administrators account I have made a page for sitewide settings. I was wondering what the norm is for creating these settings. Say for example I would like one of the settings to be to change the name of the application name, or change a colour of the header. What I am looking for is for someone to explain the basic process/method - not necessarily specific code - although that would be great! Thanks, Danny

    Read the article

  • Force VSProps settings to override project settings

    - by Steve
    I have a vsprops file that defines the optimizations all of our projects should be built with for Visual Studio 2008. If I set the properties for the project to "inherit from parent of project defaults" it works, and fills them in the vcproj file. However, this doesn't protect me from a developer checking in a project file that changes the optimizations. In this case, the project settings are used over the vsprops settings. I need to make it so that vsprops always takes precedence over what is in the vcproj file. Is this possible? Other workarounds are also welcome.

    Read the article

  • Add/remove UILocalNotification based on changes in my settings bundle

    - by Daniel Chui
    I have an app that sends a notification at the same time everyday, reminding the user to enter data into it. However, I want to give the user teh option to disable this as this could get very annoying, so I have an "Enable alerts" in a custom settings bundle. My question is, when the user toggles the switch in the settings bundle, can I add/remove the notifications that are already scheduled without having to enter the app again? note: I'm building and supporting for iOS 4.2.1, and I don't konw why but under "notifications" in the settings app, my app does not appear. I see it on ios 5.x devices though

    Read the article

  • Cross-platform configuration, options, settings, preferences, defaults

    - by hippietrail
    I'm interested in peoples' views on how best to store preferences and default settings in cross-platform applications. I primarily work in Perl on *nix and Windows but I'm also interested in the bigger picture. In the *nix world "dotfiles" (and directories) are very common with system-wide or application default settings generally residing in one path and user-specific settings in the home directory. Such files and dirs begin with a dot "." and are hidden by default from directory listings. Windows has the registry which also has paths for defaults and per-user overrides. Certain cross-platforms do it their own way, Firefox uses JavaScript preference files. Should a cross-platform app use one system across platforms or say dotfiles on *nix and registry on Windows? Does your favourite programming language have a library or module for accessing them in a standard way? Is there an emerging best practice or does everybody roll their own?

    Read the article

  • How to use iTunes USB File Transfer to copy files from PC to Apple iPad, e.g. PDF files for viewer a

    - by Chris W. Rea
    I'm interested in reading PDF-format ebooks on my Apple iPad. I have half a gig of PDFs I want to transfer to it, from my PC. I'm familiar already with loading EPUB-format titles through iBooks – unfortunately, iBooks doesn't read PDFs so I am looking at using a third-party application. I know many such third-party media viewer applications for the iPad support download from web or email, but that's a hassle. I've heard iTunes 9.1 added support for USB File Transfer, specifically for iPad devices. How does USB File Transfer work in iTunes, for transferring files from my PC to my iPad? Please provide example steps. Moderators: Please remember the FAQ's "except insofar as they interface with your computer." ;-)

    Read the article

  • Live wallpaper settings not applying

    - by Steve
    I have added settings to my live wallpaper but they are not being applied when changed. I would greatly appreciate it if someone could tell me why my settings are not being applied when changed. Here is my code: settings.xml <PreferenceCategory android:title="@string/more"> <PreferenceScreen android:title="@string/more"> <intent android:action="android.intent.action.VIEW" android:data="market://search?q=pub:PSP Demo Center" /> </PreferenceScreen> <ListPreference android:persistent="true" android:enabled="true" android:entries="@array/settings_light_number_options" android:title="@string/settings_light_number" android:key="light_power" android:summary="@string/settings_light_number_summary" android:defaultValue="3" android:entryValues="@array/settings_light_number_optionvalues" /> <ListPreference android:persistent="true" android:enabled="false" android:entries="@array/settings_speed_number_options" android:title="@string/settings_speed_number" android:key="speed" android:summary="@string/settings_speed_number_summary" android:defaultValue="10" android:entryValues="@array/settings_speed_number_optionvalues" /> <ListPreference android:persistent="true" android:enabled="false" android:entries="@array/settings_rotate_number_options" android:title="@string/settings_rotate_number" android:key="rotate" android:summary="@string/settings_rotate_number_summary" android:defaultValue="8000" android:entryValues="@array/settings_rotate_number_optionvalues" /> </PreferenceCategory> </PreferenceScreen> Settings.java public class GraffitiLWPSettings extends PreferenceActivity implements SharedPreferences .OnSharedPreferenceChangeListener { public static final String SHARED_PREFS_NAME = "wallpaper_settings"; protected void onCreate(Bundle icicle) { super.onCreate(icicle); getPreferenceManager(). setSharedPreferencesName(GraffitiLWP.SHARED_PREFS_NAME); addPreferencesFromResource(R.xml.settings); getPreferenceManager().getSharedPreferences(). registerOnSharedPreferenceChangeListener(this); } protected void onResume() { super.onResume(); } protected void onDestroy() { getPreferenceManager().getSharedPreferences() .unregisterOnSharedPreferenceChangeListener(this); super.onDestroy(); } public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { } } wallpaper.java public class GraffitiLWP extends Wallpaper { private GraffitiLWPRenderer mRenderer; public static final String SHARED_PREFS_NAME = "wallpaper_settings"; public Engine onCreateEngine() { mRenderer = new GraffitiLWPRenderer(this); return new WallpaperEngine( this.getSharedPreferences(SHARED_PREFS_NAME, Context.MODE_PRIVATE), getBaseContext(), mRenderer); } } renderer.java public class GraffitiLWPRenderer extends RajawaliRenderer { private Animation3D mAnim; private BaseObject3D mCan; private SettingsUpdater settingsUpdater; //private SharedPreferences preferences; public GraffitiLWPRenderer(Context context) { super(context); setFrameRate(20); } public class SettingsUpdater implements SharedPreferences .OnSharedPreferenceChangeListener { private GraffitiLWPRenderer renderer; public SettingsUpdater(GraffitiLWPRenderer renderer) { this.renderer = renderer; } public void onSharedPreferenceChanged( SharedPreferences sharedPreferences, String key) { preferences.getInt("wallpaper_settings", 0); renderer.setSharedPreferences(preferences); } } public void initScene() { System.gc(); ALight light = new DirectionalLight(); light.setPower(this.preferences.getLong("light_power", 3)); light.setPosition(0, 0, -10); mCamera.setPosition(0, -1, -7); mCamera.setLookAt(0, 2, 0); mCamera.setFarPlane(1000); ObjParser parser = new ObjParser(mContext .getResources(), mTextureManager, R.raw.spraycan_obj); parser.parse(); mCan = parser.getParsedObject(); mCan.addLight(light); mCan.setScale(1.2f); addChild(mCan); Number3D axis = new Number3D(0, this.preferences.getLong("speed", 10), 0); axis.normalize(); mAnim = new RotateAnimation3D(axis, 360); mAnim.setDuration(this.preferences.getLong("rotate", 8000)); mAnim.setRepeatCount(Animation3D.INFINITE); mAnim.setInterpolator(new AccelerateDecelerateInterpolator()); mAnim.setTransformable3D(mCan); setSkybox(R.drawable.posz, R.drawable.posx, R.drawable.negz, R.drawable.negx, R.drawable.posy, R.drawable.negy); } public void onSurfaceCreated(GL10 gl, EGLConfig config) { settingsUpdater = new SettingsUpdater(this); this.preferences.registerOnSharedPreferenceChangeListener( settingsUpdater); settingsUpdater.onSharedPreferenceChanged(preferences, null); super.onSurfaceCreated(gl, config); mAnim.start(); } public void onDrawFrame(GL10 glUnused) { super.onDrawFrame(glUnused); mSkybox.setRotY(mSkybox.getRotY() + .5f); } } I know the code is long but I would greatly appreciate any help that someone could give me. Thank you.

    Read the article

  • Configuring Application/User Settings in WPF the easy way.

    - by mbcrump
    In this tutorial, we are going to configure the application/user settings in a WPF application the easy way. Most example that I’ve seen on the net involve the ConfigurationManager class and involve creating your own XML file from scratch. I am going to show you a easier way to do it. (in my humble opinion) First, the definitions: User Setting – is designed to be something specific to the user. For example, one user may have a requirement to see certain stocks, news articles or local weather. This can be set at run-time. Application Setting – is designed to store information such as a database connection string. These settings are read-only at run-time. 1) Lets create a new WPF Project and play with a few settings. Once you are inside VS, then paste the following code snippet inside the <Grid> tags. <Grid> <TextBox Height="23" HorizontalAlignment="Left" Margin="12,11,0,0" Name="textBox1" VerticalAlignment="Top" Width="285" Grid.ColumnSpan="2" /> <Button Content="Set Title" Name="button2" Click="button2_Click" Margin="108,40,96,114" /> <TextBlock Height="23" Name="textBlock1" Text="TextBlock" VerticalAlignment="Bottom" Width="377" /> </Grid> Basically, its just a Textbox, Button and TextBlock. The main Window should look like the following:   2) Now we are going to setup our Configuration Settings. Look in the Solution Explorer and double click on the Settings.settings file. Make sure that your settings file looks just like mine included below:   What just happened was the designer created an XML file and created the Settings.Designer.cs file which looks like this: //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Runtime Version:4.0.30319.1 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ namespace WPFExam.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")] internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); public static Settings Default { get { return defaultInstance; } } [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("ApplicationName")] public string ApplicationName { get { return ((string)(this["ApplicationName"])); } set { this["ApplicationName"] = value; } } [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("SQL_SRV342")] public string DatabaseServerName { get { return ((string)(this["DatabaseServerName"])); } } } } The XML File is named app.config and looks like this: <?xml version="1.0" encoding="utf-8" ?> <configuration> <configSections> <sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" > <section name="WPFExam.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" /> </sectionGroup> <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" > <section name="WPFExam.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> </sectionGroup> </configSections> <userSettings> <WPFExam.Properties.Settings> <setting name="ApplicationName" serializeAs="String"> <value>ApplicationName</value> </setting> </WPFExam.Properties.Settings> </userSettings> <applicationSettings> <WPFExam.Properties.Settings> <setting name="DatabaseServerName" serializeAs="String"> <value>SQL_SRV342</value> </setting> </WPFExam.Properties.Settings> </applicationSettings> </configuration> 3) The only left now is the code behind the button. Double click the button and replace the MainWindow() method with the following code snippet. public MainWindow() { InitializeComponent(); this.Title = Properties.Settings.Default.ApplicationName; textBox1.Text = Properties.Settings.Default.ApplicationName; textBlock1.Text = Properties.Settings.Default.DatabaseServerName; } private void button2_Click(object sender, RoutedEventArgs e) { Properties.Settings.Default.ApplicationName = textBox1.Text.ToString(); Properties.Settings.Default.Save(); } Run the application and type something in the textbox and hit the Set Title button. Now, restart the application and you should see the text that you entered earlier.   If you look at the button2 click event, you will see that it was actually 2 lines of codes to save to the configuration file. I hope this helps, for more information consult MSDN.

    Read the article

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