Windows Mobile Support

  • Subscribe to our RSS feed.
  • Twitter
  • StumbleUpon
  • Reddit
  • Facebook
  • Digg

Sunday, 28 August 2011

How To: Create Themes for Smooth YouTube Downloader

Posted on 04:21 by Unknown
Overview:
This post explains how to create Themes for Smooth YouTube Downloader.


How To:
A Theme in SYTD is basically an XML file "ThemeName_Theme.xml" that defines the colors for different screens.
All themes can be found in "\Program Files\SmoothYTDownloader\Themes\" for a normal default installation.
In the Theme folder you can find the set of images used by the theme, replace any image with another PNG image to use it instead of the default ones.

Note: names after the "_" character, cannot be changed.


You can start by copying one of the existing themes folders and change its name.
The name of the theme folder is what the user sees when he goes to the Theme Selection Screen.
Note: because of a limitation in the way installation CAB file is created, all files under the Theme directory must start with "ThemeName_"
You can see that naming convention in existing Themes.


The XML defines two types of Color Nodes (You can't change one of them to the other):

  1. A GlossyColor is like the color used for the Top Label, which is constructed from 4 colors blended from Top to Bottom, there are some bultin glossy colors that can be used easily, or you can define your own glossy color by defining the 4 colors (see example in the built in XML files)

  2. A Color is just a normal color, which is constructed from 3 Components, Red, Green, Blue each with a value from 0 to 255




The formatting of the XML is straight forward, it contains a Parent Node that defines an application Screen Name with child nodes that define names of elements on that page.


Child nodes of "SettingsPages" node will affect both, Themes and Download Service selection screens.


Note: You can't remove any element of the XML, if the XML wasn't loaded correctly, the Application will fallback to Default Theme


Make sure to read the comments in the existing XML files.


Finally:
If you'd like your design to be included in this post, please email it to me, wassim.khalil9@gmail.com
Read More
Posted in | No comments

How To: Create Extensions for Smooth YouTube Downloader

Posted on 04:20 by Unknown

Overview:
This page is for Developers who would like to create an Extension for Smooth YouTube Downloader, to support Searching and Downloading from Sites other than YouTube


Warning: Sites which contain adult content will not be supported nor included in the application !


How To:
The way extensions work is very straight forward, all you need to do is Create a class which Implements an Interface with few functions, then copy the resulting assembly to "Extensions" folder in "\Program Files\SmoothYTDownloader\Extensions" directory on device along (for a normal default installation) with the XML that defines the FileName of the assembly along with the Class FullName.


Stary by downloading this sample project, which contains The Source Code for "DailyMotion" Extension


Now I'll explain each method in the Interface and when it's called:


public interface IDownloadService

{

string DeveloperNotes { get; }

string Name { get; }

int SearchItemHeight { get; }

int SearchItemSelectedHeight { get; }

List<VideoFormat> GetAvailableFormats(VideoInfo videoInfo);

string GetUniqueName(VideoInfo videoInfo);

string GetVideoUrl(VideoInfo videoInfo);

void OnFormatSelected(VideoInfo videoInfo, VideoFormat selectedFormat);

List<VideoInfo> Search(string searchText, int currentPage, int maxResult);

}


  • string DeveloperNotes { get; }


This will be displayed for users, when they click on "Show Developer Notes" in the "Download Service" selection screen, just in case there are some special cases in your Extension.





  • string Name { get; }


Name of Download Service, which will be Displayed in the "Download Service" selection screen




  • int SearchItemHeight { get; }


Normal item height in Search screen, this value usually depends on the height of thumbnails for the site.
  • int SearchItemSelectedHeight { get; }


Height of search item on selection, which will also Display the Duration of the video, so make sure to leave a space for that below the Thumbnail image.


  • List<VideoInfo> Search(string searchText, int currentPage, int maxResult);


This is the first main function, it's called when a user enters text in the search screen box, and hits Search.
It returns a list of VideoInfo objects, which will be passed later to other functions.
VideoInfo class can be found in the WassimK.Utils assembly, found in the sample project along with the Interface to implement.


For this function, you need to provide values for:
VideoInfo.Title // Title to be displayed in Search results
VideoInfo.Duration // Video Duration
videoInfo.ImageUrls // Urls for Thumbnails


And you can also save some values using:
VideoInfo["Key"] = "Value";
Usually you need to store video ID in this stage.


Parameters:
  1. currentPage: This value starts with 1 and is incremented every time the user hits, "Show More..." in search results, so the Search function should return the next set of Search Results depending on this value.


  2. maxResult: Maximum number of search results per search page.






  • List<VideoFormat> GetAvailableFormats(VideoInfo videoInfo);


This function is called when a user selects an item from Search Results.


videoInfo is the same object returned previously from the Search function above.


Depending on information stored in videoInfo object, you should be able to return a list of formats/qualities supported by selected video.


VideoFormat class has 3 properties that need to be set:
  1. ItemText: Text to Display in the list of Formats screen


  2. Value: Any hidden value developer decides to save and use later to help get the video URL.


  3. Url: This URL is only used to support "Copy Url" functionality, if left empty, the user will see a messagebox saying, "this video doesn't support copy url"


Bear in mind that this videoFormat object will be passed later to the OnFormatSelected function, to help get the correct video Url.




  • void OnFormatSelected(VideoInfo videoInfo, VideoFormat selectedFormat);

This function is called when the user select a format from the Formats Selection Screen.
selectedFormat object contains information saved previously in the GetAvailableFormats function.
Usually in this function, you need to store information in the videoInfo object, which will be passed later to GetVideoUrl function.
The information you need to save is the what will help you get the video url for the selected format.
  • string GetVideoUrl(VideoInfo videoInfo);

This function is called in two situations, when a user selects a format for the list of formats, or the application needs to continue a previously paused Download.
To resume downloads, VideoInfo object is serialized on application exit, and deserialized when the application is launched again, the object is then passed to this function to get the video url and continue downloading.
Important Note: Never store the URL in the videoInfo object, because most of sites copy the video to a cache server and sometimes this cache is cleaned up and the URL is not available anymore, always use the video ID along with other information, like Video format saved in the videoInfo object to get the video Url


  • string GetUniqueName(VideoInfo videoInfo);


This function is called whenever a user select a format from the format screen, it checks if a download of this particular video and format is in progress already.





Usually, (videoInfo["ID"] + videoInfo["Format"]) is unique enough for each video.


XML file:
To be able to add your extension to the "Download Services" page you must include both the assembly and an XML file that defines the Download Service to the Root of Extensions folder

The format if the XML file is as follows:
<Service>

<Assembly FileName="WassimK.DailyMotionService.dll" />

<Class FullName="WassimK.SmoothYouTubeDownloader.Services.DailyMotionService" />

</Service>
It's straight forward, just one note Class FullName is the "NameSpace.ClassName"
Finally:
This was a very fast explanation and it's a bit ugly to be honest, but I hope it helps some of you, I believe the sample project code should cover most things in detail, if you have any questions or suggestions to improve the API, don't hesitate to write a comment here.

If you'd like your extension to be tested and included in next release, please email it to me, wassim.khalil9@gmail.com
Read More
Posted in | No comments

TinyUrl for Windows Mobile

Posted on 04:04 by Unknown
Overview:
This is a very simple application that uses TinyUrl services to shorten URLs on windows mobile.
Just unzip the file attached and copy it's contents to your device and run the application from there.



Download:
TinyUrl for Windows Mobile
Read More
Posted in | No comments

Saturday, 27 August 2011

[NEW VERSION 3.0] Smooth YouTube Downloader for Windows Mobile

Posted on 17:36 by Unknown
Overview:
Smooth YouTube Downloader started as a personal project just for my personal use, then after a while I thought it might be useful to some people out there...
Basically, it allows you to download videos from YouTube (and potentially any other site) in different formats and qualities including MP3

The App was tested on Topaz (Touch Diamond 2) WVGA Windows Mobile 6.5



New V3.0 Features:

  • YouTube Feeds, for example (Most Popular, Music, This Week) etc...
  • History list of search.
  • Ability to set maximum number of simultaneous downloads, and queue the rest.
  • Ability to set the Application you want to open URLs with using an easy file dialog from the UI (Settings Page)
  • You can also set the "Default Format to download" from the UI (Settings Page)
  • Enhanced Performance

Requirements:
  • A working windows mobile 5, 6, 6.5
  • .NET Compact Framework 3.5


Features:
  • Shows thumbnails in the search results.
  • Ability to download multiple videos at the same time.
  • Ability to pause/resume downloads after you exit and run the application again.
  • A very nice UI and cool transitions between different screens of the app.
  • Ability to expand search results.
  • Ability to choose video format/quality including mp3.
  • Improved QVGA screens support.
  • Ability to switch between full screen and normal mode.
  • Ability to copy download URL.
  • Supports keeping the device awake while downloads are running, so the WiFi connection is not lost.
  • Supports installing extensions to support any other video site.
  • Supports Themes.
  • Supports Searching/Downloading from DailyMotion.com
  • Supports Searching/Downloading from Current.com
  • Open YouTube videos with CorePlayer, TCPMP or any other application you specify.
  • Ability to Shorten URLs on Copy/Open (for using with CorePlayer which doesn't support long URLs)
Screenshots:






























Advanced Hidden Settings:
Some settings cannot be set in the UI, so you can get to those settings by editing the XML file created in the Application directory, after saving settings of the application for the first time.
To understand the options available, read the file SYTDSettings_SAMPLE.xml which you can find in the application installation directory.


ONLY for CorePlayer Users: It doesn't support long youtube URLs so to Shorten URLs on Copy/Open use the settings below:


<ShortenAssemblyFileName>\Program Files\SmoothYTDownloader\WassimK.TinyUrl.dll</ShortenAssemblyFileName>
<ShortenClassFullName>WassimK.TinyUrlApi</ShortenClassFullName>
<ShortenMethodName>Shorten</ShortenMethodName>
<ShortenServices>YouTube</ShortenServices>

How can you contribute:
If you're a Developer and would like to learn how to create Extensions to support sites other than YouTube, Click Here
If you'd like to learn how to create new Themes, Click Here


Download:
SmoothYouTubeDownloader.V3.0.cab
Read More
Posted in | No comments

Monday, 8 August 2011

Ioc - Autofac

Posted on 06:42 by Unknown
Related posts:

  • IoC Definitie

  • Ninject
  • Unity
  • Windsor
  • Autofac
  • Structure Map
  • MEF

  • Concluzie


Astăzi a venit rîndul la Autofac (http://code.google.com/p/autofac/) sa fie prezentat.

Clasa care se ocupa de container se numește ContainerBuilder. Folosind aceasta clasa putem sa înregistram sau sa rezolvam orice componenta. La fel ca si Ninject, paternul folosit pentru setup-ul containerului este fluent. Mai jos puteți sa găsiți un exemplu care arata cum se poate înregistra un element în container.

ContainerBuilder containerBuilder = new ContainerBuilder();

containerBuilder

.RegisterType<OderService>()

.As<IOrderService>();

Trebuie sa aveti grija ca intai se specifica clasa care implementează tipul pe care dorim sa îl mapam și doar apoi interfata (sau clasa care vrem sa o mapam). Autofac este destul de deștept ca sa poată detecta cu ce obiect vrem sa mapam un anumit tip. Este de ajuns sa specificam doar OrderService:

containerBuilder

.RegisterType<OderService>();

Constructorul care se va folosii este cel care are cei mai multi parametrii care pot sa fie rezolvati din container. In cazul in care dorim sa specificam parametrii la constructori, atunci trebuie sa scriem urmatorul cod:

containerBuilder

.RegisterType<ComputeService>()

.WithParameters(

new NamedParameter(state, 1));

Pentru a putea obține un element din container este nevoie sa folosim metoda Resolve. Aceasta metoda acepta si lista de parametri cu care dorim sa initializam obiectul.

IOrderService orderService = containerBuilder.Resolve<IOrderService>();

Problema propietatiilor si a constructoriilor complexi a fost destul de simplu rezolvata prin metoda Regiser, care accepta o expresie lambda. Prin intermediul acestei expresii putem as configuram obiectul nostru în orice fel.

containerBuilder

.Register(cs => new ComputeService(1){ MaximProcessor = 10; });

Folosind o expresie lambda putem sa injectam orice valoare, atata timp cat propietatiile sunt publice. Cand lucram cu tipuri generice pe care dorim sa le mapam putem sa folosim metoda RegisterGeneric, dar nu este obligatoriu. Daca dorim sa mapam mai multe obiecte pentru aceiasi interfate, este bine de stiut ca ultimul obiect inregistrat o sa fie considerat cel default. Pentru a pastra ca obiect default, obiectul deja mapat, este nevoie sa folosim metoda PreserverExistingDefaults().

containerBuilder

.RegisterType<ComputeService>()

.As<IComputerService>()

.PreserveExistingDefaults();

Pentru fiecare obiect inregistrat putem sa alocam nu doar un nume ci si o cheie. De exemplu putem sa folosim un enum, a.i. nu o sa fim obligati sa folosim string-uri pentru a rezolva un anumit obiect.

// pe baza de nume

containerBuilder

.Register<ComputeService>()

.Named<IComputerService>("computeServiceOne");

containerBuilder.ResolveNamed<IComputeService>("computeServiceOne");

// pe baza de cheie. Presupunem ca avem urmatorul enum: enum ComputerServiceTypes { Manual, Auto }

containerBuilder

.RegisterType<ComputeService>()

.Keyed<IComputeService>(ComputerServiceTypes.Auto);

containerBuilder.ResolveKeyed(ComputerServiceTypes.Auto);



Un lucru în plus care il aduce Autofac și se poate folosii cu succes în aplicațiile care inițial nu au avut un container IoC, este ExternallyOwned. In cazul în care folosim paternul Singleton, putem sa mapam o proprietate statica pentru a fi procesata de către container.

containerBuilder

.RegisterInstance(ComputeService.Instance)

.ExternallOwned();

La Resolver putem sa specificam valori la parametrii (pe baza de nume, tip). Mai jos puteti sa gasiti un exemplu.

containerBuilder.Resolve<IComputeService>(new NamedParameter("MaximProcessor",10));

In momentul în care setam valori la proprietate putem sa avem cazuri cînd apar dependinte circulare. Autofac știe sa lucreze cu ele, doar ca este nevoie sa ne folosim de metoda OnActivated pentru a specifica propietare care provoaca o dependinta circulara (mare parte din framework-uri nu suporta dependintele circulare).

containerBuilder

.Register(c => new ComputeService())

.OnActivated(c => c.PropDeTipComputeService = c.Context.Resolve<IComputeService);

Exista 3 evenimente la care ne putem atasa pentru a executa cod custom:

  • OnActivating
  • OnActivated
  • OnRelease
Acestea pot sa fie folosite de exemplu cînd vrem sa injectam o metoda într-un anumit moment.

containerBuilder

.Register(c => new ComputeService())

.OnActivating( e => some code);

In cazul in care dorim sa mapam toate interfețele dintr-un assembly avem la dispozitie RegisterAssemblyTypes. Prin intermediul acestei metode putem sa mapam automat orice clase dintr-un anumit assembly.

containerBuilder

.RegisterAssemblyTypes(Assembly.GetExecuteAssembly())

.Where(type => type.Name.EndWith("Service")) // conditie

Autofac ne permite sa controlam durata de viata a unui obiect asemanator cu Ninject, doar cu mici diferente.

  • Transient (o instanta noua de obiect la feicare call) este denumita PerDependency - InstancePerDependency();
  • Singleton (o instanta unica per aplicatie) - SingleInstance();
  • LifetimeScope (o instanta unica per request) - InstancePerLifetimeScope();
  • Contextual (asemanatoare cu LifetimeScope) doar ca controlul duratei de viata a obiectului se poate controla din cod - InstancePerMatchingLifetimeScope;

Avem la dispoziție interfața IStartable, care ne permite sa rulam un cod custom în momentul în care containerul este creat. Pentru a face acest lucru trebuie sa implementam interfața data și sa o înregistram in container.

class StartupCode : IStartable

{

public void Start()

{

// Cod custom care o sa fie rulat in momentul i ncare containerul este initializat.;

}

}

containerBuilder

.RegisterType<StarupCode>()

.As<IStartable>()

.SingleInstance(); // O singura instanta per container.

In cazul în care vrem sa înregistram mai multe obiecte, le putem grupa pe module. Fiecare modul trebuie sa implementeze clasa Module și sa face ovveride la metoda Load. In aceasta metoda trebuie sa inregistram obiectele dorite.

public class ComputeModule : Module

{

protected override void Load(ContainerBuilder containerBuilder)

{

containerBuilder

.RegisterType<OderService>()

.As<IOrderService>();

containerBuilder

.Register(c => new ComputeService());

}

}



Toate aceste configurări pot sa fie făcute și printr-un fișier de configurare. Fiecare componenta pe care dorim sa o înregistram este nevoie sa o mapam într-un nod de tip component. Nu vreau sa intru in detaliu, deoarece sunt exact aceleași configurări care se pot face si din cod. Ce merita menționat aici este faptul ca dacă ne definim module, le putem configura (seta proprietatiile) din fișierul de configurare.

Autofac se poate integra foarte ușor cu ASP.NET, ASP.NET MVC, MEF (Managed Extensibility Framework), WCF, NServiceBus, Moq, NMock si NHibernate.
Read More
Posted in Autofac, dependency injection, Ioc | No comments

Saturday, 6 August 2011

Silverlight - Diferente intre MAC OS si Windows OS.

Posted on 03:33 by Unknown
Am fost întrebat zilele astea de doua persoane de limitările pe care le are Silverlight pe MAC OS. O sa încerc sa enumăr cîteva din aceste limitări mai jos.
1. Din cauza ca pe MAC unele tipuri de data nu exista sau sunt reprezentate diferit, este posibil ca metoda ToString() sa returneze valori diferite pe cele doua sisteme. Mai interesant este cand apelam ToString() pentru
Single.PositiveInfinity.ToString()
In cazul MAC-ului o sa obtinem "+oo", iar pe Windows o sa avem "Infinity".
2. Cand lucram cu informatii despre cultura (CultureInfo) rezultatele o sa difere intre cele doua sisteme chiar daca avem aceiasi cultura setata. Totodata TextInfo.ListSeparator pe MAC OS va returna mereu caracterul ',' indiferent de cultura pe care o avem setata.
3. Daca folosim metoda SaveFileDialog, aceasta nu o sa afiseze la user nici o eroare cand userul foloseste caractere invalide, dar in schimb se va arunca exceptia System.ArgumentException pe care noi trebuie sa facem cache.
4. Parsarea de URL-uri difera pe MAC, din aceasta cauza putem sa ne trezim cu '\' in loc de '/'.
5. Evenimentele de click pe butonul stang sau drept al mouse-ului (MouseRightButtonDown, MouseLeftButtonDown, ...) nu sunt suportate in totalitate pe MAC OS, deoarece nu avem 2 butoane pe mouse la toate device-urile. Din aceasta cauza aceste evenimente pot sa fie aruncate fara sa le putem controla de diferite device-uri pe care userul le are instalate.
6. Evenimentele de MouseWheel nu sunt suportate deloc pe MAC OS daca aplicatia nu ruleaza out of the brower. Daca ruleaza in brower e nevoie sa facem handle la ele prin intermediul DOM-ului HTML.
7. In cazul in care folositi evenimente de KeyPress, este bine de stiut ca exista PlatformKeyCode, care difera in functie de platforma.
8. Evenimentele de Drop nu sunt suportate pe MAC OS cand ruleaza in brower-ul Safari (dar exista un workaround pentru aceasta limitare.
9. Daca lucram cu socke-uri, modul in care sunt implementate difera usor, din aceasta cauza este bine sa verificam pe clasele pe care le folosim pentru socket-uri daca exista diferente pe cele doua platforme.
10. Resursele care sunt accesibile prin interop difera, din aceasta cauza trebuie sa verificam ce sistem de operare foloseste utilizatorul si sa apelam resursele corespunzatoare.
11. Implementarea la controler-ului WebBrower difera pentru cele doua sisteme, deoarece modul de randare este diferit.
12. Daca vrem sa facem debug, acesta poate sa fie facut doar prin Remote Debugging.
13. Pe MAC putem sa afisam o aplicatie Silverlight doar ca "windowed", pe cand pe Windows avem atat "windowed" cat si "windowless". Chiar daca avem o alta setare setata, pe MAC o sa fie folosita doar "windowed".
14. Exceptiile contine informatii diferite, iar unele pot sa fie eronate (linia si coloana unde a aparut exceptia).
15. Cand aplicatia ruleaza pe MAC OS in Safari, doua instante de HtmlPage.Window nu sunt egale.
16. MessageBox pe MAC OS o sa aibe mereu o icoana afisata, orice am face.
17. Zonele de access (cross-zone) difera pe MAC OS.

Daca ati mai gasit si alte diferente, va rog sa postati un comentariu.
Read More
Posted in cross platform, diferente, MAC, Silverlight, Windows | No comments

Friday, 5 August 2011

Ioc -Ninject

Posted on 00:46 by Unknown
Related posts:

  • IoC Definitie

  • Ninject
  • Unity
  • Windsor
  • Autofac
  • Structure Map
  • MEF

  • Concluzie
Cu toți am auzit de IoC, dependency injection și toate nebuniile legate de ele.

Într-un post anterior am definit Ioc (http://vunvulearadu.blogspot.com/2010/11/ioc-dependency-injection-teorie.html) și am prezentat în cîteva cuvinte Ioc. In funcție de cum o sa îmi permită timpul vreau sa trec peste mai multe framework-uri de acest gen.

Iar apoi vreau sa compar aceste framework-uri și sa vedem plusurile și minusurile la fiecare.

In toate exemplele pe care urmează sa le dau o sa folosim următorul model de date:

interface IComputeService

{

public int Calculate(int value);

}

class ComputeService : IComputerService

{

public ComputerService(int state) { }

public int Calculate(int value) { }

}

interface IOrderService

{

public int GetTotal();

}

class OrderService

{

public OrderService(IComputerService computerService) { }

public int GetTotal() { }

}

Astăzi vreau sa incep sa vorbesc despre Ninject (http://ninject.org/).

Partea de instalare se face destul de ușor, trebuie copiate assembly-urile local și adăugate la proiect (acest lucru este comun cam la toate framework-urile).

Pentru a înregistra un obiect în container Ninject ne pune la dispoziție clasa StandardKernel prin intermediul căruia o sa avem acces la container. Configurarea se va face folosind paternul fluent (http://vunvulearadu.blogspot.com/search/label/Fluent%20interface%20pattern).

var standardKernel = new StandardKernel()

standardKernel

.Bind<IComputeService>()

.To<ComputeService>()

.WithConstructorArgument("state",0);

Mai sus am inregistrat servicul ComputeService. Dupa cum se poate observa este destul de usor sa specificam parametri la constructor. Pentru a obtine o valoare din container ajunge sa apelam metoda Get.

var computeService = standardKernel.Get<IComputeService>();

Partea interesanta apare in momentul in care vrem sa obtinem o instanta a obiectului IOrderService. Chiar daca acest serviciu nu este înregistrat, Ninject poate sa detecteze cine implementeaza aceast serviciu si sa il rezolve.

var orderService = standardKernel.Get<IOrderService>();

Pe langa acest lucru Ninject este destul de destept sa rezolve si constructorul care accepta ca si parametru o instanta la obiectul IComputeService. In cazul in care avem mai multe implementari pentru acelasi serviciu Ninject nu sa poata rezolva singur IOrderService si trebuie configurat manual.

Dar ce se întîmpla dacă avem mai multi constructori? In acest caz este nevoie as ii specificam constructorul pe care as îl folosească. Acest lucru se poate face prin intermediul atributului Inject.

class OrderService

{

public OrderService() { }

[Inject]

public OrderService(IComputerService computerService) { }

public OrderService(IComputerService computerService, IDbContext dbContext) { }

public int GetTotal() { }

}

In acest caz, constructorul care primeste in singur parametru va fi folosit de catre Ninject pentru a crea o noua instana pentru OrderService. Pentru propietatiile la care vrem sa injectam valoarea, trebuie sa folosim acelasi atribut (Inject). In cazul in care tipul obiectului este deja mapat in container nu mai este nevoie sa specificam ce valoare vrem sa injectam. Ce trebuie insa retinut este ca ordinea in care se seteaza propietatiile nu se poate seta, o sa fie stabilita la runtime. Acelasi lucru se poate face și pe field-uri si/sau propietati, chiar daca sunt publice sau private (nu are importanta).

class OrderService

{

[Inject]

public IComputeService ComputeService {get;set;}

[Inject]

public IDbContext DbContext {get;set;}

}

...

standardKernel

.Bind<IComputeService>()

.To<ComputerService>()

.WithPropertyValue("DbContext", new DbContext());

Proprietatea ComputerService o sa fie automat rezolvata din cauza ca este deja mapata în container, nu este nevoie sa specificam maparea. Metodele decorate cu Inject o sa fie apelate in momentul cand se containerul creaza o noua instanta a obiectului mapat. Este foarte utiliza aceasta functionalitate

Ca orice framework de acest tip putem sa controlam durata de viata a unui obiect din container. Valorile disponibile sunt:

  • Singleton - o singura instanta a obiectului per "process";
  • Transient - la fiecare apel se va genera o instanta noua (setare implicita);
  • Thread - instanta unica pe thread;
  • Request - instanta unica pe web request;
Pentru fiecare opțiuni avem cate o metoda:

standardKernel

.Bind<IComputeService>()

.To<ComputeService>()

.WithConstructorArgument("state",0)

.InSingletonScope();

Acuma vine o întrebare destul de naturala, cum configuram Ninject prin intermediul unui fișier de configurare. Vestea proasta este ca în acest moment acest lucru nu se poate face. Ninject poate sa fie configurat doar din cod.
Read More
Posted in dependency injection, Ioc, Ninject | No comments

Monday, 1 August 2011

(3) How to use Office in Silverlight applications

Posted on 05:54 by Unknown
Lista postări despre Office interop pe Silverlight:
  • Part 1
  • Part 2
  • Part 3
Si iată ca am ajuns la ultimul post din seria de 3 posturi despre Office Interop pe Silverlight.
Am rămas dator cu doua topice:
  • cum sa închidem un proces office;
  • cum sa scriem unit teste;
Pentru a putea închide procesul pe care îl avem pornit ajunge sa apelam direct metoda Quit(). Atenție, când se apelează aceasta metoda orice modificare deja făcuta nu o sa fie salvata. Pentru a putea face și save trebuie sa apelam și metoda metoda de salvare:
excelApp.Save();
excelApp.Quit();
In cazul în care dorim sa închidem doar un document separat putem sa apelam la metoda Close, care poate sa fie accesibila pentru fiecare document separat.

Testarea automata a unei aplicații care lucrează direct cu interop-ul de Office este destul de dificila. De exemplu cum putem sa testam dacă un document a fost deschis și este vizibil user-ului? Trebuie sa verificam ca avem în Windows o fereastra deschisa (lista de procese pornite în Windows nu este relevanta în acest caz).
Cu cat flow-ul dintre user și interop-ul de Office se bazează direct pe editarea documentelor direct dintr-o fereastra de Office, cu atât testarea este mai dificila. In cazul în care deschidem documentele Office pentru a editate sau vizualiza documente direct din aplicația noastră, atunci testarea este mult mai sigura, și mai ușor de făcut. Iar partea de mock pentru interop o sa fie mult mai ușor de scris.
Cea mai mare problema care poate sa apară este în momentul în care deschidem un document de doua ori, din doua procese separate, iar al doilea proces nu o sa poată sa facă save. In cazul în care pățim acest lucru și nu avem o referința la primul proces nu recomand sa închidem forțat primul proces care face lock pe document, deoarece s-ar putea ca userul sa îl fi deschis manual.
Read More
Posted in excel, interop, office, Silverlight, word | No comments
Newer Posts Older Posts Home
Subscribe to: Comments (Atom)

Popular Posts

  • Service Bus Topic - Automatic forward messages from a subscription to a topic
    Windows Azure Service Bus Topic is a service that enables us to distribute the same messages to different consumers without having to know e...
  • CDN is not the only solution to improve the page speed - Reverse Caching Proxy
    I heard more and more often think like this: “If your website is to slow, you should use a CDN.” Great, CDN is THE solution for any kind of ...
  • Patterns in Windows Azure Service Bus - Message Splitter Pattern
    In one of my post about Service Bus Topics from Windows Azure I told you that I will write about a post that describe how we can design an a...
  • E-Learning Vendors Attempt to Morph Mobile
    The sign should read: " Don't touch! Wet Paint !" I had a good chuckle today after receiving my latest emailed copy of the eLe...
  • Content Types - Level 6: Rich Media
    Level 6: Rich Media NOTE: This is part 7 of 7 and the conclusion of this continuing series; please see earlier posts for more background inf...
  • Publishing our CellCast Widget for iPad
    The rush has been on this week as our development team worked to design a new version of our CellCast Widget specifically for Apple's up...
  • Content Types - Level 5: Courseware
    Level 5: Content and Courseware NOTE: This is part 6 of 7 in a continuing series; please see earlier posts for more background information. ...
  • SQL - UNION and UNION ALL
    I think that all of us used until now UNION in a SQLstatement. Using this operator we can combine the result of 2 queries. For example we wa...
  • Cum sa salvezi un stream direct intr-un fisier
    Cred ca este a 2-a oara când întâlnesc aceasta cerința in decurs de câteva săptămâni. Se da un stream și o locație unde trebuie salvat, se c...
  • Task.Yield(...), Task.Delay(...)
    I think that a lot of person already heard about these new methods. In this post I want to clarify some things about these new methods that ...

Categories

  • .NET
  • .NET nice to have
  • #if DEBUG
  • 15 iunie 2011
  • 15 octombrie 2011
  • 2011
  • abstracta
  • action
  • adaugare
  • ajax
  • Amsterdam
  • Android
  • aplicatii
  • App Fabric
  • Apple iSlate
  • array
  • as
  • ASP.NET
  • AsReadOnly
  • Assembly comun
  • async
  • Asynchronous programming
  • asyncron
  • Autofac
  • AutoMapper
  • az
  • Azure
  • Azure AppFabric Cache
  • Azure backup solution
  • Azure Storage Explorer
  • azure. cloud
  • backup
  • BCP utility
  • bing maps v7
  • BitArray
  • BlackBerry
  • blob
  • BlobContainerPublicAccessType
  • breakpoint
  • bucuresti
  • C#
  • cache
  • CallerMemberName
  • CellCast
  • Certificate
  • CES
  • change
  • ChannelFactory
  • clasa
  • classinitialize
  • clean code
  • click event
  • close
  • Cloud
  • Cluj
  • cluj-napoca
  • Code contracts
  • code retrat
  • codecamp
  • CollectionAssert
  • Compact Edition
  • compara
  • Comparer T .Default
  • CompareTo
  • comparison
  • comunitate
  • concurs
  • Conditional attribute
  • configurare
  • connection string
  • container
  • content type
  • control
  • Convert
  • convertAll
  • convertor
  • cross platform
  • CRUD
  • css
  • custom properties
  • custom request
  • DACPAC
  • Daniel Andres
  • data sync service
  • database
  • date time
  • datetime
  • debug
  • default
  • delegate
  • dependency injection
  • deploy
  • DeploymentItem
  • design patterns
  • Dev de Amsterdam
  • development stoage
  • dictionary
  • diferente
  • digging
  • director
  • Directory.Exist
  • disable
  • dispatcher
  • dispose
  • dropdown
  • dynamic
  • EF
  • email
  • encoding
  • entity framework
  • enum
  • enumerable
  • Environment.NewLine
  • error
  • error 404
  • error handling
  • eveniment
  • event
  • ews
  • excel
  • exception
  • exchange
  • exita
  • explicit
  • export
  • extension
  • field
  • File.Exist
  • finalize
  • fire and forget
  • Fluent interface pattern
  • format
  • func
  • GC.SuppressFinalize
  • generic
  • getdirectoryname
  • globalization
  • gmail
  • hackathon
  • Hadoop
  • handle
  • HTML
  • html 5
  • Html.ActionLink
  • http://www.blogger.com/img/blank.gif
  • HttpModule
  • IComparable
  • IE
  • ienumerable
  • IIS
  • image
  • implicit
  • import
  • int
  • internationalization
  • Internet Explorer
  • interop
  • Ioc
  • IP Filter
  • iPhone
  • iQuest
  • IStructuralEquatable
  • ITCamp
  • itspark
  • java script
  • javascript
  • July 2012
  • KeyedByTypeCollection
  • KeyNotFoundException
  • Kinect SDK
  • lambda expression
  • LightSwitch Microsoft Silverlight
  • linq
  • list
  • lista
  • lista servicii
  • liste
  • Live Connect
  • Live ID
  • load
  • localization
  • lock
  • m-learning
  • MAC
  • Mango
  • map
  • mapare
  • mapare propietati
  • messagequeue
  • meta properties
  • method
  • MethodImpl
  • Metro App
  • Microsoft
  • Microsoft Sync Framework
  • mlearning
  • mlearning devices
  • Mobile Apps
  • mobile in the cloud
  • mobile learning
  • mobile services
  • Mobile Web
  • mongoDb
  • monitorizare
  • msmq
  • multitasking
  • MVC
  • MVC 3
  • MVVM
  • namespace
  • nextpartitionkey
  • nextrowkey
  • Ninject
  • nivel acces
  • no result
  • normalize
  • nosql
  • null expcetion
  • null object pattern
  • NullReferenceException
  • OAuth API
  • office
  • offline
  • Open ID
  • openhackeu2011
  • operations
  • operator
  • optimization
  • option
  • outputcache
  • OutputCacheProvider
  • override
  • paginare
  • pagination
  • path
  • persistare
  • Portable Library tool
  • Post event – CodeCamp Cluj-Napoca
  • predicate
  • predictions
  • prezentare
  • process
  • proiect
  • property
  • propietati
  • query
  • ReadOnlyCollection
  • ReadOnlyDictionary
  • referinta
  • reflection
  • remote
  • reply command
  • request
  • request response
  • resouce
  • REST
  • REST Client
  • RESTSharp
  • ronua
  • rss
  • rulare
  • salvare in fisier
  • sc
  • schimbare timp
  • select
  • select nodes
  • send
  • serializare
  • serialization
  • Server.Transfer. Resposen.Redirect
  • service bus
  • ServiceBase
  • servicecontroller
  • sesiune
  • session
  • Session_End
  • Session_Start
  • setup
  • Sibiu
  • signalR
  • Silverlight
  • sincronizare
  • Single Responsibility Principle
  • SkyDrive
  • skype
  • smartphones
  • smtp
  • Snapguide
  • sniffer
  • socket
  • solid
  • spec#
  • sql
  • Sql Azure
  • SQL CE
  • sql server 2008 RC
  • SRP
  • startuptype
  • stateful
  • stateless
  • static
  • stergere
  • store
  • store procedure
  • stream
  • string
  • string.join
  • struct
  • StructuralEqualityComparer
  • submit
  • switch
  • Symbian
  • Synchronized
  • system
  • tabele
  • table
  • techEd 2012
  • tempdata
  • test
  • testcleanup
  • testinitialize
  • testmethod
  • thread
  • timer
  • ToLower
  • tool
  • tostring
  • Total Cost Calculator
  • trace ASP.NET
  • transcoding
  • tuplu
  • tutorial
  • TWmLearning
  • type
  • unit test
  • unittest
  • UrlParameter.Optional
  • Validate
  • validation
  • verificare
  • video
  • view
  • ViewBag
  • virtual
  • visual studio
  • VM role
  • Vunvulea Radu
  • wallpaper
  • WCF
  • WebBrower
  • WebRequest
  • where clause
  • Windows
  • windows 8
  • Windows Azure
  • Windows Azure Service Management CmdLets
  • windows live messenger
  • Windows Mobile
  • Windows Phone
  • windows service
  • windows store application
  • Windows Task
  • WinRT
  • word
  • workaround
  • XBox
  • xml
  • xmlns
  • XNA
  • xpath
  • YMesseger
  • Yonder
  • Zip

Blog Archive

  • ►  2013 (139)
    • ►  November (17)
    • ►  October (12)
    • ►  September (10)
    • ►  August (7)
    • ►  July (8)
    • ►  June (15)
    • ►  May (12)
    • ►  April (17)
    • ►  March (16)
    • ►  February (9)
    • ►  January (16)
  • ►  2012 (251)
    • ►  December (9)
    • ►  November (19)
    • ►  October (26)
    • ►  September (13)
    • ►  August (35)
    • ►  July (28)
    • ►  June (27)
    • ►  May (24)
    • ►  April (18)
    • ►  March (17)
    • ►  February (20)
    • ►  January (15)
  • ▼  2011 (127)
    • ►  December (11)
    • ►  November (20)
    • ►  October (8)
    • ►  September (8)
    • ▼  August (8)
      • How To: Create Themes for Smooth YouTube Downloader
      • How To: Create Extensions for Smooth YouTube Downl...
      • TinyUrl for Windows Mobile
      • [NEW VERSION 3.0] Smooth YouTube Downloader for Wi...
      • Ioc - Autofac
      • Silverlight - Diferente intre MAC OS si Windows OS.
      • Ioc -Ninject
      • (3) How to use Office in Silverlight applications
    • ►  July (10)
    • ►  June (5)
    • ►  May (8)
    • ►  April (9)
    • ►  March (14)
    • ►  February (20)
    • ►  January (6)
  • ►  2010 (26)
    • ►  December (1)
    • ►  November (1)
    • ►  October (1)
    • ►  June (2)
    • ►  May (1)
    • ►  April (4)
    • ►  March (1)
    • ►  February (1)
    • ►  January (14)
Powered by Blogger.

About Me

Unknown
View my complete profile