Get UWP app acquisition date - c#

How can I get an app's acquisition date?
I tried using StoreContext - ExtendedJsonData() but it didn't have that information.

Many UWP devs have asked about this and it's true... you can't ask for this value. You can only get the purchase or first-time download date.
However, you can try this trick. It's just a workaround, so don't blame me if one day it fails you :)
var properties = await Package.Current.InstalledLocation.GetBasicPropertiesAsync();
var installationDate = properties.ItemDate; // Maybe?
Let me know if it works for you.

Related

iOS iCloud failing to write with, Couldn't get container configuration from the server error

I have one app that I wrote already reading from and writing to the iCloud. I am essentially using the same code in my new app to do the same thing, but for some reason it will not work, giving me the following error, "Couldn't get container configuration from the server". Let me clarify, with this new app it does puts an entry in iCloud under manage storage, but instead of being under the name of my app, it is under adhoc.
Here is the line in my info.Plist,
Here is the line from my Entitlements,plist
lastly, here is my identifier defined on the apple developer site,
I have verified and reverified that everything is pointing to the correct thing so I am baffled. Any help would be much appreciated.
EDIT I guess what it is doing is writing file to my phone, but when it goes to save data to it, it fails with this message, Here is my call to save the data.
CKRecordID recordID = new CKRecordID(strDate);
await Task.Delay(200);
// Save it to iCloud
await pvc.SaveToiCloud(newRecord);
Here is my code to save the record,
public async Task SaveToiCloud(CKRecord newRecord)
{
ThisApp.PrivateDatabase.SaveRecord(newRecord, (record, err) =>
{
Edit:
I was thinking that possibly the number of nodes I had was too many, so I took out the "dist" one you see below, but that did not help. I thought maybe that was why I was seeing module name of adhoc under icloud on my phone, but I guess I was wrong.
Old:
New:
Edit
I have been doing more digging and found that this line of code is actually the one throwing the error.
File.WriteAllText(Path.Combine(filePath.Path, name + date), "Test");
The name and date contain correct values and the path looks fine to me... I guess... Don't know actually how it should look. Here is how the file path is getting set right above this call,
NSUrl filePath = NSFileManager.DefaultManager.GetUrlForUbiquityContainer(null).Append("Documents", true);
If anyone could offer any advice, I would be most appreciative.
So, I finally figured out the issue and it works like a champ now. The issue was the case in my bundle id in my info.plist. In CloudKit the DB name was all lower case, but my bundle Id in my info.plist, had AdHoc as my last node instead of adhoc as was in the CloudKit. You might say, what does the bundle Id have to do with the iCloud name, and actually I am not really sure, but I noticed that it was taking the case of that last node from my Bundle Id, not the case specified in the iCloud definition as I have shown above. Hope this helps someone who is struggling with a similar issue Have a great day!

How to store 1 month duration period and terminate it for setup file

I have created one setup file in visual studio 2010 for windows forms ,also inserted SerialNumberTemplate Property In that setup ,now I am trying to allot 1 month duration period for this setup ,but If I store the start time using Registrykey and check it using some code , than how should i add this code in that setup ,or is there any other way with which I can achieve this ,any better way to do this?
I could save start date something like this and check for end date ,but how to merge it in that setup? What is the correct way
RegistryKey regkey = Registry.CurrentUser;
DateTime dt = DateTime.Now;
string onlyDate = dt.ToShortDateString(); // get only date not time
regkey.SetValue("Install", onlyDate); //Value Name,Value Data
regkey.SetValue("Use", onlyDate); //Value Name,Value Data
Thanks in advance for any help
Create a registry item in the Registry view in the IDE and give it the value in the setup project.
Like here
But to test the value if for instance one month has pasted it is better to test this in the startup process of your app and close it if the time expired.
Also to prevent someone from just turning the time back on his machine I would add the check every time the app starts and just log the day's remaining and then write a logic to prevent abuse

Showing different calendars in Windows Phone 7

I'm trying to get a complete list of all calendars. If I list
(new Appointments()).Accounts
I get only accounts like "Windows Live" or "Google". Actually I need a way to get the calendars and the appointments to that calendar inside the accounts. But it has to be on any account, not only the Live Account. Read only access is enough though. Is there any possibility?
If there is no chance, is this possible under WP8? Yes, I know, hardware capabilities were to high for this feature under WP7.8.
There is a method Appointments.SearchAsync which you should use. There is quite a nice example on MSDN:
Appointments appts = new Appointments();
appts.SearchCompleted += new EventHandler<AppointmentsSearchEventArgs>(Appointments_SearchCompleted);
DateTime start = DateTime.Now;
DateTime end = start.AddDays(7);
appts.SearchAsync(start, end, "Appointments Test #1");
Within callback function you'll have access to args.Results of type IEnumerable<Appointment>.
This is available on both WP7.1 and WP8.

HASP HL working demo needed for C#

Okay. Well, I know this question has a good chance of being closed within the first 10 minutes, but I am going to ask it anyways for I have spent almost day and an half trying to find a solution. Still, I can't figure this one out. There is not much info on this on the Internet not even on the HASP (safenet) website although they have demos.
I have a HASP HL USB dongle. I try to convert their demo and test run it but for the life of me I simply can't get it to login even. It keeps raising Aladdin.HASP.HaspStatus.HaspDotNetDllBroken exception.
However, if I run the C version of their demo, it works perfectly.
Here is the Csharp version of my code:
Aladdin.HASP;
HASP myHasp = new HASP();
var thestatus = myHasp.Login(vender_code);
myHasp.Logout;
I would like to login to USB HASP and get its HaspID and the settings in its memory.
Thanks in advance,
It might be that you aren't having all dependencies for the HASP runtime. I'm packing with the app:
hasp_windows_NNNNN.dll (NNNNN = your number)
hasp_net_windows.dll
MSVCR71.DLL (added manually)
msvc runtime 80
One runtime library is required by HASP and it doesn't tell you which one unless you put it in the DEPENDS.EXE utility (you probably have you on your Visual Studio installation).
To log in (and read some bytes):
byte[] key = new byte[16];
HaspFeature feature = HaspFeature.FromFeature(4);
string vendorCode = "your vendor string, get it from your tools";
Hasp hasp = new Hasp(feature);
HaspStatus status = hasp.Login(vendorCode);
if (HaspStatus.StatusOk != status)
{
// no license to run
return false;
}
else
{
// read some memory here
HaspFile mem = hasp.GetFile(HaspFileId.ReadOnly);
mem.Read(key, 0, 16);
status = hasp.Logout();
if (HaspStatus.StatusOk != status)
{
//handle error
}
}
Hope it helps. My HASPed software works like a charm. BTW, wasn't able to put envelope around .NET app under no combination of settings.

facebooktoolkit and C# photo upload problem

I need help with integrating facebook into my desktop application. It's developed with C# - target framework is .NET framework 4.0.
I'm using http://facebooktoolkit.codeplex.com/
The problem is that I can't get the users albums although my app has permission for it, and for all to be more confusing I can get statuses, comments, friends, etc.
I have this in designer:
this.fbMyApp = new Facebook.Winforms.Components.FacebookService(this.components);
this.fbMyApp.ApplicationKey = "myappkey_goes_here";
this.fbMyApp.SessionKey = null;
this.fbMyApp.uid = ((long)(0));
And I've used this code(I've set all permissions for testing purposes):
fbMyApp.ConnectToFacebook(new List<Facebook.Schema.Enums.ExtendedPermissions>() {
Facebook.Schema.Enums.ExtendedPermissions.create_event,
Facebook.Schema.Enums.ExtendedPermissions.create_note,
Facebook.Schema.Enums.ExtendedPermissions.email,
Facebook.Schema.Enums.ExtendedPermissions.offline_access,
Facebook.Schema.Enums.ExtendedPermissions.photo_upload,
Facebook.Schema.Enums.ExtendedPermissions.publish_stream,
Facebook.Schema.Enums.ExtendedPermissions.read_mailbox,
Facebook.Schema.Enums.ExtendedPermissions.read_stream,
Facebook.Schema.Enums.ExtendedPermissions.rsvp_event,
Facebook.Schema.Enums.ExtendedPermissions.share_item,
Facebook.Schema.Enums.ExtendedPermissions.sms,
Facebook.Schema.Enums.ExtendedPermissions.status_update,
Facebook.Schema.Enums.ExtendedPermissions.video_upload
});
Now if I do this(after user has logged in):
MessageBox.Show("TOTAL statuses: " + fbMyApp.Status.Get().Count.ToString());
I will get the number of user statuses, and could read them. However if I do this:
MessageBox.Show("TOTAL albums: " + fbMyApp.Photos.GetAlbums().Count.ToString());
I get zero, although user has about 10 albums. I need this, cause this way I can access the album IDs and could be able to upload a photo to specific album. Any idea why this isn't working or does anybody have any better suggestion for some facebook toolkit for C#?
You need to request "user_photos" permissions from Facebook. I haven't used this toolkit as I prefer to make simple graph rest calls dynamically instead of having a huge library. I imagine you could download the source and recompile it, adding the missing permission. You could also switch to this library which is alot more up to date with current Facebook functionality.

Categories

Resources