Show Lync ContactCard in Silverlight 4 by code - c#

I would like to be able to show ContactCard/PopupContactCard control on MouseEnter event of a control.
Does anyone know how to show the contact card?
So far I was not able due to internal/protected modifiers of vital methods.
I can do this with the PresenseIndicator control, but not from my custom code in the event handlers.
So any ideas?

You could create either a new page, or a popup section of your existing page, and host a contact-card object in there. Then, on the mouse-enter, pass through the SIP you want to display and show the popup (/show the other page)
The ContactCard control I would probably choose to display is this one: http://msdn.microsoft.com/en-us/library/microsoft.lync.controls.contactcard_di_2_lyncctrlslmref.aspx
Or do you mean that you wish to expand the ContactCard? I'm not sure if this is possiblem, is the IsExpanded property writable?

Related

How can i hide the back button using template 10?

I want to use template 10 to develop my app, but I dont know how can I hide the back button once I pass from one page to another, like for example passing from a login page to my main page.
With template 10 it always show the back button, I know how to prevent from going back, but still I can see the damn back button on the shell, I dont wish to see it.
How could I hide it?
ClearHistory is located on the HamburgerButtonInfo as a DP and if that isn't enough you can thru the NavigationService call ClearHistory as well which looks like public void ClearHistory() => FrameFacade.BackStack.Clear(); in the source so you know what it actually calls...

Is there a dynamic-creation-friendly LinkLabel Alternative?

I'm trying to dynamically create a link from a Windows Form to our website when certain conditions are met (it's a warning message with further information in our online manual).
Currently I'm finding LinkLabel quite unwieldy to use in this situation: having to set up LinkClicked handlers on the fly for a straightforward hyperlink seems inelegant.
Is there a wrapper or alternative that fulfills the following requirements?:
Inherits from System.Windows.Forms.Control (so I can use it in a TableLayoutPanel)
Has reasonably low setup (no strange LinkClicked function pre-visit checking, for example)
Isn't bound to a specific browser
What is your problem with the LinkClicked event handler? You would have to do the same for almost any control in order to do anything useful.
Anyway, it would be trivial to implement yourself - create a class that inherits from LinkLabel, add a string URL property (you may need an attribute to make this show in the designer properties panel if you want to set it that way) and provide an event handler that opens the browser with that URL.
Then you can just add the control in the designer (or at runtime), set the URL property and it will work without having to set event handlers.
Did you use the LinkClicked event instead of OnClick? Then you can use this in the event handler:
(sender as LinkLabel).LinkVisited = true;
System.Diagnostics.Process.Start("http://example.com");
It's not bound a specific browser - opens in the user's default browser. The setup is low - just instantiate the LinkLabel, add an event hookup to LinkClicked (which is one two-line method) and add it to the page. What's unwieldy about this approach?
In the end I used LinkLabel.Links.Add to modify the link destination dynamically..

Dock Windows Forms (tabbed chat interface)

Edit for those who say to use tab control
I would love to use a tab control; yet i have no idea how to go about linking the tab control up from the main form. I would assume that I would have to do something like this:
Create Form with a blank TabControl on it, no pages created.
Create a CustomuserControl (Add -> user Control), with my controls on it.
When a new chat comes in, create a tab control Item, Tab Control Page, add the Custom Control to the Tab Control Page. Add the tab control handle to the hash table, so that when new messages come in, they can be referenced in the proper control.
But, i am so not sure how to do this. For example, I know that I can create custom events inside of the User Control, so that, for example, if each control has a 'bold' button, i can each page that has that control on it, to actually USE the button.
Yet i also need to register message callbacks, so that I can use a MessageGrabber to send data to it, and tha'ts not assigned inside of the UserControl, that's assigned programatically when a new window comes in; but since I have no controls to reference, i can't assign.
KISS Philosophy
Wouldn't it be easier to just create the form, like i do now, and then just dock that form within a window or something? So that, in essence, it's still creating the form, but it's also a separate window?
Original Question
Okay, so i'm stumped (which isn't that big of a surprise when it comes to complex C# logic lol)! What i'm trying to do is the following:
Goal: Setup tabbed chatting for new chat application.
Completed: Open new window whenever a chat message is received, or a user requests a new chat from the roster. This is working perfectly, and opens only a window when the user doesn't already have the chat open. Nice and happy there.
Problem: I dont want windows. Well, i do want A window, but, i do not want tons of separate windows. For example, our Customer Service team may have about 10 active IM windows going at one time, i do not want them to have to have 10 windows tiled there lol. I'd rather they have a single Private IM window, and all 10 tabs docked within the window.
Logic: This is my logic here, which may be flawed, i do apologize:
OnMessage: Open new chat window if one doesn't already exist; if one exists, open it as a tab within the current chat window.
SendMessage: ^^ ditto ^^
Code Examples:
if (!Util.ChatForms.ContainsKey(msg.From.Bare))
{
RosterNode rn = rosterControl1.GetRosterItem(msg.From);
string nick = msg.From.Bare;
if (rn != null)
nick = rn.Text;
frmChat f = new frmChat(msg.From, xmpp, nick);
f.Show();
f.IncomingMessage(msg);
return;
}
Note on above: The Util. function just keeps tracks of what windows are opened inside of a hashtable, that way, when messages come in, they route to the proper window. That is added with the:
Util.ChatForms.Add(m_Jid.Bare.ToLower(), this);
Command in the frmChat() form.
Library in Use: agsxmpp from: http://www.ag-software.de/agsxmpp-sdk/download/
Problem:
How can i convert this code to open inside of tabs, instead of windows? Can someone please give me some ideas, and help with that. I just can't seem to wrap my head around that concept.
Use TabControl

Silverlight business application initialize check

I am using the Business Silverlight application. I have incorporated some MVVM into this and were off an running with it. We are using some telerik controls, mostly the ribbon control and the docking. We register all the telerik ribbon controls in the about.xaml.cs file, the method is DisplayUI - its here where we register the docking control then we register the ribbon after this. What happens is that when you click the ABOUT link it shows our first tab with buttons(perfect). when you click the HOME link next to the ABOUT link, we go back to the home page..but when you click the ABOUT link again it registers the controls again so we end up with two tabs that are the same.
Is there a way to check to see if this about.xaml.cs file has already been initialized? Im guessing that is has a handle on the first call in memory as I am able to see the first tabs rendering..
Thanks
here is the about code
public About()
{
InitializeComponent();
DisplayUI();
this.Title = ApplicationStrings.AboutPageTitle;
}
that display UI does all the work in registering the dockpanel and the ribbons. We'd like to not have the DisplayUI() called if this has already been rendered once.
If you do it by event handler can you unsubscribe from the event at the end of the method? Without seeing some code it's hard to work out what to change.
It's not the nicest way of doing it, but if this code needs to run once and only once then you could have a static boolean variable on the class set to false and when you call DisplayUI you check the value of this. If it's false you set it to true and run the method, and if it's true you just return.

What winforms control to display message with minor html formatting?

Is there a control I can use to display a short message that contains minor html formatting (eg one or more links). I'd prefer not to use the WebBrowser control (suggested here) as it's a bit heavy for what I want, so any other suggestions welcome.
If a user does click a link from my message I want it to be opened in their default browser, not within my application.
I do use the infragistics controls so one of those would be fine but I don't see any that will do this.
You can use the controls in this article on CodeProject or you can use them as an example for how to roll your own.
I have implemented an HTML control for .NET which may do what you want: see http://www.modeltext.com/html for details.
The control can display HTML including links, and doesn't use a browser.
What happens when the user clicks on a link is up to you: the control generates an event, which can be handled by the application in which the control is embedded; so, your application would instantiate the control, fill it with HTML, install an event handler, and launch the browser when its event handler is told that the user has clicked on a link.
If all you need is the link functionality you can use the LinkLabel control. Assuming that you have set the LinkLabel.Tag property to the url the following code will open the default browser and open the specified web page:
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
Process.Start((string) ((sender as LinkLabel).Tag));
}
I think the best solution in my case might be to use RichTextBox, which has a property DetectLinks and a LinkClicked event that tells you which link is clicked. I'll look into this further...

Categories