DCSIMG
Windows DEV ices DEV
Sign in | Join | Help

Windows DEVices DEV

Elad Shaham's Blog

Speaking at WPDevConf

wpdevconf

Well, it seems like I’m going international.
Yesterday the WP Dev Conf, probably the largest independent Windows Phone conference to date, listed 2 of my sessions for the conference, which will take place on October 22-24, 2012, near San Francisco, CA.

I’m very honored to be invited to speak at WP Dev Conf, and love the idea it will be focusing on a topic I love talking about – Windows Phone. My two sessions will be:

From a New Windows Phone Project to the Marketplace

The list of things you need to do in order to create a new Windows Phone project, implement its business logic, and upload it to the Marketplace, may sound intimidating. The truth of the matter is, it couldn't be easier. Develop, test, upload—that's all there is to it.

In this session, we will create a simple Windows Phone application, make sure it passes certification, and upload it to the Windows Phone marketplace. You don't have to be a super developer to create a Windows Phone app; in fact, some of the best Windows Phone apps are created by students. But developing a GOOD app takes a certain amount of effort.

We need to make our app stand out by creating a good user experience, which follows the UI guidelines, and make sure it works flawlessly. Luckily, the certification of all apps helps us in the process of creating better apps, since we need to take care of the small details. You will be shown how to leverage the SDK's built-in tools to make your app certification-ready.

Prism, Caliburn Micro, MVVM Light – Best frameworks for Windows Phone

Mobile apps can sometimes be as simple as creating a home page, throwing in an app bar and adding a nice background. As the app we're creating gets more complicated, we begin to examine frameworks that will not only create some order in our code, but also make our code much more maintainable.

In this session, we will introduce the more significant client-side frameworks for Windows Phone, and discuss the pros and cons of using each one of them. At first we will focus on Prism, perhaps the most important UI framework in the XAML world. We will show how Prism, a framework created by Microsoft's Patterns and Practices team, is fully supported under Windows Phone. Later, we will show the very mature Caliburn Micro framework vs. the light but reliable MVVM Light solution. We'll sum up by comparing all three frameworks, side by side, so you'll know which one to pick for your needs.

See you there

I believe this experience will be fun, and I’m looking forward to it.

Windows Phone: מדריך למפתחים נבוכים – ארכיטקטורה (פרק 3)

מה??? איזה ארכיטקטורה??? כולה אפליקציה פשוטה, שמים קצת קוד ב-code behind וסיימנו…
תגובות כאלה אני מקבל בכל פעם שאני מזכיר את המילה ארכיטקטורה בשיחות ובהרצאות שעוסקות ב-Windows Phone.

אז זהו, שכן! גם לאפליקציות סלולריות מגיע שיתכננו אותן טוב יותר. אמנם, לרוב מדובר באפליקציות פשוטות, המיועדות לבצע משימה קטנה ולהיות מפותחות מהר ככל האפשר, ובכל זאת, ככל שנתכנן אותן טוב יותר כך נוכל בסופו של דבר לפתח ולתחזק אותן בצורה פשוטה יותר.

פוסט זה הוא החלק השלישי בסדרת Windows Phone: מדריך למפתחים נבוכים.
בחלקים הקודמים למדנו למה כדאי לנו לבחור ב-Windows Phone כפלטפורמה לאפליקציה החדשה שלנו, והבנו מה כדאי לנו לפתח, ותחת איזה סוג של רשיון.

למה אתה מתכוון כשאתה מדבר על ארכיטקטורה לאפליקציה סלולרית?

קודם כל בואו נדבר קצת על השכבות השונות המעורבות באפליקציה שלנו. לא מדובר רק על החלוקה ל-client-server-database, אלא גם על חלוקה פנימית של חלקי ה-client השונים.

אם נתחיל מהעבודה עם צד השרת, אין ספק שכמעט כל אפליקציה מתוחכמת שמכבדת את עצמה צריכה שרת ובסיס נתונים מרכזי – לו רק על מנת לאפשר גיבוי וסנכרון של נתוני המשתמש. האמירה נכונה גם לגבי משחקים שמנהלים, לדוגמא, את רשימת השחקנים המובילים. היום כולם מדברים על הענן, ומכיוון שב-NET. עסקינן, יש מן הסתם לשקול שימוש ב-Azure. אני לא מתכוון להכנס לשיקולים השונים של בחירת ה-server side שלנו, אם זה אחסון ב-shared hosting, שירותי ענן, או אפילו, רחמנא ניצלא, הקמת שרת עצמאי (עדיין עושים את זה היום…?), קודם כל כי אני לא מומחה server, אבל בעיקר כי זאת לא מטרת הפוסט. אני כן רוצה להגיד מילה על Azure. כמו לרובנו יש לי רשיון MSDN, ותחת רשיון זה אני יכול להתנסות בשירותים השונים של Azure בחינם. אני רוצה להגיד שהפשטות שבה ניתן להעלות service ל-Azure פשוט קנתה אותי. ניתן להשתמש ב-Windows Azure Toolkit for Windows Phone בשביל להתחיל, לי זה עזר במספר פרוייקטים בהם עסקתי.

אוקיי, אז נחזור לצד ה-client. אז איזה ארכיטקטורה ניתן כבר לממש באפליקציית Windows Phone קטנה? אם נהיה רציניים לרגע, אני מאמין שברוב המקרים לא נממש אפליקצייה קומפוזיטית בעזרת framework כמו Prism (למרות שניתן). ובכל זאת, ניתן בהחלט לקול שימוש ב-Design Patterns כמו MVVM – Model-View-View-Model. מכיוון שקצרה היריעה מלכסות גם את MVVM בפוסט זה, אני מפנה אתכם למאמרי ה-MVVM של קולגה שלי מסלע הידוע בכינויו אלעד-MVVM-כץ לקריאה נוספת.
מי שמכיר אותי ופגש אותי בהרצאותיי השונות בודאי יודע שיש לי שריטה בנוגע לעקרונות ארכיטקטורה ועיצוב  תוכנה – אני פשוט לא נותן לעצמי הנחות. כך לדוגמא, לא תמצאו אותי כותב code behind באפליקציות שלי. אך ככל שהאפליקצייה שלנו מסתבכת זה נהיה מורכב יותר, על אחת כמה וכמה כשכותבים אפליקציה ל-Windows Phone.

נתייחס לדוגמא לנושא הניווט. כשאני בא לנווט מדף אחד למשנהו ב-Windows Phone, אני צריך להשתמש ב-NavigationService, לתת את ה-Uri של הדף אליו אני רוצה להתנווט,ולהעביר פרמטר במידת הצורך:

private void Button_Click_1(object sender, EventArgs e)
{
    var someParam = 10;
    NavigationService.Navigate(new Uri("/Page.xaml?someParam=" + someParam, UriKind.Relative));
}

את אותו פרמטר אני אמור לקבל בעת הניווט לדף הבא – במקרה זה Page.xaml – ע”י דריסה של פונקצייה בשם OnNavigatedTo:

protected override void OnNavigatedTo(NavigationEventArgs e)
{
    base.OnNavigatedTo(e);
 
    var someParam = NavigationContext.QueryString["someParam"] as int?;
}

מצד אחד נראה פשוט, אך איך MVVM משתלב בזה? הרבה יותר מדי code behine בשבילי…

כאן נכנס framework שלמדתי לחבב אותו בתקופה האחרונה שנקרא Caliburn Micro. זהו open source framework שצמח מתוך framework אחר המוכר בתעשייה בשם Caliburn, והוא מיועד לספק את הכלים הבסיסיים לפיתוח אפליקציות בכל פלטפורמות ה-XAML. הוא כולל בין השאר, אבל לא רק, Container לאתחול אובייקטים באפליקציה, ViewModelLocator/ViewLocator לשידוך אוטומטי בין ה-View ל-ViewModel ללא צורך בקונפיגורציה ומנגנון לניווט בין ViewModels.

אני לא מתכוון להכנס ב-post זה לעומקי Caliburn Micro, אסתפק בהדגמה של מנגנון הניווט בין ה-ViewModels כדי שתוכלו להשוות עם דוגמת הקוד מעלה.

ניווט ל-ViewModel אחר עם פרמטר ב-Caliburn Micro:

var someParam = 10;
_navigationService.
    UriFor<SomeViewModel>().
    WithParam(x => x.SomeParam, someParam).
    Navigate();

שימו לב שהפרמטר מועבר למעשה ל-property של SomeViewModel, כך שהוא נגיש מיד כש-ViewModel זה נטען. זה לא הרבה יותר ברור וקריא?

לסיכום, גם לעולם האפליקציות ל-Windows Phone מגיע התייחסות רצינית, זאת על מנת שנוכל לפתח ולתחזק את האפליציה שלנו לאורך זמן. אני ממליץ בחום לנבור ולחקור את Caliburn Micro.

בית פתוח בנושא פיתוח אפליקציות METRO ל-Windows 8 שנערך היום

תודה רבה לכל מי שהשתתף ביום הפתוח בנושא מבוא לפיתוח אפליקציות METRO  ל-Windows 8 שנערך היום במייקרוסופט רעננה.
אני מקווה שכולם נהנו כפי שאני נהנתי, תודה כמובן גם למייקרוסופט על האירוח.

ערכנו מעבר על החידושים ב-Windows 8, מודל הפיתוח האסינכרוני ומחזור החיים החדש של אפליקציות.
כמו כן דיברנו על האפשרויות הנוספות הפתוחות עבורנו כמפתחי אפליקציות לביצוע אינטרקציה עם המשמש גם כשהאפליקציה לא רצה, כמו עדכון ה-Tile או השתתפות במנגנון החיפוש המובנה.

אני מקווה שהצלחתי לגרום לכולם לרצות ללמוד עוד את הנושא – ויש עוד הרבה מה ללמוד.

עדכון: הנה קטעי הוידאו משתי ההרצאות

Windows 8 Camp: Building Metro-style Apps with XAML and C# - Part 1

Windows 8 Camp: Building Metro-style Apps with XAML and C# - Part 2

מצרף את המצגת ואת דוגמאות הקוד.

Fixing Frame Navigation in Metro Style Apps

So, you're already started working on your Metro Style App on Windows 8 Consumer Preview? That's great!

As you know, there are still many issues with Metro Style Apps development on this version of Windows 8 - is it even a beta? Anyway, during development of an app for a customer in C# and XAML, I ran into several bumps.

Today I want to talk about a bug in the built in Frame control. This control is responsible for navigating between pages in Metro Style apps. When you want to navigate to a different page, you need to call the Frame class's Navigate function:

Navigation in Windows 8 Metro Style Apps

var frame = (Frame)Window.Current.Content;
frame.Navigate(typeof(SecondPage));

Well, that's simple enough, right? It is very similar to the way navigation works in Silverlight, and of course Windows Phone:

Navigation in Silverlight and Windows Phone

var pageUri = new Uri("/Pages/SecondPage.xaml", UriKind.Relative);
this.NavigationService.Navigate(pageUri);

You can notice the major difference from Silverlight is the use of the page type, rather than its Uri. This shouldn't have been an issue, but unfortunately there seems to be a bug in the built in Frame control in Windows 8 Consumer Preview. Currently, when you try to Navigate to the same page type twice in a row - perhaps passing a different parameter each time - the navigation is not cached correctly by the internal navigation stack of the Frame class.

So when you try to navigate back to the previous page, you'll notice that the frame counts all instances of a specific page type as one entry in the navigation history stack. Here is a quick repro:

Start from page A
Navigate to page B (#1)
Navigate to page B again (#2)
Navigate back
Notice that you're back in page A, and the entry for page B (#1) is completely ignored.

This can be quite frustrating, especially for developers like myself, with experience in developing XAML based apps in other frameworks. After reading in the Metro Style Apps forums, all I found was a suggestion to implement a fixed Frame control:
http://social.msdn.microsoft.com/Forums/en-US/winappswithcsharp/thread/61b66a9a-3557-4b6b-ab47-50bb9d44f38b

Here I am, stepping up to the challenge. Trying to inherit from class Frame won’t do the trick – none of the Frame class members are marked as virtual. Creating our own Frame class could cause some other problems, since some built in classes like Page have members of type Frame. I decided to go this path since I needed the workaround, hopefully Microsoft will fix this bug in the next version.

So what do we need? We need some sort of a FrameEx class which inherits from class ContentControl, allows navigation and remembers navigation history. We also need it to implement the INavigate interface, like the original Frame class does.

Lets handle nav history first. We’ll create a Stack instance which will remember each call to create a page, together with the specific parameter:

private Stack<PageTypeWithParam> _navigationStack;
 
public FrameEx()
{
    _navigationStack = new Stack<PageTypeWithParam>();
}

Notice that the PageTypeWithParam class will be defined to hold the value for both page type and parameter for each navigation record.

During the navigation request, the current record will be saved to temp fields while the previous record will be inserted to the stack:

private Type _currentPageType;
private object _currentParam;
 
public bool Navigate(Type sourcePageType, object parameter)
{
    if (_currentPageType != null)
    {
        _navigationStack.Push(new PageTypeWithParam { PageType = _currentPageType, Param = _currentParam });
    }
 
    this.Content = page;
    
    if (parameter != null && page.DataContext == null)
    {
        page.DataContext = parameter;
    }
 
    _currentPageType = sourcePageType;
    _currentParam = parameter;
}

Notice that I chose to enter the parameter right into the page’s DataContext. This is far from ideal, but again, just like other limitations we ran into, I had no way of calling the OnNavigatedTo function of the page.

Finally, the CanGoBack property and the GoBack function are pretty straight forward:

public bool CanGoBack
{
    get
    {
        return _navigationStack.Count > 0;
    }
}
 
public void GoBack()
{
    _currentPageType = null;
    _currentParam = null;
 
    var pageTypeWithParam = _navigationStack.Pop();
    Navigate(pageTypeWithParam.PageType, pageTypeWithParam.Param);
}

Here is the full source code for the FrameEx class:

public class FrameEx: ContentControl, INavigate
{
    private Stack<PageTypeWithParam> _navigationStack;
 
    private Type _currentPageType;
    private object _currentParam;
 
    public FrameEx()
    {
        _navigationStack = new Stack<PageTypeWithParam>();
    }
 
    public bool Navigate(Type sourcePageType, object parameter)
    {
        if (sourcePageType == null)
        {
            throw new ArgumentNullException("sourcePageType");
        }
 
        var page = CreatePage(sourcePageType);
 
        if (page == null)
        {
            throw new ArgumentException("Page cannot be constucted from the given type", "sourcePageType");
        }
 
        if (_currentPageType != null)
        {
            _navigationStack.Push(new PageTypeWithParam { PageType = _currentPageType, Param = _currentParam });
        }
 
        this.Content = page;
        if (parameter != null && page.DataContext == null)
        {
            page.DataContext = parameter;
        }
 
        _currentPageType = sourcePageType;
        _currentParam = parameter;
 
        return true;
    }
 
    public bool Navigate(Type sourcePageType)
    {
        return Navigate(sourcePageType, null);
    }
 
    private Page CreatePage(Type sourcePageType)
    {
        var page = Activator.CreateInstance(sourcePageType) as Page;
        return page;
    }
 
    public bool CanGoBack
    {
        get
        {
            return _navigationStack.Count > 0;
        }
    }
 
    public void GoBack()
    {
        _currentPageType = null;
        _currentParam = null;
 
        var pageTypeWithParam = _navigationStack.Pop();
        Navigate(pageTypeWithParam.PageType, pageTypeWithParam.Param);
    }
 
    public void GoHome()
    {
        if (_navigationStack.Count > 0)
        {
            while (_navigationStack.Count > 1)
            {
                _navigationStack.Pop();
            }
 
            GoBack();
        }
    }
 
    private class PageTypeWithParam
    {
        public Type PageType { get; set; }
        public object Param { get; set; }
    }
}

Of course we will need to use our new FrameEx class in App OnLaunched method:

protected override void OnLaunched(LaunchActivatedEventArgs args)
{
    // ...
 
    // Create a Frame to act navigation context and navigate to the first page
    var rootFrame = new FrameEx();
    rootFrame.Navigate(typeof(HomePage));
 
    // Place the frame in the current Window and ensure that it is active
    Window.Current.Content = rootFrame;
    Window.Current.Activate();
}

Have fun…

 

מפגש Windows Devices User Group בנושא היכרות עם Windows 8

תודה רבה לכל מי שהגיע למפגש אתמול בנושא פיתוח אפליקציות מסוג Metro Style ב-C# ל-Windows 8.
היה כיף לראות קבוצה של אנשים עם כל כך הרבה ידע בתחום פיתוח מבוסס XAML, אפילו למדנו כמה דברים חדשים…
(למשל, ידעתם שנכון לרגע זה, אין דבר כזה שנקרא MarkupExtension ב-WinRT? המחלקה Binding יורשת ישירות מ-DependencyObject).

ברכות לארז שזכה במכשיר Windows Phone חדש במסגרת התחרות שקיימנו בקבוצה.

בכל אופן, במפגש הבא שיערך ב-24/4/12 נרחיב את הידע שלנו ב-Windows 8, וננסה להביא מישהו שיספר לנו על חווית הפיתוח של אפליקציה אמיתית. במידה ויש לכם נושאים שתרצו שנדבר עליהם, או אפילו תרצו לדבר בעצמכם, צרו קשר איתי או עם פבל יוסיפוביץ’.

מצרף את המצגת ודוגמאות הקוד מהמפגש.

ה-Windows Phone Marketplace עושה עליה

עוד בשורה טובה למפתחי Windows Phone בארץ הקודש. כפי שהכנתי אתכם בפוסט הקודם, בלוג המפתחים ל-Windows Phone פרסם לפני זמן קצר שניתן לפרסם אפליקציות ל-23 מדינות חדשות, ישראל בתוכן. מפתחים שכבר פרסמו אפליקציות מוזמנים לגשת לעמוד האפליקציה שלהם ב-AppHub:

Marketplace My App Screenshot

ללחוץ על Lifecycle ו-Edit catalog details:

Marketplace My App Screenshot

שם צריך לבחור מדינות חדשות לאפליקציה שלנו:

image

סוף סוף יש לאפליקציית הפנגו שלי בית חם ואוהב…
קדימה רבותיי, להתחיל לכתוב אפליקציות בעברית!

חידושים ב-Windows Phone: להורדה SDK חדש (וגם ספויילר: ישראל בפנים)

אז בתור התחלה נפתח בידיעה החשובה של המהדורה: המרקט של Windows Phone בדרך לישראל. בפוסט שפורסם בבלוג הפיתוח ל-Windows Phone מופיעה רשימה של 23 מדינות חדשות שיצטרפו למרקט של Windows Phone במהלך החודש הקרוב. בין המדינות מופיעה, כאמור, ישראל. המשמעות היא שבקרוב משתמשים מישראל יוכלו להוריד אפליקציות כחול לבן שיכוונו לשוק הישראלי ספיציפית.

מה זה אומר מבחינתנו, כמפתחי אפליקציות ל-Windows Phone?
כמובן שקודם כל יש כאן הסטוריה קטנה – אנחנו על המפה!!! אני מניח שמתקרב היום בו תהיה תמיכה עברית וימכרו מכשירי Windows Phone בחנויות ספקי הסלולר הישראליים.
בנוסף, נוכל כמובן לייצר אפליקציות המיועדות לקהל הישראלי (לדוגמא אפליקציית פנגו – לא רשמית – שכתבתי והועלתה מחוסר ברירה למרקט האמריקאי), שיהיו נגישות רק לישראלים.

ונעבור לנושא חשוב לא פחות. בגרסא הקרובה של Windows Phone, המכונה Tango מתכוונת מייקרוסופט להוריד את דרישות המינימום המחמירות של החומרה הנדרשת להרצת Windows Phone, זאת על מנת לאפשר ליצרניות החומרה לייצר טלפונים זולים יותר. דרישות החומרה הפחות מחמירות גורמות לשינויים ביכולות בהן האפליקציות שלנו מורשות להשתמש. לדוגמא, אפליקציות לא יוכלו להריץ תהליכי רקע (Background Tasks) במכשירים שיוצרו ברף התחתון של דרישות החומרה. כפועל יוצא מהמשמעויות של גרסא זו, עלינו לבדוק האם האפליקציות שכתבנו עד כה תומכות בגרסה החדש. ה-SDK החדש ל-Windows Phone, גרסא 7.1.1, הניתן להורדה מכאן, מאפשר לנו להריץ את האפליקציות שלנו מול אמולטור המדמה מכשיר חלש יותר. לבדיקתכם אודה… Smile

וזהו פחות או יותר.

מקווה לראות אתכם במפגש ה-Windows Devices User Group שמתקיים מחר ב-17:00 במשרדי מייקרוסופט רעננה, בו נדבר על מנגנון הניווט המובנה ועל מחזור חייה של אפליקציית Windows Phone.

בית פתוח בסלע בנושא Windows 8

תודה רבה לכל מי שהשתתף בבית הפתוח שהתקיים היום בבית סלע.
נהניתי מאוד לדבר איתכם על פיתוח אפליקציות Metro ל-Windows 8, ועל ההזדמנות שלנו יש, כמפתחים, להתכונן לכניסה לשוק של מערכת הפעלה מעניינת זו.

אשמח לראות אותכם בכנס ה-SDP שיתקיים ב-25-29/3/12, שם נרחיב ונדבר על נושאים נוספים שקשורים לפיתוח ל-Windows 8, כמו גם חידושים בסביבת הפיתוח.

מצרף את דוגמאות הקוד שהוצגו במהלך ההרצאה.

 

מפגש של ה-Windows Devices User Group בפברואר

אני רוצה להזמין אתכם למפגש הבא של קבוצת המשתמשים של התקני חלונות (או באנגלית Windows Devices User Group) שאני מנהל יחד עם פבל יוסיפוביץ’. המפגש ייערך בתאריך 28 לפברואר 2012, בשעה 17:00 בערב, במשרדי מייקרוסופט, רעננה.

במפגש זה נרחיב את הידע שלנו בנושא Windows Phone.
נדבר על מנגנון הניווט המובנה ועל מחזור חייה של אפליקציית Windows Phone (תומר שמם).
בנוסף, דורי מחברת SBSH יספר על הסבה של אפליקצייה מוצלחת בשם SafeWallet ל-Windows Phone.

ניתן להרשם בקישור זה.

מי שעדיין לא הצטרף לקבוצה שפתחנו ב-LinkedIn מוזמן לעשות זאת.

נתראה ב-28…

Windows Phone: מדריך למפתחים נבוכים – מה לפתח (פרק 2)

פוסט זה הוא החלק השני בסדרת Windows Phone: מדריך למפתחים נבוכים.

בפרק בראשון בחרנו את Windows Phone כפלטפורמת הפיתוח לאפליקציה החדשה שלנו. בפרק הזה ננסה לחשוב ביחד איזה סוג של אפליקציה נרצה לפתח, ואיך נרוויח מזה משהו.

קודם כל נרצה להבין איזה סוגים של אפליקציות המשתמשים רוצים. מצורפת מטה מפה המציגה סטטיסטיקה ששוחררה ע"י מייקרוסופט בבלוג הפיתוח ל-Windows Phone.

יש כמה נתונים מעניינים במפה זו. דבר ראשון, שימו לב ש-64% מהאפלקציות שהמשתמשים מוכנים לשלם עליהן הן בעצם משחקים. גם בתחום האפליקציות החינמיות רוב ההורדות הן של משחקים. בסה"כ ניתן להבין מזה שהמשתמשים שלנו רוצים לשחק. מצד שני נוכל גם לשים לב שמתוך למעלה מ-50,000 אפליקציות שפורסמו, רק 14% הן משחקים. המסקנה המתבקשת היא שאם נפתח משחק, חינמי או בתשלום, כנראה שיהיה לו ביקוש בקרב המשתמשים.
ניתן גם לראות שכל שאר הקטגוריות מתחלקות באופן די שווה, עם עדיפות לכלים (Tools and Productivity) ובידור (Entertainment).
המפה יכולה לעזור לנו להבין איזה סוג של אפליקציה כדאי לנו לפתח, כשכמובן ניתוח סטטיסטי פשוט אומר שככל שהפער בין אחוז האפליקציות מקטגוריה מסויימת לאחוז הביקוש לאפליקציות מאותו סוג גדול יותר, ככה הסיכוי שלנו להצליח גבוה יותר.

חינם, בתשלום או גם וגם?

ישנם שני מודלים שניתן לישם: חינם או בתשלום. אם נתחיל דווקא מאפליקציות בתשלום, נגיד שבגדול המשתמשים של Windows Phone מוכנים לשלם על אפליקציות טובות. כמות האפליקציות בתשלום היא יחסית גבוהה, והשוק (עדיין) לא מוצף בהרבה אפליקציות חינמיות מוצלחות. כך שבמידה והרעיון שלכם טוב, תוכלו בקלות לדרוש עליו כסף. כמה כסף לדרוש זו כבר שאלה בפני עצמה. במידה ופוטנציאל ההורדה הוא גדול - למשל אם אתם פונים לקהל משמתמשים רחב כמו ציבור הנהגים - מומלץ לדרוש מחיר נמוך ככל האפשר - לצורך העניין דולר אחד. ככה תוכלו להגיע למסת משתמשים גדולה ובסופו של דבר כנראה להרוויח יותר. אם פוטנציאל ההורדה הוא קטן יותר - למשל קהל היעד הוא ציבור חובבי האופרה במנהטן - תצטרכו לשקול האם לבקש סכום גבוה יותר. בכל מקרה ניסוי ותהייה תמיד אפשרי. תמיד ניתן לשנות תמחור ולבדוק ביצועים.
בכל מקרה, קחו בחשבון שמייקרוסופט לוקחת 30% מהרווחים על אפליקציות בתשלום. על הסכום שיועבר לחשבון הבנק שלכם בישראל תצטרכו לשלם גם מס הכנסה.

גם המודל החינמי יכול להיות רווחי עבורכם. במידה ותרצו, תוכלו לשלב רכיב פרסומות באפליקציה שלכם, ולהרוויח על צפיות וקליקים (שוב, מס הכנסה). באחד הפרקים הבאים נבחן את האפשרויות שעומדות בפנינו לשילוב פרסומות ב-Windows Phone.
רווח נוסף אפשרי מאפליקציה חינמית, הוא פרסום שלכם כמפתחי אפליקציות - לרוב כמות ההורדות של אפליקציה חינמית גדולה מכמות ההורדות של אותה אפליקציה בדיוק בתשלום. במידה ותכתבו אפליקציה חינמית מצליחה תוכלו להתבלט (ולהבליט בקורות חיים) וע"י כך למשוך את תשומת ליבם של מעסיקים מוצלחים. אפשרות זו מומלצת בעיקר לסטודנטים הרוצים לעבוד בתחום.

המודל האחרון הוא גם בתשלום, וגם בחינם. ניתן לייצר גרסה חינמית של אפליקציה בתשלום, לפי מודל של Premium Content. במודל זה מי שרוכש את האפליקציה המלאה יקבל יותר יכולות ותכנים. את מודל הגם וגם ניתן ליישם בשתי דרכים: הראשונה היא יצירת שתי אפליקציות שונות, אחת חינמית ואחת בתשלום, ובאפליקציה החינמית לייצר קישור להורדת האפליקציה בתשלום. האפשרות השנייה היא Trial Mode, פונקצייה שניתן לשלב באפליקצייה בתשלום שלנו. ב-Trial Mode, המשתמש מוריד גרסת נסיון של האפליקציה שלנו, ואנחנו שולטים בדיוק איזה יכולות יהיו זמינים ב-Trial וב-Full Mode.

רעיונות

נקנח בהבנה פשוטה אחת. יש ביקוש גדול ובלתי מובן לאפליקציות פשוטות ושימושיות.
ראו את ההצלחה שיש בכל הפלטפורמות לאפליקציות פנס לסוגיהן...
אני פיתחתי (לפי רעיון של חבר) אפליקציה חינמית בשם Camera Mirror שמשתמשת במצלמה הקדמית של המכשיר על מנת להציג תמונת מראה של המשתמש. לאפליקציה יש תוך קצת יותר מחודש למעלה מ-2000 הורדות. אמרתי כבר שלקח לי רק שעה לפתח אותה...?

מפגש ראשון של ה-Windows Devices User Group

אתמול קיימנו את מפגש המשתמשים הראשון של ה-Windows Devices User Group שאני מנהל יחד עם פבל יוסיפוביץ’, והיה ממש כיף. אני רוצה להודות לכל מי שהגיע להאזין לנו, שאל שאלות ותרם לאירוע. במהלך הערב דיברנו על מערכת ההפעלה למכשירים סלולריים של מייקרוסופט, ה-Windows Phone, ועל הטכנולוגיות בהן ניתן לפתח אפליקציות – Silverlight ו-XNA. אה, וגם אכלנו פיצות (תודה מייקרוסופט על שאירחתם אותנו).

בכוונתנו להמשיך להפגש מדי כמה שבועות ולהעביר נושאים בנושא פיתוח למכשירי Windows השונים. בהזדמנות זו אני מזמין את כל מי שלא הגיע הפעם להצטרף בפעם הבאה. בנוסף נשמח לשמוע הצעות / בקשות לנושאים שיועברו במפגשי ה-User Group הבאים, כמו גם הצעות של משתתפים מתוך הפורום להעביר הרצאה בעצמם בנושא קשור.

פתחנו קבוצה של הפורום באתר LinkedIn וכולם מוזמנים להצטרף אליה, גם אם לא הגעתם במפגש הראשון (רק אם תביאו בפעם הבאה פתק מההורים). כמו כן, אני מצרף לפוסט את המצגת שהעברתי (פבל כבר פרסם את המצגת שלו).

דבר אחרון, תזכורת לגבי התחרות שהכרזנו עליה: הראשון מבין חברי הפורום שיפרסם 3 אפליקציות ל-Windows Phone שיאושרו ויוצגו במרקט, ושסך כמות ההורדות של שלושתן יגיע ל-3000 יזכה לקבל מכשיר Windows Phone חדש דנדש. שימו לב שמדובר אך ורק באפליקציות שהוגשו לאישור אחרי ה-16/01/12, מועד המפגש הראשון של ה-User group. כל שעליכם לעשות הוא לשלוח אלי או אל פבל את ה-publisher name שלכם ב-App Hub מיד אחרי ששלושת האפליקציות שלכם אושרו ומופיעות במרקט.

נתראה בפעם הבאה…

Windows Phone: מדריך למפתחים נבוכים–חלק 1

nokia_lumia_900_black-623x506האם את/ה סטודנט/ית, או מתכנת/ת NET. משועמם/מת?
רוצה לעשות קצת כסף כיס ולהנות על הדרך?

מדריך זה מיועד למפתחים נבוכים אשר שקלו להתחיל לפתח למובייל, אבל אין להם מושג איך להתחיל. נבחן כאן מס’ נושאים שכדאי לחשוב עליהם לפני שפוצחים במלאכת הפיתוח.
אחת השאלות החשובות שכדאי שנשאל את עצמנו היא כמובן לאיזו פלטפורמה לפתח? מהכותרת של הפוסט, או אפילו ע”י הסקת מסקנות פשוטה (בכל זאת, הבלוג הזה מתארח במערכת הבלוגים של מייקרוסופט, ואני מתמחה בטכנולוגיות אלה) ניתן להבין שאני מכוון ל-Windows Phone. ובכל זאת אני רוצה להסביר למה אני חושב שבחירה אסטרטגית ב-Windows Phone כפלטפורמה לאפליקציה שלנו היא בחירה נכונה.

אז למה דווקא Windows Phone?

נפצח בעובדות. אנדרויד נראית כיום כפלטפורמה שתשלוט בשוק בשנים הקרובות. גם iOS של אפל, שלמרות שנדמה שנחלשה מעט, בהחלט חזקה בתמונת המאבק על ראשות הבית. Windows Phone משתרכת מאחור עם נתח שוק קטן מאוד, אם לא לומר מדאיג.

נדמה לרגע שאני מנסה לשכנע אתכם לוותר על Windows Phone לחלוטין, אך זה בהחלט לא המצב. נהפוך הוא – אני משוכנע ב-100% שלא רק זו תהיה השקעה נבונה להמר על Windows Phone, אלה שזו תהיה השקעה נבונה לעשות זאת כבר היום.

איך הגעתי למסקנה הפרועה הזו?
נתחיל בהשוואה לעולם שוק ההון. מי מכם שמשקיע בשוק ההון (סטודנטים, מצטער שאני אולי נוגע בנקודות רגישות) יודע שבשביל להרוויח כסף אמיתי צריך גם קצת להסתכן. הלא מסתכנים ישקיעו באג”ח (אנדרויד ו-iOS), שם ניתן לעתים לעשות כסף לא רע, אך הדגש הוא על המילה לעתים.
משקיעים המוכנים להמר קצת יותר ישקיעו במניות שנראות מוצלחות ושנראה בזמן ההשקעה ששווי השוק שלהן לא משקף את שווין האמיתי.

1083424_69218251

זהו בדיוק המצב בו נמצאת הפלטפורמה של מייקרוסופט.
התקשורת מאוד מפרגנת למערכת ההפעלה. רבים המאמרים שמשבחים את מערכת ההפעלה והחדשנות שהיא מביאה. מספיק לקרוא מספר מאמרים כמו זה של ה-New York Times, או Engadget בשביל לראות את האמונה של התקשורת במערכת ההפעלה.

מכאן המניה יכולה רק לעלות. האם אתם בטוחים שתרצו לקנות את המניה רק כשתגיע למחיר השיא? נכון להיום יש במרקט של מייקרוסופט כ-50,000 אפליקציות, בעוד שב-appstore יש למעלה מחצי מליון אפליקציון ובאנדרויד מרקט קרוב ל-400,000. איפה נראה לכם שהאפליקציה שלכם תוכל להתבלט?

חברה קטנה בשם נוקיה

על נוקיה שמעתם, נכון? אז למרות מספר שנים פחות מוצלחות, החברה הקטנה מפינלד היא עדיין יצרנית הטלפונים הגדולה בעולם!!!

נוקיה בחרה ב-Windows Phone כמערכת ההפעלה בה תשתמש למכשירי הסמארטפון אותם תפתח בשנים הקרובות. הענקית הפינית שמה את כל כובד משקלה על מערכת ההפעלה, וכבר הספיקה להוציא שני מכשירים – Lumia 710 ו-Lumia 800 (המכשיר איתו אני מסתובב בימים אלה – פשוט מכשיר מדהים) ולהכריז על השלישי – Lumia 900 בתערוכת CES שנערכת בימים אלה. ה-Lumia 900 הספיק לקצור פרסים בתערוכה.

stephen-elop-nokia-lumia-900

סביבת וטכנולוגיית הפיתוח

סיבה נוספת להמר על Windows Phone היא סביבת הפיתוח הנוחה והמפנקת – Visual Studio. מפתחי NET. ירגישו בבית, לסטודנטים יהיה קל להתרגל. אין עוררין על כך ש-Visual Studio היא אחת הסביבות המוצלחות נכון להיום לפיתוח תוכנה (אם לא ה-…).

אין צורך להתקין הרבה התקנות ולקנפג (מישהו אמר אנדרויד?), או לקנות מק (מישהו אמר אייפון?) - התקנה פשוטה של ה-Windows Phone SDK תסגור לנו את הפינה.

מי שכתב כבר ל-Silverlight או WPF ירגיש מייד בבית, אבל אני באמת מאמין שגם למי שיודע רק NET., או אפילו רק Java, יהיה קל מאוד להסתדר.

אתם מוזמנים בחום לגשת למדריך שכתבתי בניוזגיק בנושא התנעה של פיתוח ל-Windows Phone.

Windows 8

כל מי שלא היה בכדור הארץ בחודשים האחרונים אולי פספס את ההכרזה על Windows 8, מערכת ההפעלה החדשה של מייקרוסופט למחשבים רגילים וטבלטים. מזל שאתם כן הייתם ולא פספסתם את ההכרזה. אפרופו טבלטים, ל-Windows 8 היא הראשונה עם סיכוי אמיתי להתמודד מול iPad המוצלח.

ב-Windows 8 יהיה Windows Store בו תוכלו למכור אפליקציות למשתמשי Windows – אמרתי כבר שיש כ-650 משתמשי Windows בעולם?

ואם כבר פיתחתם אפליקציה ל-Windows Phone, למה שלא תעשו כמה התאמות ותמירו אותה ל-Windows 8???

Windows8-metro-start

מה הלאה?

בפרקים הבאים נדבר על מה לכתוב, איך להרוויח מפרסום, איך להציג סטטיסטיקת שימוש ונושאים נוספים שמעניינים אותי.

אתם מוזמנים בחום להצטרף ל-User Group אותו אני מוביל יחד עם פבל יוסיפוביץ על מנת לשמוע על ההזדמנויות השונות ועל טכנולוגיית הפיתוח למכשירי מייקרוסופט.

Quick Tip: ChevronWP7 – Dev unlocking your WP7 phone

chevronwp7Want to develop or even just install homebrew apps on your Windows Phone, but don’t want to pay the App Hub $100 yearly membership fee?
Now there’s a another alternative. It’s called ChevronWP7, a non official tool created to dev unlock your phone, for a minimal one time price of $9. Unlocking your phone will allow you to install apps you create or download (for example from XDA-Developers website) by copying XAP files directly to your phone. Please notice that even though this is not an official tool by Microsoft, the creators worked together with Microsoft’s Windows Phone development team to ensure this tool doesn’t brick phones. Could you imagine such a cooperation between the platform underground and Apple???

Windows Phone Jump List Contact Chooser Control

image3One of my favorite controls in my Windows Phone is the built in contacts chooser control. It groups all of my contacts by the first letter and shows them in order. Once you click a letter, it shows a list of the entire alphabet - every letter which has contacts can be clicked and the control scrolls down (or up) so the group is visible. This is in my opinion a user experience which really differentiates Windows Phone from competing platforms.

You can see the jump list functionality in this video:

So the question is, can we make use of this user experience in our own Windows Phone app?

The short answer is no. Unfortunately the Windows Phone SDK does not ship with such a control.
Fortunately, the August 2011 version of the Windows Phone Toolkit includes enhancements to the LongListSelector control which allows grouping of items and the jump list behavior. What’s left for us to do is to join that functionality together with the contacts database and make it work like a chooser control.

In this post I will be sharing the source code of my contact chooser control, a control I needed to create for my “My Assistant” app, a reminder application. If you can’t wait to read the rest of the explanation, you can scroll down and download the source code.

These are the main source files in my project:

  • ContactChooser – the main control to be used by the developer
  • ContactChooserPage – the page which actually does the job of displaying the contact list.
  • ContactGroup and ContactItem – classes which encapsulate the contacts data and adds additional display properties.

Using this control is as easy as adding it to our XAML (first we need to add the XMLNS entry of course) and binding its Value property to our data:

Using ContactChooser
  1. <controls:ContactChooser Value="{Binding SelectedContact}" />

Please notice that the visual definition of the ContactChooser control is defined under Generic.xaml, under the Themes folder. This is the place where Silverlight looks for default control styles. In the new ControlTemplate defined under the default style, the root element being used is a button. Clicking the button navigates to the ContactChooserPage (look under the ShowContactsPage function in the ContactChooserControl).
The rest of the control itself is pretty standard. You can choose to replace the ContactChooserPage by initializing the ChooserPageUri property with the Uri of the new page you wish to use. Notice it will need to implement the IContactChooser interface.

Now lets move on to the ContactChooserPage. What it contains is a LongListSelector control which is configured to group the contacts together by the first letter. In the XAML part you can see how the LongListSelector control is initialized.

First the GroupItemsPanel – the panel responsible for showing the list of groups - is set to be a WrapPanel. This way the groups are stacked one next to the other, and once the line run out a new line is created.

Group Items Panel
  1. <toolkit:LongListSelector.GroupItemsPanel>
  2.     <ItemsPanelTemplate>
  3.         <toolkit:WrapPanel Orientation="Horizontal"/>
  4.     </ItemsPanelTemplate>
  5. </toolkit:LongListSelector.GroupItemsPanel>

Next, the GroupItemTemplate shows how an individual group item needs to look like in jump list mode.

Group Item
  1. <toolkit:LongListSelector.GroupItemTemplate>
  2.     <DataTemplate>
  3.         <Border
  4.             Background="{StaticResource PhoneAccentBrush}"
  5.             Width="99"
  6.             Height="99"
  7.             Margin="6">
  8.             <TextBlock
  9.                 Text="{Binding FirstLetter}"
  10.                 FontFamily="{StaticResource PhoneFontFamilySemiBold}"
  11.                 FontSize="48"
  12.                 Margin="8,0,0,0"
  13.                 Foreground="White"                                        
  14.                 VerticalAlignment="Bottom"
  15.                 />
  16.         </Border>
  17.     </DataTemplate>
  18. </toolkit:LongListSelector.GroupItemTemplate>

The GroupHeaderTemplate defines how a group should look like within the list of items.

Group Header
  1. <toolkit:LongListSelector.GroupHeaderTemplate>
  2.     <DataTemplate>
  3.         <Border Background="Transparent" Margin="12,8,0,8">
  4.             <Border
  5.                 Background="{StaticResource PhoneAccentBrush}"
  6.                 Padding="8,0,0,0"
  7.                 Width="62"
  8.                 Height="62"
  9.                 HorizontalAlignment="Left">
  10.                 <TextBlock
  11.                     Text="{Binding FirstLetter}"
  12.                     Foreground="#FFFFFF"
  13.                     FontSize="48"
  14.                     FontFamily="{StaticResource PhoneFontFamilySemiLight}"
  15.                     HorizontalAlignment="Left"
  16.                     VerticalAlignment="Bottom"
  17.                     />
  18.             </Border>
  19.         </Border>
  20.     </DataTemplate>
  21. </toolkit:LongListSelector.GroupHeaderTemplate>

Finally, the ItemTemplate property holds the template that should be used to display a single contact in the list:

Item Template
  1. <toolkit:LongListSelector.ItemTemplate>
  2.     <DataTemplate>
  3.         <StackPanel Orientation="Horizontal" Margin="10,5,0,5">
  4.             <Border Width="64" Height="64" Background="{StaticResource PhoneChromeBrush}" Margin="0,0,10,0">
  5.                 <Image Source="{Binding Image}" VerticalAlignment="Top"/>
  6.             </Border>
  7.             <TextBlock Text="{Binding Contact.DisplayName}" Margin="0" Style="{StaticResource PhoneTextTitle2Style}" />
  8.         </StackPanel>
  9.     </DataTemplate>
  10. </toolkit:LongListSelector.ItemTemplate>

In the code behind of the ContactChooserPage you can see that once the page is loaded the Search function is called. The search function uses the Contacts database API to retrieve all the contacts.

Retrieving contacts
  1. var contacts = new Contacts();
  2. contacts.SearchAsync(null, FilterKind.None, null);

Once the contacts database returns a result set, the results are grouped together and added to the list of groups.

Grouping the contacts
  1. var items = new List<ContactGroup>();
  2. var groups = new Dictionary<char, ContactGroup>();
  3.  
  4. foreach (var contact in args.Results)
  5. {
  6.     char firstLetter = char.ToLower(contact.DisplayName[0]);
  7.  
  8.     // show # for numbers
  9.     if(firstLetter >= '0' && firstLetter <= '9')
  10.     {
  11.         firstLetter = '#';
  12.     }
  13.  
  14.     // create group for letter if it doesn't exist
  15.     if (!groups.ContainsKey(firstLetter))
  16.     {
  17.         var group = new ContactGroup(firstLetter);
  18.         items.Add(group);
  19.         groups[firstLetter] = group;
  20.     }
  21.  
  22.     // create a contact for item and add it to the relevant group
  23.     var contactItem = new ContactItem(contact);
  24.     groups[firstLetter].Add(contactItem);
  25. }
  26.  
  27. Items = items;

And that’s about it…

image2

image1

Please notice that my Contact Chooser control takes a different approach than the built in one.
First, the built in control lists all the letters of the alphabet, even letter groups with no contacts. In such a case the letter is displayed, but cannot get clicked. In my control only letter groups that contain contacts are displayed.
Second, in the built in control international characters are all grouped under the same symbol. Coming from a different country (Israel), in my control every international character gets its own group.

Have fun with my control (and blog about your experience…)!

You can download the source code from here. Notice that in order to make the solution compile, you will need to install the Windows Phone Toolkit.

The Basics of WinRT in Windows 8

Windows8-metroSo this is the first post that I’m writing in my brand new Windows 8 Developer Preview Samsung Tablet. One of the important concepts that have been introduced in the BUILD conference is the introduction of WinRT, the new runtime layer on top of which new apps can be written in the supported languages – .NET, JavaScript and C++.

WinRT exposes a set of libraries which can be used by any of the above languages. WinRT is supposedly the Win32 replacement, so it covers most of the more important capabilities Win32 covers. The main difference between the two is the way you access the API. WinRT exposes a set of classes, rather then functions in Win32, which you can access in an Object Oriented way in any of the supported languages. Each language got its own built in adapter layer for the WinRT API, so using classes from the WinRT layer is basically a matter of importing the correct namespaces.

One nice example of a WinRT class is the FileOpenPicker. It lives under Windows.Storage.Pickers namespace, and it’s practically the new way of opening files in Windows 8.

Windows-8-file-picker

Another very nice thing you could do is create a custom WinRT library in one language and reference it in project created in another language. So you can import a project written in C++ for example and reference it in a .NET project. One would argue that this could be done years ago using COM, but in fact with WinRT this process is so much simpler.
All you need to do in the exported project is change the project output type to WinRT (in project properties) and follow the following guidelines:

  1. API signatures must only use Windows Runtime Types
  2. Structs can only have public data fields
  3. Inheritance can only be used for XAML controls, all other types must be sealed
  4. Only supports system provided generic types

I hope to try and cover some more of the built in WinRT libraries in the next posts.

More Posts Next page »