Friday, June 22, 2012

Myth Tick and Bookmark - HTML5

Pembacaan dan research ringkas tentang HTML5..
(rugi xresearch betul2 sebelum interview thun lepas..huuu)





"...'it' can only previously be done using javascript, now it focusing on browser..browser should and would be able to do all those thing"

sbg cth, sblm ni memainkan video hanya boleh dilakukan dengan bantuan player/plugin (eg flash player)..tp html5 membolehkan browser itu sendiri memainkan video tanpa perlu mendonwload/memerlukan plugin tambahan..






themythstoodstill: Lepas ni nak buat html, boleh cuba html5..even skrg browser xsupport html5 sepenuhnya, tp in the future..

http://html5test.com/

Tuesday, May 8, 2012

Myth Bookmark 2 : C# - Minimize WPF to System Tray in C#

Google Search: c#  WPF Minimize on Taskbar

The best solution found: http://ebbypeter.wordpress.com/2010/06/28/minimize-a-wpf-application-to-system-tray-in-c/

1. global variable for NotifyIcon

private System.Windows.Forms.NotifyIcon MyNotifyIcon;
2. initiate NotifyIcon. Declare/Initialize event to bring back App from taskbar
public MainWindow()
{
InitializeComponent();
MyNotifyIcon = new System.Windows.Forms.NotifyIcon();
MyNotifyIcon.Icon = new System.Drawing.Icon(
@"C:\Archive\Icon-Archive.ico");
MyNotifyIcon.MouseDoubleClick +=
new System.Windows.Forms.MouseEventHandler
(MyNotifyIcon_MouseDoubleClick);
}

3. Event/Button to minimize
private void btnQuit_Click(object sender, RoutedEventArgs e){   this.WindowState = WindowState.Minimized;}

4. Event bring back /restore App from taskbar
void MyNotifyIcon_MouseDoubleClick(object sender,
System.Windows.Forms.MouseEventArgs e)
{
this.WindowState = WindowState.Normal;

5. Balloon tips (mine not working. haven't fix yet [8/5/12])
private void Window_StateChanged(object sender, EventArgs e)
{
if (this.WindowState == WindowState.Minimized)
{
this.ShowInTaskbar = false;
MyNotifyIcon.BalloonTipTitle = "Minimize Sucessful";
MyNotifyIcon.BalloonTipText = "Minimized the app ";
MyNotifyIcon.ShowBalloonTip(400);
MyNotifyIcon.Visible = true;
}
else if (this.WindowState == WindowState.Normal)
{
MyNotifyIcon.Visible = false;
this.ShowInTaskbar = true;
}
}

Thursday, January 26, 2012

Myth Bookmark 1 : C# - Get WPF Datagrid Selected Row Cell Value

Google : get wpf datagrid selected row cell value

Solution found : http://stackoverflow.com/questions/2148978/wpf-toolkit-datagrid-selectionchanged-getting-cell-value

private void dataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
DataGrid dataGrid = sender as DataGrid;
if (e.AddedItems!=null && e.AddedItems.Count>0)
{
    // find row for the first selected item
    DataGridRow row = (DataGridRow)dataGrid.ItemContainerGenerator.ContainerFromItem(e.AddedItems[0]);
    if (row != null)
    {
        DataGridCellsPresenter presenter = GetVisualChild<DataGridCellsPresenter>(row);
        // find grid cell object for the cell with index 0
        DataGridCell cell = presenter.ItemContainerGenerator.ContainerFromIndex(0) as DataGridCell;
        if (cell != null)
        {
            Console.WriteLine(((TextBlock)cell.Content).Text);
        }
    }
}
}
static T GetVisualChild<T>(Visual parent) where T : Visual
{
T child = default(T);
int numVisuals = VisualTreeHelper.GetChildrenCount(parent);
for (int i = 0; i < numVisuals; i++)
{
    Visual v = (Visual)VisualTreeHelper.GetChild(parent, i);
    child = v as T;
    if (child == null) child = GetVisualChild<T>(v);
    if (child != null) break;
}
return child;
}