public DocumentViewerWindow(VKontakteApiWrapper wrapper)
 {
     InitializeComponent();
     if (wrapper == null)
         throw new ArgumentNullException("wrapper");
     _vkWrapper = new GenericWeakReference<VKontakteApiWrapper>(wrapper);
 }
 public DocumentViewerWindow(VKontakteApiWrapper wrapper, List<Friend> friends)
     : this(wrapper)
 {
     if (friends == null)
         throw new ArgumentNullException("friends");
     Friends = friends;
 }
        public PhotoPreviewWindow(Entities.PhotoExteded photo, VKontakteApiWrapper wrapper)
        {
            InitializeComponent();

            if (photo != null) PhotoObj = photo;

            if (wrapper != null)
                this._vkWrapperWeak = new GenericWeakReference<VKontakteApiWrapper>(wrapper);

            CurrentFoto = Path.Combine((Application.Current as App).AppFolder, "Photo", Path.GetFileName(photo.SourceBig));

            if (App.Current.ImageCacheInstance.IsCached(photo.SourceBig))
                imgPreview.Source = PhotoObj.SourceBig.GetImage();
            else
            {
                WebClient web = new WebClient();
                web.DownloadDataAsync(new Uri(PhotoObj.SourceBig, UriKind.RelativeOrAbsolute));
                web.DownloadDataCompleted += web_DownloadDataCompleted;
            }

            if (!System.IO.File.Exists(CurrentFoto))
            {
                using (WebClient client = new WebClient())
                {
                    client.DownloadFileCompleted += client_DownloadFileCompleted;
                    client.DownloadFileAsync(new Uri(PhotoObj.SourceBig, UriKind.RelativeOrAbsolute), CurrentFoto);
                }
            }

            this.Loaded += new RoutedEventHandler(PhotoPreviewWindow_Loaded);
            headerLabel.MouseLeftButtonDown += new MouseButtonEventHandler(headerLabel_MouseLeftButtonDown);
        }
        public SendMessageWindow(VKontakteApiWrapper wrapper, UserInfos info, UserMessage msgToReply)
        {
            InitializeComponent();

            if (!msgToReply.IsNull())
            {
                UsrMsg = msgToReply;
                txtSubect.Text = this.UsrMsg.MessageTitle;
            }

            if (info != null)
                this.userInfos = info;
            if (wrapper != null)
                this.wrapper = wrapper;
        }
        private void CleanUp()
        {
            if (!userInfos.IsNull())
                userInfos = null;

            if (wrapper != null)
                wrapper = null;

            if (UsrMsg != null)
                UsrMsg = null;

            GC.Collect(0);
        }