Adding export option to Office 2010 backstage view - ribbon

I cannot extend Office 2010 UI even when I use the code from MSDN. This is the code I think should work:
<?xml version="1.0" encoding="UTF-8"?>
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" onLoad="Ribbon_Load">
<backstage>
<tab idMso="TabShare">
<firstColumn>
<taskFormGroup idMso="GroupShare">
<category idMso="FileTypes">
<task id="tskExportXmlCms" label="Exportovat jako XML">
<group id="grpExportXmlCms" label="Exportovat jako XML">
<topItems>
<button id="btnExportXmlCms" label="Exportovat jako XML" onAction="OnExportXmlCms" />
</topItems>
</group>
</task>
</category>
</taskFormGroup>
</firstColumn>
</tab>
</backstage>
</customUI>
public void OnExportXmlCms(IRibbonControl control) { }
When I add Ribbon (Visual Designer) I can see added items. When I use Ribbin (XML) I'm not able to see anything in the backstage. What is wrong?

There was missing this method:
public partial class ThisAddIn {
protected override Office.IRibbonExtensibility CreateRibbonExtensibilityObject() {
return new Ribbon();
}
}

Related

How to implement Google maps in Xamarin Forms (Android and iOS)? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 1 year ago.
Improve this question
I have a Google map API key and I want to use that to show maps in my Android app and iOS app using Xamarin Forms. Which library would you use to have less conflict on both OS?
An easy way to implement that is using the NuGet Xamarin.Forms.GoogleMaps
Xamarin.Forms.GoogleMaps features:
Map types
Traffic map
Map events
Panning with animation
Panning directly
Pins
Custom Pins
Pin drag & drop
Polygons
Lines
Circles
Custom map tiles
Follow the next steps to set up maps in your project:
Install the NuGet package Xamarin.Forms.GoogleMaps in all projects.
Android. Initialize the library in your MainActivity.cs in the OnCreate method:
protected override void OnCreate(Bundle savedInstanceState)
{
TabLayoutResource = Resource.Layout.Tabbar;
ToolbarResource = Resource.Layout.Toolbar;
base.OnCreate(savedInstanceState);
Xamarin.Essentials.Platform.Init(this, savedInstanceState);
global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
Xamarin.FormsGoogleMaps.Init(this, savedInstanceState); //Initialize GoogleMaps here
LoadApplication(new App());
}
In your AndroidManifest.xml.
Add the properties com.google.android.geo.API_KEY com.google.android.gms.version org.apache.http.legacy inside the tag <application>.
Also adds the required permissions ACCESS_COARSE_LOCATION ACCESS_FINE_LOCATION.
Add some uses-feature if you will use geolocation.
Your AndroidManifest.xml should look like this:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="yvan.eht.nioj" android:installLocation="auto">
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="28" />
<application android:label="YourApp.Android">
<meta-data android:name="com.google.android.geo.API_KEY" android:value="Your_Api_Key_Here" />
<meta-data android:name="com.google.android.gms.version" android:value="#integer/google_play_services_version" />
<uses-library android:name="org.apache.http.legacy" android:required="false" />
</application>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-feature android:name="android.hardware.location" android:required="false" />
<uses-feature android:name="android.hardware.location.gps" android:required="false" />
<uses-feature android:name="android.hardware.location.network" android:required="false" />
</manifest>
iOS. Initialize the library in your AppDelegate.cs in the FinishedLaunching method:
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
global::Xamarin.Forms.Forms.Init();
Xamarin.FormsGoogleMaps.Init("Your_Api_Key_Here");
LoadApplication(new App());
return base.FinishedLaunching(app, options);
}
In your Info.plist add the properties NSLocationAlwaysUsageDescription NSLocationWhenInUseUsageDescription NSLocationAlwaysAndWhenInUseUsageDescription
<? xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<!--Your other Permissions may be on top -->
<!-- Just add the Permissions below -->
<key>NSLocationAlwaysUsageDescription</key>
<string>Can we use your location at all times?</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>Can we use your location when your application is being used?</string>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>Can we use your location at all times?</string>
</dict>
</plist>
DONE
Now you can add a map in your xaml and show it in your Android and iOS app like this:
<?xml version="1.0" encoding="utf-8"?>
<ContentPage
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:d="http://xamarin.com/schemas/2014/forms/design"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:maps="clr-namespace:Xamarin.Forms.GoogleMaps;assembly=Xamarin.Forms.GoogleMaps"
mc:Ignorable="d"
x:Class="YourApp.MainPage">
<ContentPage.Content>
<Grid HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<maps:Map x:Name="map" VerticalOptions="FillAndExpand"></maps:Map>
</Grid>
</ContentPage.Content>
</ContentPage>
OPTIONAL
Request runtime location permissions
If your application targets API 23 or later and needs to access the user's location, it must check to see if it has the required permission at runtime, and request it if it does not have it. This can be accomplished as follows:
In the MainActivity class, add the following fields:
const int RequestLocationId = 0;
readonly string[] LocationPermissions =
{
Manifest.Permission.AccessCoarseLocation,
Manifest.Permission.AccessFineLocation
};
In the MainActivity class, add the following OnStart override:
protected override void OnStart()
{
base.OnStart();
if ((int)Build.VERSION.SdkInt >= 23)
{
if (CheckSelfPermission(Manifest.Permission.AccessFineLocation) != Permission.Granted)
{
RequestPermissions(LocationPermissions, RequestLocationId);
}
else
{
// Permissions already granted - display a message.
}
}
}
(Not necessary if you are using Xamarin Essentials) In the MainActivity class, add the following OnRequestPermissionsResult override:
public override void OnRequestPermissionsResult(int requestCode, string[] permissions, [GeneratedEnum] Permission[] grantResults)
{
if (requestCode == RequestLocationId)
{
if ((grantResults.Length == 1) && (grantResults[0] == (int)Permission.Granted))
// Permissions granted - display a message.
else
// Permissions denied - display a message.
}
else
{
base.OnRequestPermissionsResult(requestCode, permissions, grantResults);
}
}

Magento 1.9.4 Third party model override doesn't work

I've been trying for days now to get a rewritten model to function. but it doesn't work, I'm puzzled because all seems to be correct.
___Here's my config file : etek/advancednewslettercoupon/etc/config.xml
<global>
<models>
<advancednewslettercoupon>
<class>Etek_AdvancedNewsletterCoupon_Model</class>
</advancednewslettercoupon>
<advancednewsletter>
<rewrite>
<subscriber>Etek_AdvancedNewsletterCoupon_Model_Subscriber</subscriber>
<rewrite>
</advancednewsletter>
</models>
</global>
__the subscriber model: Etek/AdvancedNewsletterCoupon/Model/Subscriber.php
class Etek_AdvancedNewsletterCoupon_Model_Subscriber extends AW_Advancednewsletter_Model_Subscriber
{
_construct() {
var_dump('Etek Subscriber');die(get_class($this));
}
public function subscribe($email, $segments, $params = array())
{ echo"<pre>";die('Etek Subscriber');
}
___Etek_AdvancedNewsletterCoupon.xml
<?xml version="1.0"?>
<config>
<modules>
<Etek_AdvancedNewsletterCoupon>
<active>true</active>
<codePool>local</codePool>
<depends>
<AW_Advancednewsletter/>
</depends>
</Etek_AdvancedNewsletterCoupon>
</modules>
</config>
I found out that I forgot to close the tag of rewrite:
<rewrite>
<subscriber>Etek_AdvancedNewsletterCoupon_Model_Subscriber</subscriber>
</rewrite>
Now all seems to work fine :)

Use Razor without Microsoft.NET.Sdk.Web

I am writing simple consoleApp (netcoreapp2.0)
<Project Sdk="Microsoft.NET.Sdk">
and want to run webserver with mvc.
class Program
{
static void Main(string[] args)
{
WebHost.CreateDefaultBuilder()
.ConfigureServices(services => services.AddMvc())
.Configure(app => app.UseDeveloperExceptionPage().UseMvcWithDefaultRoute())
.UseHttpSys().Build().Run();
}
}
public class HomeController : Controller
{
[HttpGet] public ActionResult Index() => View("Index");
}
I get an error while GET http//localhost:5000
One or more compilation references are missing. Ensure that your project is referencing 'Microsoft.NET.Sdk.Web' and the 'PreserveCompilationContext' property is not set to false.
Probably reason is in Razor Engine.
How can i make it work? What did i miss?
That error message can be caused by a missing #using in your Index.cshtml view file. Try bypassing the index view and just return a string from your controller like this to see if the error message goes away.
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
WebHost.CreateDefaultBuilder()
.ConfigureServices(services => services.AddMvc())
.Configure(app => app.UseDeveloperExceptionPage().UseMvcWithDefaultRoute())
.UseHttpSys().Build().Run();
}
}
public class HomeController : Controller
{
[HttpGet] public string Index() => "Hello World!";
}
}
csproj
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Hosting" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Server.HttpSys" Version="2.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="2.0.0" />
</ItemGroup>
</Project>
Happened to me when a view was referencing a model that didn't exist anymore. In my case it was a confirmation page, so not the "big" view that I had been working with. If you open up a lot of your views in VS the errors might become apparent.

populating MvxListView in MvvmCross

I am Creating MvvmCross PCL using Visual Studio 2013 and targeting frameworks are
WP8 and higher
.Net Framwork 4.5 and higher
Silverlight 5
Xamarin Android
Xamarin iOS
In one of my MvxViewModel,I have one public property of List in data from some service is get stored.In android , I have populated a MvxListView with this
List .
Now upon clicking one of the listitem I want to call new viewModel which also populate another List.And corresponding MvxListView will have a ItemTemplate as follows
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:local="http://schemas.android.com/apk/res/KittensView.Droid"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="40dp"
local:MvxBind="Text Name" />
<RatingBar
android:layout_width="fill_parent"
android:layout_height="wrap_content"
local:MvxBind="Text Rating" />
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Next" />
</LinearLayout>
In this axml layout,I want to show one listItem at a time and upon clicking on above button,a next listItem Should replace existing listItem until all the data in a corresponding List is gets displayed on UI.
How can I achieve this?PLEASE help me......
Thanks in advance for any helpful suggestions.
You can create properties for: a list of your objects (DataItem), an instance of your object and index
private int _index = 0;
private List<DataItem> _dataitems;
private DataItem _dataItem;
public DataItem DataItem {
get { return _dataItem; }
set
{
DataItem = value;
RaiseOnProperty(()=>DataItem);
}
public IMvxCommand ShowNextItemCommand
{
get
{
return new MvxCommand(()=> {
_index++;
DataItem = _dataitems.ElementAt[_index]
});
}
}
In your AXML, you can do this :
<?xml ... />
<LinearLayout ...
<TextView ...
local:MvxBind="Text Name1" />
<TextView ...
local:MvxBind="Text Name2" />
<Button ...
android:text="Next"
local:MvxBind="Click ShowNextItemCommand" />
</LinearLayout>
I think it works.

how to display android mapfragment view rounded shape

i have to show map view in rounded shape , is it posible to show android map view with rounded shape.
I have tried to applying fragment layout gadient but after map loading is showing rectange view.
any guidence for to make android rounded mapview
Yes, it possible. Cover the MapFragment with another layout, and set for this layout a 9-patch background, that will cover it the way you want, take a look at this question I asked on the same topic not long ago:
Is there a way to implement rounded corners to a Mapfragment?
You can use shapes in layer-list
here is the shape_circle.xml
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:drawable="#drawable/shape_circle_rect"/>
<item android:drawable="#drawable/shape_circle_oval"/>
</layer-list>
shape_circle_rect.xml
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<solid android:color="#android:color/transparent"/>
<stroke android:width="50dp" android:color="#ffffff"/>
<padding
android:left="-50dp"
android:top="-50dp"
android:right="-50dp"
android:bottom="-50dp"/>
</shape>
shape_circle_oval.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval" >
<stroke android:color="#ffffff" android:width="100dp"/>
<solid android:color="#android:color/transparent"/>
</shape>
and Custom Map Fragment
public class MapFragment extends SupportMapFragment{
//...
//Some methods, set up map and etc.
//...
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup viewGroup, Bundle bundle) {
View mapView = super.onCreateView(inflater, viewGroup, bundle);
RelativeLayout view = new RelativeLayout(getActivity());
view.addView(mapView, new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT));
FrameLayout frameLayout=new FrameLayout(getActivity());
frameLayout.setLayoutParams(new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT));
frameLayout.setBackgroundResource(R.drawable.shape_circle);
view.addView(frameLayout);
return view;
}
//...
//...
}