Skip to content

Instantly share code, notes, and snippets.

View sandrinodimattia's full-sized avatar
🏠
Working from home

Sandrino Di Mattia sandrinodimattia

🏠
Working from home
View GitHub Profile
@sandrinodimattia
sandrinodimattia / gist:3162312
Created July 23, 2012 06:45
jnlp web.config
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <staticContent>
            <mimeMap fileExtension=".jnlp" mimeType="application/x-java-jnlp-file" />
        </staticContent>
    </system.webServer>
</configuration>
@sandrinodimattia
sandrinodimattia / gist:3162314
Created July 23, 2012 06:46
Dynamics CRM 2011 eID Javascript
<html>
<head>
<title>eID: Read</title>
<script type="text/javascript" src="https://localhost:100/be_belgium_eid.js"></script>
<script language="javascript" type="text/javascript">
// Initialize the reader.
var cardReader = new be.belgium.eid.CardReader();
// Bind error events.
function noCardPresentHandler() { window.alert("No card present!"); }
@sandrinodimattia
sandrinodimattia / gist:3162318
Created July 23, 2012 06:47
Dynamics CRM 2011 update contact
// Open the card reader page.
function readCard() {
window.open ("https://crm2011.some.url//WebResources/new_contacteid_page", 'ReadEid', 'width=850, height=450');
}
// Update the contact based on the eID data.
function onUpdateContact(data)
{
Xrm.Page.getAttribute("firstname").setValue(data.firstName);
Xrm.Page.getAttribute("lastname").setValue(data.lastName);
@sandrinodimattia
sandrinodimattia / gist:3162320
Created July 23, 2012 06:48
Dynamics CRM 2011 replace error
<TD vAlign=top><APPLET id=BEIDAppletLauncher name=BEIDAppletLauncher archive=applet-launcher.jar,beid35libJava.jar,BEID_Applet.jar codeBase="https://localhost:100" code=org.jdesktop.applet.util.JNLPAppletLauncher width=140 height=200><PARAM NAME="_cx" VALUE="3704"><PARAM NAME="_cy" VALUE="5291"></APPLET> </TD>
<TD vAlign=top><TEXTAREA id=content wrap=virtual cols=80 rows=20> </TEXTAREA> <BR><INPUT title="Read Card" onclick=javascript:readCard() value="Read Card" type=button> <INPUT title=Save onclick=javascript:saveCard() value=Save type=button> </TD></TR></TBODY></TABLE></BODY></HTML>
@sandrinodimattia
sandrinodimattia / gist:3162329
Created July 23, 2012 06:53
WPF UserControl header
<UserControl x:Class="Sandworks.Silverlight.NamespaceExample.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
@sandrinodimattia
sandrinodimattia / gist:3162330
Created July 23, 2012 06:53
WPF UserControl namespaces
<UserControl x:Class="Sandworks.Silverlight.NamespaceExample.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:my="clr-namespace:Sandworks.Silverlight.NamespaceExample.Controls"
xmlns:conv="clr-namespace:Sandworks.Silverlight.NamespaceExample.Converters"
xmlns:lib="clr-namespace:Sandworks.Silverlight.NamespaceExample.ClassLibrary.Converters;assembly=Sandworks.Silverlight.NamespaceExample.ClassLibrary"
@sandrinodimattia
sandrinodimattia / gist:3162331
Created July 23, 2012 06:53
WPF custom namespace
[assembly: XmlnsPrefix("http://schemas.sandworks.com/sl/", "sw")]
[assembly: XmlnsDefinition("http://schemas.sandworks.com/sl/",
"Sandworks.Silverlight.NoNamespaceExample.Controls")]
[assembly: XmlnsDefinition("http://schemas.sandworks.com/sl/",
"Sandworks.Silverlight.NoNamespaceExample.Converters")]
@sandrinodimattia
sandrinodimattia / gist:3162333
Created July 23, 2012 06:54
WPF CLR namespace
[assembly: XmlnsDefinition("http://schemas.microsoft.com/winfx/2006/xaml/presentation",
"Sandworks.Silverlight.NoNamespaceExample.Controls")]
[assembly: XmlnsDefinition("http://schemas.microsoft.com/winfx/2006/xaml/presentation",
"Sandworks.Silverlight.NoNamespaceExample.Converters")]
private static ScrollBar GetScrollbar(this DependencyObject dep, string name)
{
for (int i = 0; i < VisualTreeHelper.GetChildrenCount(dep); i++)
{
var child = VisualTreeHelper.GetChild(dep, i);
if (child != null && child is ScrollBar && ((ScrollBar)child).Name == name)
return child as ScrollBar;
else
{
ScrollBar sub = GetScrollbar(child, name);
@sandrinodimattia
sandrinodimattia / gist:3162350
Created July 23, 2012 07:00
ScrollBar OnApplyTemplate
public override void OnApplyTemplate()
{
...
this._hScrollBar = base.GetTemplateChild("HorizontalScrollbar") as ScrollBar;
if (this._hScrollBar != null)
{
this._hScrollBar.IsTabStop = false;
this._hScrollBar.Maximum = 0.0;
this._hScrollBar.Orientation = Orientation.Horizontal;
this._hScrollBar.Visibility = Visibility.Collapsed;