Why my custom C# extention does not execute when deployed to Spotfire WebPlauer/Consumer - spotfire

I have a simple custom Add-in that just displays a message to the user.
namespace GeorgiSpotfireCustomExtention
{
public class GeorgiEvent : CustomApplicationEventHandler
{
protected override void OnApplicationInstanceCreated(AnalysisApplication application)
{
base.OnApplicationInstanceCreated(application);
MessageBox.Show("On Application Instance Created");
}
}
}
That is my CustomAddIn class:
public sealed class CustomAddIn : AddIn
{
// Override methods in this class to register your extensions.
protected override void RegisterApplicationEventHandlers(ApplicationEventHandlerRegistrar registrar)
{
base.RegisterApplicationEventHandlers(registrar);
registrar.Register(new GeorgiEvent());
}
}
I am just trying to learn the package deployment process. When I am running it locally - in the installed Spotfire Analyst client it displays the message just fine:
However, when I package the extention, add it to the server (via the "Deployments & Packages" section, adding the "spk" file and then saving the area, the message is not shown when I try to open a document in the WebPlayer/Consumer.
Notes: I am choosing "TIBCO Spotfire Any Client" for my intended client in the Package Builder when building the spk file.

from the Spotfire Wiki (emphasis mine):
WinForms graphical user interface is a component of the .NET Framework and not something supplied by Tibco Spotfire. It's not recommended to implement solutions using Forms, but sometimes it could be handy when debugging. There is no commitment that it will work in future versions of the Analyst client. Forms are not supported on the Web Player.
the example listed on the wiki is for IronPython, but presumably the same holds true for C# extensions.

Correct. My assumption, and I don’t really know a lot about .NET, so this is not absolute, is that the form is rendered on the machine executing the code. In the case of your example above, the dialog would pop on the Node Manager host. If you’re really set on using an alert like this, you can accomplish it in JavaScript with an ‘alert()’. There is probably a way to render dialogues o in the web client too, but I don’t know it offhand.

Related

I wrote a Liferay module. How to make it configurable by administrators?

I have created a Liferay 7 module, and it works well.
Problem: In the Java source code I hard-coded something that administrators need to modify.
Question: What is the Liferay way to externalize settings? I don't mind if the server has to be restarted, but of course the ability to modify settings on a live running server (via Gogo Shell?) could be cool provided that these settings then survive server restarts.
More specifically, I have a module for which I would like to be able to configure an API key that looks like "3g9828hf928rf98" and another module for which I would like to configure a list of allowed structures that looks like "BASIC-WEB-CONTENT","EVENTS","INVENTORY".
Liferay is utilizing the standard OSGi configuration. It's quite a task documenting it here, but it's well laid out in the documentation.
In short:
#Meta.OCD(id = "com.foo.bar.MyAppConfiguration")
public interface MyAppConfiguration {
#Meta.AD(
deflt = "blue",
required = false
)
public String favoriteColor();
#Meta.AD(
deflt = "red|green|blue",
required = false
)
public String[] validLanguages();
#Meta.AD(required = false)
public int itemsPerPage();
}
OCD stands for ObjectClassDefinition. It ties this configuration class/object to the configurable object through the id/pid.
AD is for AttributeDefinition and provides some hints for the configuration interface, which is auto-generated with the help of this meta type.
And when you don't like the appearance of the autogenerated UI, you "only" have to add localization keys for the labels that you see on screen (standard Liferay translation).
You'll find a lot more details on OSGi configuration for example on enroute, though the examples I found are always a bit more complex than just going after the configuration.

mvvmcross login viewmodel-viewcontroller communciation

I am using Mvvmcross crosscore in my project
I am trying to bind my loginviewmodel to the loginviewcontroller
I bound a command for the login button. the app waits until it gets a login response, which is stored in the loginViewModel itself..
How can I communicate this to the loginviewcontroller --- regarding the login status and login error message if any
Can I access the viewmodel datacontext inside my loginviewcontroller ??? and how ?
What is the best approach to communication any items in the viewmodel back ( I basically mean all the NON-UI binding items)
I am using Mvvmcross crosscore in my project
I'm assuming from this that you followed the CrossLight sample N=39.
Can I access the viewmodel datacontext inside my loginviewcontroller ??? and how ?
If you followed N=39. then you can access the DataContext using the property called DataContext - see https://github.com/MvvmCross/NPlus1DaysOfMvvmCross/blob/master/N-39-CrossLight-Touch/CrossLightTouch/MyViewController.cs#L33
public object DataContext
{
get { return BindingContext.DataContext; }
set { BindingContext.DataContext = value; }
}
Beyond this, there are many other examples in the N+1 videos which demonstrate how to communicate between ViewModels and Views including error messages and loading dialogs - e.g. N=34 shows one implementation of progress dialogs - https://github.com/MvvmCross/NPlus1DaysOfMvvmCross/tree/master/N-34-Progress
A complete index of N+1 videos is available on http://mvvmcross.wordpress.com
Obviously not all of these are appropriate for your CrossLight approach to development, but this is where you can allow your custom mvvm approach to fill the gap - it's code for you to write in your custom framework.
One of the best methods solving viewmodel interdependencies is using a loosely coupled approch using the MessageBus/Event Aggregator pattern. There's a plugin for MvvmCross. Or you could use the excellent TinyMessenger.
In principle when using this approach, you no longer establish hard references between the publisher and consumers of arbitrary notifications. Instead notifications get published on a message bus and every one is free to listen and subscribe.

Render mobile version of login in Secure class Play! Framework

Is it possible to somehow override the login method of the Secure.java class of the Secure-Module in Play! Framework, so that another version of the login form is displayed?
In my case, i want to display a mobile version of the login-form if a mobile browser is detected.
I know i should not change the Secure.java class itself, but i don't really see any other solution to this problem.
As discussed in other posts you have the request in your Play! controller. So in this request you could ask which agent is trying to view your website:
String agentInfo = request.headers.get("user-agent");
The you can determine which template will be rendered for this agent:
if (agentType.isWhatEverHeIs) {
renderTemplate("Application\mobileTemplateForBadPractise.html");
} else {
render();
}
But what I would encourage you to do is responsive webdevelopment. Create your templates as smart as possible, let the template and css and javascript do this and keep your business logic in your controller.
You could use the Twitter Bootstrap to achieve this, but there are many more! Like Skeleton.
You even got the request object inside your templates so that you can optionally render things in your template (or not) based on the agent.
Even simpler, simply create/override the secure/login.html template and use responsive design : media queries. No need to change the controller or check agent or whatever.

compositecontrol - user control - different approaches

I have seen this code to create a Login control, I guess instead of writing this code, we can use an .ascx file to create this control. Can someone explains the difference of these two approaches. thanks. source:http://www.joe-stevens.com/2010/04/16/creating-a-composite-server-control-with-asp-net/
[ToolboxData("<{0}:Login runat=server></{0}:Login>")]
public class Login : CompositeControl
{
private TextBox txtUsername = new TextBox();
private TextBox txtPassword = new TextBox();
private Button btnLogin = new Button();
protected override void CreateChildControls()
{
txtUsername.ID = "txtUsername";
txtPassword.ID = "txtPassword";
txtPassword.TextMode = TextBoxMode.Password;
btnLogin.ID = "btnLogin";
btnLogin.Text = "Login";
Controls.Add(txtUsername);
Controls.Add(txtPassword);
Controls.Add(btnLogin);
base.CreateChildControls();
}
}
Custom Server Controls typically serve a general purpose (beyond your application) and are typically built as a library to be shared across multiple applications. These are typically implemented and sold by third party vendors like Telerik, Infragistics, etc. User Controls are very centric to your application. You cannot share them across multiple applications (there may be some hacks, but generally not intended for that purpose). These are not built as libraries but as user interface components included in your application. Custom Server Controls don't provide designer support for building them but User Controls have designer support. So your example can be implemented both as a user control and custom server control depending upon what your intentions are for that control. That being said writing custom server controls is non-trivial. Here was a official description from MS
http://msdn.microsoft.com/en-us/library/aa719735.aspx

Calling Office Communicator via Silverlight Out of Browser

I need to invoke office communicator to create a chat window and phone call directly from Silverlight when running out of browser. When running in browser I do this and it works pretty well:
System.Windows.Browser.HtmlPage.Window.Eval(String.Format("window.open(\"sip:{0}\", target=\"_self\");", sip));
When running out of browser as far as I have gotten is to invoke the Communicator.UIAutomation via a dynamic but honestly I don't know what to do next.
dynamic communicator = AutomationFactory.CreateObject("Communicator.UIAutomation");
Anyone have any suggestions on how to make this work? Searching has yeilded zero results.
A couple thoughts:
Have you tried making the automated Communicator object a var, then setting a breakpoint and digging into the resulting hydrated object? You might find some methods or properties on the object you can use to make things happen.
There's a blog here that describes the Office Communicator SDK and has some sample projects. I think you might be able to include the SDK assemblies in your OOB app and automate Communicator using Microsoft's provided SDK.
The SDK has to be preinstalled in the user machines. There's no easy way to deploy it along your Silvelright OOB application.
You will need the SDK.
You can check the documentation for more details here: C:\Program Files (x86)\Microsoft Office Communicator\SDK\OCSDK.chm
It mainly refers to C#, but most of it could easily be ported to Com Automation. As an example look at the following code to start a conversation
dynamic comm = new ActiveXObject("Communicator.UIAutomation");
dynamic msgrAdv = comm.IMessengerAdvanced;
if(msgrAdv!=null)
{
try
{
object obj = msgrAdv.StartConversation(
1, //CONVERSATION_TYPE.CONVERSATION_TYPE_IM,
sipUris, // object array of signin names
null,
"Testing",
"1",
null);
windowHandle = long.Parse(obj.ToString());
}
catch (COMException ex)
{
this.writeToTextBox(
formReturnErrors.returnComError(ex.ErrorCode)
);
}
I hope this help. Noticed that from the example in the help file I changed some of the members that are defined in the .NET Assembly (which can't be referenced from your C# code). If you need this, I would suggest opening the CommunicatorAPI.dll assembly in Reflector.

Resources