Ibraheem Osama Mohamed (ابراهيم اسامه محمد)

Welcome to my blog :)

Archive for the ‘Windows 8.1’ Category

Windows 8 Future Access List

leave a comment »

One of Windows 8’s amazing feature is FutureAccessList. The idea behind it is once the user picked a certain file using the file picker you can added this file to the future access list and use it later in your application.
You get access to the file using a token , so when you add a file to the future access list you get a token for that file and you can use this token later to get this file.

Another amazing thing is that every application has its own futureAccessList so many apps can share the same file at the same time.

Now let’s try and see how it works.
1)Add new Windows 8 applicaiton from Visual Studio.
2)Add 2 buttons in the MainPage.xaml

<Button Content=”Get File From Token” Name=”GetFileFromTokenButton” HorizontalAlignment=”Left” Margin=”740,224,0,0″ VerticalAlignment=”Top” Click=”GetFileFromTokenButton_Click”/>

<Button Content=”Set token” HorizontalAlignment=”Left” Name=”SetTokenButton” Margin=”927,227,0,0″ VerticalAlignment=”Top” Click=”SetTokenButton_Click”/>

4)Add the event handlers for the events and define a string called token to save the token in it.

string token = null;

        private async void SetTokenButton_Click(object sender, RoutedEventArgs e)

        {

            var op = newFileOpenPicker { FileTypeFilter = { “*” }, CommitButtonText = “select this file”, SuggestedStartLocation = PickerLocationId.Desktop, ViewMode = PickerViewMode.List };

            var file = await op.PickSingleFileAsync();

            if (file != null)

            {

                token = StorageApplicationPermissions.FutureAccessList.Add(file);

            }

        }

        private async void GetFileFromTokenButton_Click(object sender, RoutedEventArgs e)

        {

            if (token != null)

            {

                StorageFile fileFromList = awaitStorageApplicationPermissions.FutureAccessList.GetFileAsync(token);

                await(new Windows.UI.Popups.MessageDialog(fileFromList.DisplayName)).ShowAsync();

            }

        }

Now lets run the application and press the set button

Select a file.

1

Then press the get button a message with a file name pops up as written in our code 🙂

2

For sure the best practice is to save the token in a place you can get back to it later

2056910448_thanks_xlarge

Ibraheem Osama Mohamed
[MVP]
@IbraheemOM

Advertisements

Written by Ibraheem Osama Mohamed

January 13, 2014 at 6:44 pm

Posted in Windows 8, Windows 8.1, xaml

Changing AppBarButton Icon on Run time in Windows 8 (Windows 8.1)

leave a comment »

Today I was testing the AppBarButton in Windows 8.1 and I thought of what if I want to change the Icon of the AppBarButton ex : from zoom out to zoom in??

<AppBarButton Click=”Zoom_Click_1″ Label=”Zoom Out” Icon=”ZoomOut” Name=”ZoomOutButton”/>

4

Just change the Icon property on the button click event but take care of something Icon Property takes IconElement and there are 3 class that inherits from it

FontIcon
PathIcon
SymbolIcon

So you can use any of those class to change the AppBarButton Icon in this sample I used the SymbolIcon

bool IsZoomIn = false;

        privatevoid Zoom_Click_1(object sender, RoutedEventArgs e)

        {

            if (!IsZoomIn)

            {

                ZoomOutButton.Label = “Zoom In”;

                ZoomOutButton.Icon = newSymbolIcon(Symbol.ZoomIn);

                IsZoomIn = true;

            }

            else

            {

                ZoomOutButton.Label = “Zoom Out”;

                ZoomOutButton.Icon = newSymbolIcon(Symbol.ZoomOut);

                IsZoomIn = false;

            }

        }

5

So simple 🙂

2056910448_thanks_xlarge

Ibraheem Osama Mohamed
[MVP]
@IbraheemOM

Written by Ibraheem Osama Mohamed

November 9, 2013 at 1:10 pm

Posted in C#, Windows 8, Windows 8.1, xaml

Where to find App Bundle Manifest (AppxBundleManifest.xml) in Windows 8.1 Applications

leave a comment »

One of the most amazing features in Windows 8.1 is the App Bundle Manifest, in this post I won’t talk about it as it is well defined in the MSDN Documentation

This post will be where and how to find it.

1)Open new Windows 8 application from Visual Studio 2013
2)Create App Package :
Right click in the project then store then Create App Package

1

3)Choose no in the next Windows

2

4)In the Package Config Windows on Generate App Bundle Section choose Always from the drop down box

3

Read the rest of this entry »

Written by Ibraheem Osama Mohamed

November 2, 2013 at 7:44 pm

Posted in Windows 8, Windows 8.1

%d bloggers like this: