I want to list all pages in application and create instance of these pages programatically. If you have any idea about this please help. Thanks..
I assume you are talking about a Silverlight Navigation application?
If you need to get all types that inherit from System.Windows.Controls.Page in your app you can use:
var pageTypes = typeof(App)
.Assembly
.GetTypes()
.Where(type => typeof(Page).IsAssignableFrom(type));
Then you can iterate over this to get instances of each:
var instances = types.Select(type => Activator.CreateInstance(type));
Related
I'm just new to reactjs-spfx controls. I have a pnpjs control that lists all the pages and it's contents. I should be able to add edit and delete pages using that web part. I want to include in that component the functionality to add a new Web part to the page content when I'm editing it. How do you call that functionality from SharePoint to add new webpart? Please see below picture. Thanks.
I would recommend using pnpjs library for this, it wraps most basic tasks with a nice api. I am adding my own webpart to a page something like this, just to give you an idea:
See https://pnp.github.io/pnpjs/sp/clientside-pages/
const sp = SPFI(...)
// or get the existing page
const page = await sp.web.addClientsidePage(fileName, title);
const section = page.addSection();
const partDefs = await sp.web.getClientsideWebParts();
// find the web part we want to add by guid
const myPartDef = partDefs.find(c => areGuidsEqual(c.Id, MY_GUID));
const part = ClientsideWebpart.fromComponentDef(myPartDef);
part.setProperties({
someProp: someValue
});
section.addControl(part);
await page.save();
I am having a trouble about Smartface App Studio about creating AdMob component dynamically. How can i do this in Smartface? In former edition, we could use AdMob component in toolbar. It was easy just drag&drop.
So in the new version, i need an example for both (Android and iOS, btw is any difference for both?) about my problem.
Thanks in advance.
Regards.
AdMob component should be added dynamically in your application.
You can create it like;
var admob = new SMF.UI.AdMob();
admob.adSize = SMF.UI.AdMob.AdSize.banner;
admob.adUnitId.Android = "AD_UNIT_ID_Android";
admob.adUnitId.iOS= "AD_UNIT_ID_iOS";
Pages.Page1.add(admob);
var adRequest = new SMF.UI.AdMob.AdRequest();
adRequest.addTestDevice(SMF.UI.AdMob.AdRequest.deviceIDEmulator);
adRequest.addTestDevice("DEVICE_ID");
adRequest.gender = SMF.UI.AdMob.AdRequest.genderFemale;
adRequest.birthday = new Date(2004,10,10);
adRequest.location = {latitude:41, longitude:29};
//You should load it for all pages.
admob.load(adRequest);
For more info please check the link : http://docs.smartface.io/?topic=html/M_SMF_UI_AdMob__ctor.htm
Smartface.io Team
I have developed a web application with zf2. And I have also developed it for mobile devices.
But I cannot decide how can I pass this variable to controller visitor is mobile or not ... for example I want to reach to controller to isMobile or not from view.
Or do you suggest any other way?
//Application\Module.php
public function onBootstrap(MvcEvent $e){
$mobileDetect = $serviceManager->get('MobileDetect'); //Retrieve "\Mobile_Detect" object
//I want to reach to this value (isMobile or not) from my view. but how can do this?
$isMobile = $mobileDetect->isMobile();
}
It seems that you want to access the $isMobile variable in the view files.
If that is so, then try this -
after $isMobile = $mobileDetect->isMobile();
write -
$e->getViewModel()->setVariables(
array(
'isMobile' => $isMobile,
)
);
then in any view files, you can access it as $isMobile and you will get the set value.
I hope this helps.
I've been trying to upload a user profile picture during the user registration using Service 3 and so far I haven't had any luck. I tested passing a hard coded fid in the field "picture" and also tried to pass the fields "filemime", "filename", etc. and it didn't work neither.
Any idea about what fields I need to populate?
I guess it must be related to this post Using Drupal Services and DIOS SDK for setting user picture in iOS app
but it doesn't have and answer neither.
I use following code -
//Picture is first uploaded from ios using file service and fid is passed in $data object
$file_contents_object = file_load($data->picture_fid);
$file_contents_array['fid'] = $file_contents_object->fid;
$file_contents_array['uid'] = $file_contents_object->uid;
$file_contents_array['filename'] = $file_contents_object->filename;
$file_contents_array['uri'] = $file_contents_object->uri;
$file_contents_array['filemime'] = $file_contents_object->filemime;
$file_contents_array['filesize'] = $file_contents_object->filesize;
$file_contents_array['status'] = $file_contents_object->status;
$file_contents_array['timestamp'] = $file_contents_object->timestamp;
$file_contents_array['rdf_mapping'] = $file_contents_object->rdf_mapping;
//use your cck field here
$user_obj->field_user_profile_picture['und'][0] = $file_contents_array;
Hope this will help.
I want to refresh the search screens after adding new data from other screens. I've tried doing
foreach (var parentScreen in this.Application.ActiveScreens.OfType<ScreenType>())
{
//Invoke the refresh
parentScreen.Details.Dispatcher.BeginInvoke(() => parentScreen.Details.Commands.Refresh.Execute());
}
but it doesn't seem to work in Beta 2
found it on
http://social.msdn.microsoft.com/Forums/en-US/lightswitchgeneral/thread/cf86ad21-48fb-48f2-87d4-e5b15f8f361c#e6879629-145a-4b18-834c-ebee0cfe1473
Unfortunately the collection of ActiveScreens does not actually contain a set of Screen objects. It contains a proxy class that you can use to access the actual screen object (this is due to different threads running in different threads). Here is some sample code that achieves what you need.
Microsoft.LightSwitch.Client.IActiveScreen searchScreen = Application.ActiveScreens.Where(a => a.Screen is SearchCustomers).FirstOrDefault();
searchScreen.Screen.Details.Dispatcher.BeginInvoke(() =>
{
((SearchCustomers)searchScreen.Screen).Customers.Refresh();
});