Can an XNA Game use IsolatedStorageSettings for WP7? - xna

I've been trying to port some Windows Phone 7 code between Silverlight to XNA which relies on IsolatedStorageSettings but I can't get Visual Studio to resolve it. When I have a look at what Intellisense is resolving under System.IO.IsolatedStorage & it lists IsolatedStorageFile, IsolatedStorageException & IsolatedStorageStream.
The documentation says that the supported version is for Silverlight but I don't understand why I am seeing the difference because of the project types.
http://msdn.microsoft.com/query/dev10.query?appId=Dev10IDEF1&l=EN-US&k=k(SYSTEM.IO.ISOLATEDSTORAGE.ISOLATEDSTORAGESETTINGS);k(ISOLATEDSTORAGESETTINGS);k(TargetFrameworkMoniker-%22SILVERLIGHT,VERSION%3dV4.0%22);k(DevLang-CSHARP)&rd=true
Thanks

The following work for me in an XNA project with no extra project references:
using (var store = IsolatedStorageFile.GetUserStoreForApplication())
{
store.CreateFile("folder/file.ext");
}
After adding a reference to System.Windows.dll I can then do:
var settings = IsolatedStorageSettings.ApplicationSettings;
settings.Add("something", "myValue");
settings.Save();
If you can't get the above working, can you post an example of what you're trying.

Related

Develop Printer Driver which can Read file and Write extra data

I need to develop a printer driver which can:-
Read the printed file (knowing the data inside the file)
Write extra information to the end of printed file. (eg. bar-code or QR code)
I plan to use V4 printer driver as template for me to start my development. I already tried to built this V4 printer driver in Visual Studio.
V4 printer driver solution explorer
Understanding the architecture of V4 printer driver may need lot of times. Besides that, I am still new in driver development, so it is hard for me to understand the document provided by Microsoft.
Can anyone suggest where should I start to code and recommend me any useful method/function or library. It will be useful if anyone can recommend some useful related reading material and what basic knowledge should I know.
See the Microsoft sample code here.
Create a "Render Filter" project (C++ project) in your "V4 Printer Driver" solution and add the sample code in "StartOperation_throws" method of newly created Render Filter.
Then use following sample code to add a custom content to your file:
XPS_COLOR testColor;
testColor.value.sRGB.alpha=0xFF;
testColor.value.sRGB.red=0xFF;
testColor.value.sRGB.green=0xFF;
testColor.value.sRGB.blue=0xFF;
testColor.colorType = XPS_COLOR_TYPE_SRGB;
FLOAT Font_Size = 14;
XPS_POINT OrgPoint = {123,123};
LPCWSTR TestStr = _T("Sample Text");
LPCWSTR Name_fnt = _T("SampleFontFile.TTF");
at the end, call "AddCustomTextToXpsDoc" using above parameters to add your text in
printable xps file.

What is use of each folder in System.Environment.SpecialFolder in iOS Xamarin

Can anyone please explain the structure of the folder structure for all the below mentioned SpecialFolder in Xamarin iOS?
Environment.SpecialFolder.AdminTools
Environment.SpecialFolder.ApplicationData
Environment.SpecialFolder.CDBurning
Environment.SpecialFolder.CommonAdminTools
Environment.SpecialFolder.CommonApplicationData
Environment.SpecialFolder.CommonDesktopDirectory
Environment.SpecialFolder.CommonDocuments
Environment.SpecialFolder.CommonMusic
Environment.SpecialFolder.CommonOemLinks
Environment.SpecialFolder.CommonPictures
Environment.SpecialFolder.CommonProgramFiles
Environment.SpecialFolder.CommonProgramFilesX86
Environment.SpecialFolder.CommonPrograms
Environment.SpecialFolder.CommonStartMenu
Environment.SpecialFolder.CommonStartup
Environment.SpecialFolder.CommonTemplates
Environment.SpecialFolder.CommonVideos
Environment.SpecialFolder.Cookies Environment.SpecialFolder.Desktop
Environment.SpecialFolder.DesktopDirectory
Environment.SpecialFolder.Favorites Environment.SpecialFolder.Fonts
Environment.SpecialFolder.History
Environment.SpecialFolder.InternetCache
Environment.SpecialFolder.LocalApplicationData
Environment.SpecialFolder.LocalizedResources
Environment.SpecialFolder.MyComputer
Environment.SpecialFolder.MyMusic
Environment.SpecialFolder.MyPictures
Environment.SpecialFolder.MyVideos
Environment.SpecialFolder.NetworkShortcuts
Environment.SpecialFolder.Personal
Environment.SpecialFolder.PrinterShortcuts
Environment.SpecialFolder.ProgramFiles
Environment.SpecialFolder.ProgramFilesX86
Environment.SpecialFolder.Programs Environment.SpecialFolder.Recent
Environment.SpecialFolder.Resources Environment.SpecialFolder.SendTo
Environment.SpecialFolder.StartMenu
Environment.SpecialFolder.Startup Environment.SpecialFolder.System
Environment.SpecialFolder.SystemX86
Environment.SpecialFolder.Templates
Environment.SpecialFolder.UserProfile
Environment.SpecialFolder.Windows
Environment.SpecialFolder.MyDocuments
Thanks
It appears the Xamarin API documentation is missing for this enum.
Here are a few of the values but not all:
Environment.SpecialFolder.ApplicationData is $HOME/.config, which is /data/data/#PACKAGE_NAME#/files/.config.
Environment.SpecialFolder.LocalApplicationData is $HOME/.local/share, which is /data/data/#PACKAGE_NAME#/files/.local/share.
Environment.SpecialFolder.Personal is $HOME, which is /data/data/#PACKAGE_NAME#/files.
Xamarin Forum Link

sqlite-net fails to create database in MonoDroid application

I start Xamarin Studio 4.0.3 and create a new solution for MonoDroid application. I am targetting version 2.3 or higher. I include Sqlite.cs from the sqlite-net (latest from site) project. I make sure I have a reference to Mono.Data.SQLite in the project. Then in the OnCreate of the default MainActivity I try to use the code shown in the readme to make a database connection:
string path = Android.OS.Environment.DataDirectory.ToString();
string dbname = path + "/" + "test.db3";
var db = new SQLiteConnection(dbname, SQLiteOpenFlags.Create|SQLiteOpenFlags.ReadWrite ,true);
However it always fails with an exception saying it can't open the database. If I follow Greg Shackles example and use SqliteDbHelper method it works, but I would like to understand what I am doing wrong that sqlite-net connection method is not working. I have a feeling I am missing something simple. I did also try just passing in a filename to SQLiteConnection() as well but when it failed I added the OpenFlags to see if that was the issue.
I just found out that apparently you're supposed to use the personal folder, instead of the databases folder:
string folder = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);
var db = new SQLiteConnection(Path.Combine(folder, "mydb.db"));

F#, problems with IntelliSense and Office

I'm trying to write some Office automation code and I cannot get IntelliSense help for the PIA Office types. The strange thing is that it works fine in C# and also in the Tutorial.vs2010 F# Solution with some of the same code.
I'm using VS10 and PIA for Office 14.
VS
Any ideas?
I forgot to include a reference to Office.dll. That appeared to fix the issue.
For anyone finding this later, but can't figure out where office.dll is, like I did. I faced the same Issue with F# 4.0, Office 2013, and VS Community 2015 Update 2.0
I typed this in the beginning of the file to get Intellisense working, no need to search for office.dll in your machine:
#r "office, Version = 15.0.0.0"
This is the same text it gives you with <Note>, but without the Culture=neutral and PublicKey=w/e. Seems to work flawlessly.
For context, this is how my file starts:
#r "Microsoft.Office.Interop.Excel"
#r "office, Version = 15.0.0.0"
open System
open System.IO
open System.Reflection
open Microsoft.Office.Interop.Excel
let app = ApplicationClass(Visible = true)
let sheet = app.Workbooks
.Add()
.Worksheets.[1] :?> _Worksheet

How do you SetMaxAttachmentSize in TFS 2010?

I want to set the maximum work item attachment size. From old blogs I have found that it is possible by calling SetMaxAttachmentSize, but the blogs are for older versions of TFS. I have found the new webservice path for TFS 2010.
http://localhost:8080/tfs/_tfs_resources/WorkItemTracking/v1.0/ConfigurationSettingsService.asmx/SetMaxAttachmentSize
Unfortunately when I call it like that I receive this error: This request can only be made against a project collection. The (.asmx) file should be located in the project directory (usually _tfs_resources under the application root).
I don't know how to format the call via a browser to target a specific project collection. Any thoughts?
Apparently SetMaxAttachmentSize web service was not leveraged on TFS 2010 therefore you need to do this programmatically, try running the following code:
TeamFoundationServer tfs = TeamFoundationServerFactory.GetServer(#"http://yourtfsserver:8080/tfs/DefaultCollection");
ITeamFoundationRegistry rw = tfs.GetService<ITeamFoundationRegistry>();
RegistryEntryCollection rc = rw.ReadEntries(#"/Service/WorkItemTracking/Settings/MaxAttachmentSize");
RegistryEntry re = new RegistryEntry(#"/Service/WorkItemTracking/Settings/MaxAttachmentSize", "20971520"); //20MB
if (rc.Count != 0)
{
re = rc.First();
re.Value = "20971520";
}
rw.WriteEntries(new List<RegistryEntry>() { re });
I hope it works for you
Regards,
Randall Rosales
I have found that this works. It is easier than writing code.
Go to this url replacing <Collection> with your project collection: http://localhost:8080/tfs/<Collection>/WorkItemTracking/v1.0/ConfigurationSettingsService.asmx
Choose SetMaxAttachmentSize
You can test to make sure you set it correctly by going to the same url above and then selecting GetMaxAttachmentSize.

Resources