Restart AIR MacOS Captive Runtime Bundle Application from code - macos

Could anyone say how to restart it?
I found this sample and try to adapt it for me:
var appLauncher:File;
appLauncher = new File(File.applicationDirectory.nativePath).parent.parent.resolvePath("Contents").resolvePath("MacOS").resolvePath("FlashApp");
var npInfo:NativeProcessStartupInfo = new NativeProcessStartupInfo;
npInfo.executable = appLauncher;
var _args:Vector.<String> = new Vector.<String>;
npInfo.arguments = _args;
var np:NativeProcess = new NativeProcess;
np.start(npInfo);
np.exit();
But I don't understand how it should work.. Now nothing happends when this function called frome one of my classes.

Did you try it with ADL? Or with actually packaged/installed app?
It is related its package structure.
If you try with ADL, it may not work.
Also,
"FlashApp" must be changed to the name of your application,
The last line should be exit(); of your NativeApplication, not np.exit()

Related

How to get app name programatically in native script

I'm trying to save some files on my local File storage So, I'm doing Something like below
var folder_name = "abcde/" + viewModel.dir_path;
const documents = fileSystemModule.knownFolders.documents();
documents._path = android.os.Environment.getExternalStorageDirectory().getAbsolutePath();
const folder = documents.getFolder(folder_name);
var file = fileSystemModule.path.join(folder._path, this.pdf_url.split("/").pop());
var url = this.pdf_url;
httpModule.getFile(url, file).then(function(result) {
console.log(result);
Toast.makeText(`${result._name} is succesfully downloaded in ${folder_name}`).show();
}, function(e) {
console.log(e);
});
the only problem is the hardcoded value abcde/ I want it to be app name. whatever the app name is it should take that name.
I don't find any ways to read app name programatically. I need this to Android I'm not interested in IOS.
may be this is one could be the answer. but still this is not a proper way
const documents = fileSystemModule.knownFolders.currentApp();
console.log(documents); --> "/data/data/org.nativescript.app_name/files/app"
var str = documents;
var arr = str.split("/")[3];
console.log(arr.split(".")[2]); ---> app_name
In Android, you can set the app name for the application in strings.xml, for example:
<string name="app_name">"App_Name"</string>
Then whenever you want to reuse the app name, you can use the getString method with its name in the application.

reopen closed or cancel activity with console application

I got this error when I try to reopen appointment: "Cannot update Closed or Cancelled Activity"
here is my code:
var connectionString = ConfigurationManager.ConnectionStrings["crmConnection"].ConnectionString;
var conn = CrmConnection.Parse(connectionString);
var service = new OrganizationService(conn);
var stateRequest = new SetStateRequest
{
State = new OptionSetValue(0),
Status = new OptionSetValue(1),
EntityMoniker = entity.ToEntityReference()
};
service.Execute(stateRequest);
I'm getting the entity from RetrieveMultiple(query) where StateCode is "Cancel" or "Complete". I run this code in a Console Application and get that error.
PS:
I wrote my code in the new version but I got this error again:
entity.SetAttributeValue<OptionSetValue>("statecode", 0);
entity.SetAttributeValue<OptionSetValue>("statuscode", 1);
var request = new UpdateRequest { Target = entity };
var response = (UpdateResponse)_organizationService.Execute(request);
Finally, after 8 hours working I got it!. It's so ridiculous but it worths to know. this error raises from another plugin that I had registered before. That plugin was registered on "Update" message when "StateCode" field has changed. I disable that step and my deprecate function has worked!
in exception message, you cannot understand which plugin raise the error.
Please provide the total code. I see here, you statened a new OrganizationService, as you have used one before (for retrieveMultiple).
Maybe using the same service, just fixes your problem :), but with total code we can maybe help more.
In addiont to the deprecated discussion. You use CRM 2015, as it seems to be flagged with it? It is only depricated in D365 as i know (hopefully i am not mistaken here ;) )

Unable to set firefox bookmark description for in Add-On Kit API

I found the nsINavBookmarksService, however since Firefox 3, it does not seem to have any API methods for getting/setting the Bookmark description. (API doc)
I've seen other Add-Ons modify the description as a method of synchronized data storage (which is exactly what I'm trying to do). I'm guessing perhaps the description is a non-gecko standard, and that's why it is not directly supported, but then there must be a completely different interface for manipulating Bookmarks that I haven't discovered.
Can anyone help with this newbie problem?
Starting with Firefox 3 the bookmarks have been merged into the Places database containing all of your browsing history. So to get the bookmarks you do a history query, like this (first line is specific to the Add-on SDK which you appear to be using):
var {Cc, Ci} = require("chrome");
var historyService = Cc["#mozilla.org/browser/nav-history-service;1"]
.getService(Ci.nsINavHistoryService);
var options = historyService.getNewQueryOptions();
var query = historyService.getNewQuery();
query.onlyBookmarked = true;
var result = historyService.executeQuery(query, options);
result.root.containerOpen = true;
for (var i = 0; i < result.root.childCount; i++)
{
var node = result.root.getChild(i);
console.log(node.title);
}
That's mostly identical to the code example here. Your problem is of course that nsINavHistoryResultNode has no way of storing data like a description. You can set annotations however, see Using the Places annotation service. So if you already have a node variable for your bookmark:
var annotationName = "my.extension.example.com/bookmarkDescription";
var ioService = Cc["#mozilla.org/network/io-service;1"]
.getService(Ci.nsIIOService);
var uri = ioService.newURI(node.uri, null, null);
var annotationService = Cc["#mozilla.org/browser/annotation-service;1"]
.getService(Ci.nsIAnnotationService);
annotationService.setPageAnnotation(uri, annotationName,
"Some description", 0, Ci.nsIAnnotationService.EXPIRE_NEVER);
For reference: nsIAnnotationService.setPageAnnotation()

FindItems() and BindToItems() give inconsistent results for EmailMessage.Sender.Address

After quite a lot of debugging, I've refined a complicated Managed EWS problem down to the following two simple-ish test cases. The first one works, the second one fails:
var view = new ItemView(100) { PropertySet = new PropertySet { EmailMessageSchema.Id } };
var findResults = ews.FindItems(WellKnownFolderName.Inbox, view)
var bindResults = ews.BindToItems(findResults.Select(r => r.Id), new PropertySet { EmailMessageSchema.Sender });
// Sanity check
Assert.AreEqual(1, bindResults.Count());
// The results I care about
Assert.AreEqual("David Seiler", bindResults[0].Sender.Name);
Assert.AreEqual("david.seiler#yahoo.com", bindResults[0].Sender.Address);
One might try to cut out the BindToItems() call, and use FindItems() directly:
var view = new ItemView(100) { PropertySet = new PropertySet { EmailMessageSchema.Sender } };
var findResults = ews.FindItems(WellKnownFolderName.Inbox, view)
// This part still works fine
Assert.AreEqual(1, findResults.Count());
// So does this
Assert.AreEqual("David Seiler", findResults[0].Sender.Name);
// ...but this fails! Sender.Address is null
Assert.AreEqual("david.seiler#yahoo.com", findResults[0].Sender.Address);
Can anyone tell me where I've gone wrong? It really seems, from the documentation, as though this should work. Not all properties can be read through FindItems(), it's true, but those properties usually throw when I try to access them, and anyway there's a list of those properties on MSDN and Sender isn't on it. What's going on?
Actually I don't know why, but in the second option, it only load basic information of the sender like the name, but not the Address.
If you want to load all the sender properties but do not want to bind the full message you can add the following line before the first assert
service.LoadPropertiesForItems(findResults.Items, new PropertySet(EmailMessageSchema.Sender));

CIM in an MVC3 app - how to instantiate ServiceSoap?

I'm integrating CIM into an MVC3 app. I've added a service reference using the development url and coded the following:
public long x()
{
var u = this.User.Identity as IClaimsIdentity;
var id = u.Claims.First(x => x.ClaimType == ClaimTypes.NameIdentifier);
AuthorizeNet.CustomerProfileType cust = new AuthorizeNet.CustomerProfileType();
cust.merchantCustomerId = id.Value;
AuthorizeNet.MerchantAuthenticationType merch = new AuthorizeNet.MerchantAuthenticationType();
merch.name = "8aFRk4663XMd";
merch.transactionKey = "4MS675e62fQEdUXN";
AuthorizeNet.ServiceSoap svc = new AuthorizeNet.ServiceSoap();
AuthorizeNet.CreateCustomerProfileResponseType response = svc.CreateCustomerProfile(
merch, cust, AuthorizeNet.ValidationModeEnum.none
);
return response.customerProfileId;
}
but, of course, it doesn't work because one cannot instantiate an interface like that (.ServiceSoap is an interface). The sample code makes a reference to a .Service - but that doesn't exist AFAICT.
so how is this supposed to work?
TIA - e!
p.s. I did find an old posting with precisely my problem, but alas, no solution
well... at least for now the answer seems to be: don't generate a Service Reference but a Web Reference (you can do it by clicking on the Advanced button of the Service Reference dialogue).
so eeky.

Resources