예제 #1
0
        public ImageCroppingPage()
        {
            InitializeComponent();
#if GBC
            SystemTray.GetProgressIndicator(this).Text = AppResources.ApplicationTitle2;
#endif
        }
예제 #2
0
        public BackupPage()
        {
            InitializeComponent();

#if GBC
            SystemTray.GetProgressIndicator(this).Text = AppResources.ApplicationTitle2;
#endif

            //create ad control
            if (PhoneDirect3DXamlAppComponent.EmulatorSettings.Current.ShouldShowAds)
            {
                AdControl adControl = new AdControl();
                ((Grid)(LayoutRoot.Children[0])).Children.Add(adControl);
                adControl.SetValue(Grid.RowProperty, 2);
            }

            if (backupMedium == "onedrive")
            {
                this.session = PhoneApplicationService.Current.State["parameter"] as LiveConnectSession;
                PhoneApplicationService.Current.State.Remove("parameter");

                if (this.session == null)
                {
                    throw new ArgumentException("Parameter passed to SkyDriveImportPage must be a LiveConnectSession.");
                }
            }
            this.db = ROMDatabase.Current;

            this.romList.ItemsSource = db.GetROMList();
        }
예제 #3
0
        public SettingsPage()
        {
            InitializeComponent();

#if GBC
            SystemTray.GetProgressIndicator(this).Text = AppResources.ApplicationTitle2;
#endif
            //create ad control
            if (App.HasAds)
            {
                AdControl adControl = new AdControl();
                LayoutRoot.Children.Add(adControl);
                adControl.SetValue(Grid.RowProperty, 1);
            }

            //RSACryptoServiceProvider newrsa = new RSACryptoServiceProvider(



            //set frameskip option
            frameSkipPicker.ItemsSource = frameskiplist;
            //powerFrameSkipPicker.ItemsSource = frameskiplist2;
            turboFrameSkipPicker.ItemsSource = frameskiplist2;
            aspectRatioPicker.ItemsSource    = aspectRatioList;
            orientationPicker.ItemsSource    = orientationList;

            ReadSettings();
        }
예제 #4
0
        public MogaMappingPage()
        {
            InitializeComponent();

#if GBC
            SystemTray.GetProgressIndicator(this).Text = AppResources.ApplicationTitle2;
#endif
            ApplicationBar.BackgroundColor = (Color)App.Current.Resources["CustomChromeColor"];
            ApplicationBar.ForegroundColor = (Color)App.Current.Resources["CustomForegroundColor"];

            Abtn.ItemsSource             = appFunctionList;
            Bbtn.ItemsSource             = appFunctionList;
            Xbtn.ItemsSource             = appFunctionList;
            Ybtn.ItemsSource             = appFunctionList;
            L1btn.ItemsSource            = appFunctionList;
            R1btn.ItemsSource            = appFunctionList;
            L2btn.ItemsSource            = appFunctionList;
            R2btn.ItemsSource            = appFunctionList;
            LeftJoystickbtn.ItemsSource  = appFunctionList;
            RightJoystickbtn.ItemsSource = appFunctionList;

            Abtn.SelectedIndex             = (int)Math.Log(EmulatorSettings.Current.MogaA, 2);
            Bbtn.SelectedIndex             = (int)Math.Log(EmulatorSettings.Current.MogaB, 2);
            Xbtn.SelectedIndex             = (int)Math.Log(EmulatorSettings.Current.MogaX, 2);
            Ybtn.SelectedIndex             = (int)Math.Log(EmulatorSettings.Current.MogaY, 2);
            L1btn.SelectedIndex            = (int)Math.Log(EmulatorSettings.Current.MogaL1, 2);
            L2btn.SelectedIndex            = (int)Math.Log(EmulatorSettings.Current.MogaL2, 2);
            R1btn.SelectedIndex            = (int)Math.Log(EmulatorSettings.Current.MogaR1, 2);
            R2btn.SelectedIndex            = (int)Math.Log(EmulatorSettings.Current.MogaR2, 2);
            LeftJoystickbtn.SelectedIndex  = (int)Math.Log(EmulatorSettings.Current.MogaLeftJoystick, 2);
            RightJoystickbtn.SelectedIndex = (int)Math.Log(EmulatorSettings.Current.MogaRightJoystick, 2);
        }
예제 #5
0
        // Constructor
        public SDCardImportPage()
        {
            InitializeComponent();

            //create ad control
            if (App.HasAds)
            {
                AdControl adControl = new AdControl();
                ((Grid)(LayoutRoot.Children[0])).Children.Add(adControl);
                adControl.SetValue(Grid.RowProperty, 2);
            }



#if GBC
            SystemTray.GetProgressIndicator(this).Text = AppResources.ApplicationTitle2;
#endif



            // Initialize the collection for routes.
            Routes = new ObservableCollection <ExternalStorageFile>();

            this.skydriveStack = new List <List <SDCardListItem> >();
            this.skydriveStack.Add(new List <SDCardListItem>());


            // Enable data binding to the page itself.
            this.DataContext = this;
        }
예제 #6
0
        private async void trackSession_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            if (e.PropertyName.Equals("Notes"))
            {
                var progressIndicator = SystemTray.GetProgressIndicator(this);
                progressIndicator.Text      = AppResources.Text_LoadingStatus_SavingSessionToPhone;
                progressIndicator.IsVisible = true;

                StorageFile localSessionFile = null;
                var         session          = DataContext as TrackSessionViewModel;
                if (session != null)
                {
                    localSessionFile = await App.ViewModel.SaveSessionToLocalStore(session, SessionSaveType.Replace);
                }

                if (localSessionFile != null && App.ViewModel.Settings.IsConnectedToSkyDrive && session.IsUploaded)
                {
                    progressIndicator.Text = AppResources.Text_LoadingStatus_SavingSessionToSkyDrive;
                    await App.LiveClient.UploadFileToTrackTimerFolder(localSessionFile, App.ViewModel.Settings.UploadSessionsOverWifi, overwrite : true);
                }

                progressIndicator.IsVisible = false;
                progressIndicator.Text      = string.Empty;
            }
        }
예제 #7
0
        private async Task DownloadFile(SDCardListItem item)
        {
            var indicator = SystemTray.GetProgressIndicator(this);

            indicator.IsIndeterminate = true;
            indicator.Text            = String.Format(AppResources.DownloadingProgressText, item.Name);
            try
            {
                Stream s = await item.ThisFile.OpenForReadAsync();

                if (s != null)
                {
                    item.Stream = s;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(String.Format(AppResources.DownloadErrorText, item.Name, ex.Message), AppResources.ErrorCaption, MessageBoxButton.OK);
            }

#if GBC
            indicator.Text = AppResources.ApplicationTitle2;
#else
            indicator.Text = AppResources.ApplicationTitle;
#endif
            indicator.IsIndeterminate = false;

            item.Downloading = false;
        }
예제 #8
0
        private void DownloadButton_Click(object sender, EventArgs e)
        {
            SystemTray.GetProgressIndicator(this).IsVisible = true;

            var result = MessageBox.Show("Download this book's info again?", "Download", MessageBoxButton.OKCancel);

            if (result == MessageBoxResult.OK)
            {
                /*
                 * var ean = TextBox_EAN.Text;
                 *
                 * string newEAN = "";
                 * foreach (char c in ean)
                 * {
                 *  if (0 <= c.CompareTo('0') && c.CompareTo('9') <= 0)
                 *  {
                 *      newEAN += c;
                 *  }
                 * }
                 *
                 * TextBox_EAN.Text = newEAN;
                 */


                aws = new AmazonWebService(TextBox_EAN.Text);
                aws.GetItemInfoFromAmazonCompleted += new AmazonWebService.GetItemInfoFromAmazonCompletedEventHandler(this.aws_GetItemInfoFromAmazonCompleted);

                aws.GetItemInfo();
            }
        }
예제 #9
0
        private async Task DownloadFile(SkyDriveListItem item, LiveConnectClient client)
        {
            var indicator = SystemTray.GetProgressIndicator(this);

            indicator.IsIndeterminate = true;
            indicator.Text            = String.Format(AppResources.DownloadingProgressText, item.Name);

            item.Downloading = true;
            try
            {
                LiveDownloadOperationResult e = await client.DownloadAsync(item.SkyDriveID + "/content");

                if (e != null)
                {
                    item.Stream = e.Stream;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(String.Format(AppResources.DownloadErrorText, item.Name, ex.Message), AppResources.ErrorCaption, MessageBoxButton.OK);
            }

#if GBC
            indicator.Text = AppResources.ApplicationTitle2;
#else
            indicator.Text = AppResources.ApplicationTitle;
#endif
            indicator.IsIndeterminate = false;

            item.Downloading = false;
        }
예제 #10
0
        private async void codeList_Tap(object sender, System.Windows.Input.GestureEventArgs e)
        {
            if (codeList.SelectedItem == null)
            {
                return;
            }

            CheatText cheatText = (CheatText)codeList.SelectedItem;

            codeList.SelectedItem = null;


            if (cheatText.Url != null && cheatText.Url != "") //need to go to the link to obtain the code
            {
                GZipWebClient webClient = new GZipWebClient();
                string        response  = null;
                SystemTray.GetProgressIndicator(this).IsIndeterminate = true;

                try
                {
                    //USE THIRD-PARTY GZIPWEBCLIENT
                    webClient.Headers[HttpRequestHeader.Accept]         = "text/html, application/xhtml+xml, */*";
                    webClient.Headers[HttpRequestHeader.Referer]        = "http://www.supercheats.com/search.php";
                    webClient.Headers[HttpRequestHeader.AcceptLanguage] = "en-US";
                    webClient.Headers[HttpRequestHeader.UserAgent]      = "Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko";
                    webClient.Headers[HttpRequestHeader.AcceptEncoding] = "gzip, deflate";
                    webClient.Headers[HttpRequestHeader.Connection]     = "Keep-Alive";
                    webClient.Headers[HttpRequestHeader.Host]           = "www.supercheats.com";

                    response = await webClient.DownloadStringTaskAsync(new Uri(cheatText.Url, UriKind.Absolute));


                    if (response == null)
                    {
                        SystemTray.GetProgressIndicator(this).IsIndeterminate = false;
                        return;
                    }

                    Match  contentMatch = Regex.Match(response, "(?<=<div id='sub).*?(?=</div>)", RegexOptions.Singleline);
                    string content      = contentMatch.Value;
                    int    index        = content.IndexOf(">"); //get the position of the closing bracket
                    content = content.Substring(index + 1);     //get rid of the closing bracket

                    cheatText.TextHtml += "<p style=\"font-size:22px\">" + content + "</p></body></html>";
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }

                SystemTray.GetProgressIndicator(this).IsIndeterminate = false;
            }

            cheatTextStackpanel.DataContext = cheatText;
            cheatTextBox.NavigateToString(cheatText.TextHtml);

            gameList.Visibility            = Visibility.Collapsed;
            codeList.Visibility            = Visibility.Collapsed;
            cheatTextStackpanel.Visibility = Visibility.Visible;
        }
예제 #11
0
        public MotionMappingPage()
        {
            InitializeComponent();

#if GBC
            SystemTray.GetProgressIndicator(this).Text = AppResources.ApplicationTitle2;
#endif
            //create ad control
            if (PhoneDirect3DXamlAppComponent.EmulatorSettings.Current.ShouldShowAds)
            {
                AdControl adControl = new AdControl();
                ((Grid)(LayoutRoot.Children[0])).Children.Add(adControl);
                adControl.SetValue(Grid.RowProperty, 2);
            }


            ApplicationBar.BackgroundColor = (Color)App.Current.Resources["CustomChromeColor"];
            ApplicationBar.ForegroundColor = (Color)App.Current.Resources["CustomForegroundColor"];

            Leftbtn.ItemsSource  = appFunctionList;
            Rightbtn.ItemsSource = appFunctionList;
            Upbtn.ItemsSource    = appFunctionList;
            Downbtn.ItemsSource  = appFunctionList;


            Leftbtn.SelectedIndex  = (int)Math.Round(Math.Log(EmulatorSettings.Current.MotionLeft, 2));
            Rightbtn.SelectedIndex = (int)Math.Round(Math.Log(EmulatorSettings.Current.MotionRight, 2));
            Upbtn.SelectedIndex    = (int)Math.Round(Math.Log(EmulatorSettings.Current.MotionUp, 2));
            Downbtn.SelectedIndex  = (int)Math.Round(Math.Log(EmulatorSettings.Current.MotionDown, 2));

            this.horizontalDeadzoneSlider.Value   = EmulatorSettings.Current.MotionDeadzoneH;
            this.verticalDeadzoneSlider.Value     = EmulatorSettings.Current.MotionDeadzoneV;
            this.adaptOrientationSwitch.IsChecked = EmulatorSettings.Current.MotionAdaptOrientation;
        }
예제 #12
0
        public ExportSelectionPage()
        {
            InitializeComponent();

#if GBC
            SystemTray.GetProgressIndicator(this).Text = AppResources.ApplicationTitle2;
#endif

            //create ad control
            if (App.HasAds)
            {
                AdControl adControl = new AdControl();
                ((Grid)(LayoutRoot.Children[0])).Children.Add(adControl);
                adControl.SetValue(Grid.RowProperty, 2);
            }

            if (backupMedium == "onedrive")
            {
                this.session = PhoneApplicationService.Current.State["parameter"] as LiveConnectSession;
                PhoneApplicationService.Current.State.Remove("parameter");

                if (this.session == null)
                {
                    throw new ArgumentException("Parameter passed to SkyDriveImportPage must be a LiveConnectSession.");
                }
            }

            if (App.IsPremium)
            {
                ZipCheckBox.IsChecked = true;
            }

            BuildLocalizedApplicationBar1();
        }
예제 #13
0
        public ManageSavestatePage()
        {
            InitializeComponent();

#if GBC
            SystemTray.GetProgressIndicator(this).Text = AppResources.ApplicationTitle2;
#endif
            //create ad control
            if (App.HasAds)
            {
                AdControl adControl = new AdControl();
                ((Grid)(LayoutRoot.Children[0])).Children.Add(adControl);
                adControl.SetValue(Grid.RowProperty, 2);
            }


            db = ROMDatabase.Current;

            object tmp;
            PhoneApplicationService.Current.State.TryGetValue("parameter", out tmp);
            this.romEntry = tmp as ROMDBEntry;
            PhoneApplicationService.Current.State.Remove("parameter");

            titleLabel.Text = this.romEntry.DisplayName;

            CreateAppBar();

            var savestates = db.GetSavestatesForROM(this.romEntry);

            this.stateList.ItemsSource = savestates;
        }
예제 #14
0
        public SkyDriveImportPage()
        {
            InitializeComponent();
#if GBC
            SystemTray.GetProgressIndicator(this).Text = AppResources.ApplicationTitle2;
#endif
            //create ad control
            if (PhoneDirect3DXamlAppComponent.EmulatorSettings.Current.ShouldShowAds)
            {
                AdControl adControl = new AdControl();
                ((Grid)(LayoutRoot.Children[0])).Children.Add(adControl);
                adControl.SetValue(Grid.RowProperty, 2);
            }


            this.labelHeight = this.statusLabel.Height;
            this.session     = PhoneApplicationService.Current.State["parameter"] as LiveConnectSession;
            PhoneApplicationService.Current.State.Remove("parameter");
            if (this.session == null)
            {
                throw new ArgumentException("Parameter passed to SkyDriveImportPage must be a LiveConnectSession.");
            }

            this.skydriveStack = new List <List <SkyDriveListItem> >();
            this.skydriveStack.Add(new List <SkyDriveListItem>());
            this.skydriveStack[0].Add(new SkyDriveListItem()
            {
                Name       = "Root",
                SkyDriveID = "me/skydrive",
                Type       = SkyDriveItemType.Folder,
                ParentID   = ""
            });
            this.currentFolderBox.Text = this.skydriveStack[0][0].Name;
        }
예제 #15
0
        private async void ApplicationBarIconButton_Delete_Click(object sender, EventArgs e)
        {
            var progressIndicator = SystemTray.GetProgressIndicator(this);

            progressIndicator.Text      = AppResources.Text_LoadingStatus_DeletingSession;
            progressIndicator.IsVisible = true;

            var result = MessageBox.Show(AppResources.Text_Blurb_DeleteSessionPrompt, AppResources.Title_Prompt_DeleteSession, MessageBoxButton.OKCancel);

            if (result == MessageBoxResult.Cancel || result == MessageBoxResult.No || result == MessageBoxResult.None)
            {
                return;
            }

            var session = DataContext as TrackSessionViewModel;

            if (session == null)
            {
                return;
            }

            await App.ViewModel.DeleteSession(session, false);

            progressIndicator.IsVisible = false;
            progressIndicator.Text      = string.Empty;

            NavigationService.GoBack();
        }
예제 #16
0
 protected void HideProgress()
 {
     Deployment.Current.Dispatcher.BeginInvoke(
         () =>
     {
         SystemTray.GetProgressIndicator(this).IsVisible = false;
     });
 }
예제 #17
0
        //Leaving page
        protected override void OnNavigatedFrom(System.Windows.Navigation.NavigationEventArgs e)
        {
            base.OnNavigatedFrom(e);
            //Get the progress indicator from the system tray
            var proggressIndicator = SystemTray.GetProgressIndicator(this);

            proggressIndicator.IsIndeterminate = false;
            proggressIndicator.IsVisible       = false;
        }
예제 #18
0
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            //get the fileID
            try
            {
                String fileID = NavigationContext.QueryString["fileToken"];
                NavigationContext.QueryString.Remove("fileToken");

                //currently only zip file need to use this page, copy the zip file to local storage
                StorageFolder localFolder = ApplicationData.Current.LocalFolder;
                string        fileName    = SharedStorageAccessManager.GetSharedFileName(fileID);
                tempZipFile = await SharedStorageAccessManager.CopySharedFileAsync(localFolder, fileName, NameCollisionOption.ReplaceExisting, fileID);

                //set the title
                CloudSixFileSelected fileinfo = CloudSixPicker.GetAnswer(fileID);
                currentFolderBox.Text = fileinfo.Filename;
                string ext = Path.GetExtension(fileinfo.Filename).ToLower();

                //open zip file or rar file
                try
                {
                    SkyDriveItemType type = SkyDriveItemType.File;
                    if (ext == ".zip" || ext == ".zib")
                    {
                        type = SkyDriveItemType.Zip;
                    }
                    else if (ext == ".rar")
                    {
                        type = SkyDriveItemType.Rar;
                    }
                    else if (ext == ".7z")
                    {
                        type = SkyDriveItemType.SevenZip;
                    }

                    skydriveStack = await GetFilesInArchive(type, tempZipFile);

                    this.skydriveList.ItemsSource = skydriveStack;

                    var indicator = SystemTray.GetProgressIndicator(this);
                    indicator.IsIndeterminate = false;
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, AppResources.ErrorCaption, MessageBoxButton.OK);
                }
            }
            catch (Exception)
            {
                MessageBox.Show(AppResources.FileAssociationError, AppResources.ErrorCaption, MessageBoxButton.OK);
            }



            base.OnNavigatedTo(e);
        }
예제 #19
0
        public PurchasePage()
        {
            InitializeComponent();

#if GBC
            SystemTray.GetProgressIndicator(this).Text = AppResources.ApplicationTitle2;
#endif

            pics.ItemsSource = picItems;
        }
예제 #20
0
        private void updateWeb()
        {
            var filterSettings = (App.Current as App).filterSettings;

            //Get the progress indicator from the system tray
            var proggressIndicator = SystemTray.GetProgressIndicator(this);

            proggressIndicator.IsIndeterminate = true;
            proggressIndicator.IsVisible       = true;
            proggressIndicator.Text            = "Cargando subastas...";

            //Update bids
            client.GetBidsAsync(filterSettings.Agency, filterSettings.Category, filterSettings.Location, null);
        }
예제 #21
0
        const uint ERR_NOT_ADVERTISING = 0x8000000E;    // You are currently not advertising your presence using PeerFinder.Start()


        public FindPeersPage()
        {
            InitializeComponent();

            //create ad control
            if (App.HasAds)
            {
                AdControl adControl = new AdControl();
                ((Grid)(LayoutRoot.Children[0])).Children.Add(adControl);
                adControl.SetValue(Grid.RowProperty, 4);
            }
#if GBC
            SystemTray.GetProgressIndicator(this).Text = AppResources.ApplicationTitle2;
#endif
        }
예제 #22
0
        //自作イベントのイベントハンドラ。
        //getItemInfoFromAmazonToXmlDBが完了したときにイベントが発行される。
        //成功のときも失敗のときも。
        public void aws_GetItemInfoFromAmazonCompleted(object sender, GetItemInfoFromAmazonCompletedEventArgs e)
        {
            //string Namespace = "http://webservices.amazon.com/AWSECommerceService/2011-08-01";
            //XNamespace ns = aws.NameSpace;
            XElement   xmlItemInfo = e.XmlItemInfo;
            XNamespace ns          = xmlItemInfo.Name.Namespace;

            Grid_Notice.Visibility = Visibility.Visible;
            SystemTray.GetProgressIndicator(this).IsVisible = false;
            switch (e.Result)
            {
            case "Completed":
                modifyBookModelByDownloadedData(e.XmlItemInfo);
                System.Diagnostics.Debug.WriteLine("Completed: ");
                TextBlock_Notice.Text = "Download Completed.";
                //textBlock2.Text = e.Item.Title;
                // 分離ストレージから画像ファイルを読み込み。確認用。画面右下に表示するため。
                //image1.Source = e.Item.GetItemImage();
                break;

            case "NoNetwork":
                System.Diagnostics.Debug.WriteLine("No Network: ");
                //image1.Source = e.Item.GetItemImage();
                TextBlock_Notice.Text = "No network.";
                break;

            case "NoItemFound":
                System.Diagnostics.Debug.WriteLine("No Item : ");
                TextBlock_Notice.Text = "Item not found.";
                break;

            case "GotImage":
                System.Diagnostics.Debug.WriteLine("Got Image Successfully: ");
                initImage();
                break;

            case "HTMLLoginPage":
                TextBlock_Notice.Text = "No network.";
                break;

            default:
                TextBlock_Notice.Text = "Failure.";
                break;
            }

            //イベントハンドラの削除
            //aws.GetItemInfoFromAmazonCompleted -= aws_GetItemInfoFromAmazonCompleted;
        }
예제 #23
0
        public void Report(LiveOperationProgress value)
        {
            var tray = SystemTray.GetProgressIndicator(this);

            if (value.ProgressPercentage == 100)
            {
                tray.IsVisible = false;
            }
            else
            {
                tray.IsVisible       = true;
                tray.Value           = value.ProgressPercentage;
                tray.IsIndeterminate = false;
            }

            SystemTray.SetProgressIndicator(this, tray);
        }
예제 #24
0
        public AutoBackupPage()
        {
            InitializeComponent();

            //create ad control
            if (App.HasAds)
            {
                AdControl adControl = new AdControl();
                ((Grid)(LayoutRoot.Children[0])).Children.Add(adControl);
                adControl.SetValue(Grid.RowProperty, 2);
            }


#if GBC
            SystemTray.GetProgressIndicator(this).Text = AppResources.ApplicationTitle2;
#endif

            NBackupsPicker.ItemsSource = NBackupList;


            backupTypePicker.SelectedIndex = App.metroSettings.AutoBackupMode;

            if (App.metroSettings.AutoBackupMode == 0)
            {
                NBackupsPicker.Visibility = System.Windows.Visibility.Collapsed;
            }
            else
            {
                NBackupsPicker.Visibility = System.Windows.Visibility.Visible;
            }

            NBackupsPicker.SelectedIndex = App.metroSettings.NRotatingBackup - 1;


            backupIngameSaveCheck.IsChecked     = App.metroSettings.BackupIngameSave;
            backupLastManualSLotCheck.IsChecked = App.metroSettings.BackupManualSave;
            backupAutoSLotCheck.IsChecked       = App.metroSettings.BackupAutoSave;
            backupOnlyWifiCheck.IsChecked       = App.metroSettings.BackupOnlyWifi;



            this.Loaded += (o, e) =>
            {
                initdone = true;
            };
        }
예제 #25
0
        //public static async Task RenameROMFile(string oldname, string newname)
        //{
        //    ROMDatabase db = ROMDatabase.Current;


        //    StorageFolder localFolder = ApplicationData.Current.LocalFolder;
        //    StorageFolder romFolder = await localFolder.GetFolderAsync(ROM_DIRECTORY);

        //    StorageFile oldfile = await romFolder.GetFileAsync(oldname);
        //    StorageFile newfile = await romFolder.CreateFileAsync(newname, CreationCollisionOption.ReplaceExisting);

        //    using (var outputStream = await newfile.OpenStreamForWriteAsync())
        //    {
        //        using (var inputStream = await oldfile.OpenStreamForReadAsync())
        //        {
        //            await inputStream.CopyToAsync(outputStream);
        //        }
        //    }


        //}



        internal static async Task <ROMDBEntry> ImportRomBySharedID(string fileID, string desiredName, DependencyObject page)
        {
            //note: desiredName can be different from the file name obtained from fileID
            ROMDatabase db = ROMDatabase.Current;


            //set status bar
            var indicator = SystemTray.GetProgressIndicator(page);

            indicator.IsIndeterminate = true;
            indicator.Text            = String.Format(AppResources.ImportingProgressText, desiredName);



            StorageFolder localFolder = ApplicationData.Current.LocalFolder;
            StorageFolder romFolder   = await localFolder.CreateFolderAsync(ROM_DIRECTORY, CreationCollisionOption.OpenIfExists);

            IStorageFile file = await SharedStorageAccessManager.CopySharedFileAsync(romFolder, desiredName, NameCollisionOption.ReplaceExisting, fileID);


            ROMDBEntry entry = db.GetROM(file.Name);

            if (entry == null)
            {
                entry = FileHandler.InsertNewDBEntry(file.Name);
                await FileHandler.FindExistingSavestatesForNewROM(entry);

                db.CommitChanges();
            }

            //update voice command list
            await MainPage.UpdateGameListForVoiceCommand();

#if GBC
            indicator.Text = AppResources.ApplicationTitle2;
#else
            indicator.Text = AppResources.ApplicationTitle;
#endif
            indicator.IsIndeterminate = false;

            MessageBox.Show(String.Format(AppResources.ImportCompleteText, entry.DisplayName));


            return(entry);
        }
예제 #26
0
        public AboutPage()
        {
            InitializeComponent();

            //create ad control
            if (App.HasAds)
            {
                AdControl adControl = new AdControl();
                ((Grid)(LayoutRoot.Children[0])).Children.Add(adControl);
                adControl.SetValue(Grid.RowProperty, 2);
            }
            tblkVersion.Text = AppResources.AboutVersion + ": " + System.Reflection.Assembly.GetExecutingAssembly()
                               .FullName.Split('=')[1].Split(',')[0];

#if GBC
            tblkTitle.Text = AppResources.ApplicationTitle2;
            SystemTray.GetProgressIndicator(this).Text = AppResources.ApplicationTitle2;
#endif
        }
 private async void GetParkingDetails()
 {
     SystemTray.GetProgressIndicator(this).IsVisible = true;
     try
     {
         var floorObj = await(new MLCPClient()).GetAvailableSlots();
         TotalSlots     = (int)floorObj.Values[0]["total"];
         AvailableSlots = (int)floorObj.Values[0]["available"];
     }
     catch (Exception)
     {
         MessageBox.Show("No Parking Information available currently.", "Error", MessageBoxButton.OK);
         NavigationService.GoBack();
     }
     finally
     {
         SystemTray.GetProgressIndicator(this).IsVisible = false;
     }
 }
예제 #28
0
        private async void ApplicationBarIconButton_Upload_Click(object sender, EventArgs e)
        {
            ((ApplicationBarIconButton)ApplicationBar.Buttons[0]).IsEnabled = false;

            if (!App.ViewModel.IsAuthenticated)
            {
                if (MessageBox.Show(AppResources.Text_Blurb_MustAuthenticatePrompt, AppResources.Title_Prompt_MustAuthenticate, MessageBoxButton.OKCancel) == MessageBoxResult.OK)
                {
                    await App.ViewModel.Authenticate(false);
                }

                if (!App.ViewModel.IsAuthenticated)
                {
                    ((ApplicationBarIconButton)ApplicationBar.Buttons[0]).IsEnabled = true;
                    return;
                }
            }

            var progressIndicator = SystemTray.GetProgressIndicator(this);

            progressIndicator.Text      = AppResources.Text_LoadingStatus_SavingSessionToSkyDrive;
            progressIndicator.IsVisible = true;

            var session         = DataContext as TrackSessionViewModel;
            var mainPageSession = App.ViewModel.Track.History.SelectedSession;

            if (session != null && App.ViewModel.Settings.IsConnectedToSkyDrive && !session.IsUploaded)
            {
                var localSessionFile = await App.ViewModel.SaveSessionToLocalStore(session, SessionSaveType.ReadIfExists);

                var fileId = await App.ViewModel.SaveSessionToCloudStore(session, localSessionFile);

                await Dispatcher.InvokeAsync(() =>
                {
                    session.IsUploaded     = mainPageSession.IsUploaded = true;
                    session.Location       = mainPageSession.Location = TrackSessionLocation.ServerWithLocalFile;
                    session.ServerFilePath = mainPageSession.ServerFilePath = fileId;
                });
            }

            progressIndicator.IsVisible = false;
            progressIndicator.Text      = string.Empty;
        }
예제 #29
0
        public RenamePage()
        {
            InitializeComponent();

            object tmpObject;

            PhoneApplicationService.Current.State.TryGetValue("parameter", out tmpObject);
            PhoneApplicationService.Current.State.Remove("parameter");
            this.entry = tmpObject as Database.ROMDBEntry;
            PhoneApplicationService.Current.State.TryGetValue("parameter2", out tmpObject);
            PhoneApplicationService.Current.State.Remove("parameter2");
            this.db = tmpObject as Database.ROMDatabase;


            this.nameBox.Text = this.entry.DisplayName;
#if GBC
            SystemTray.GetProgressIndicator(this).Text = AppResources.ApplicationTitle2;
#endif
        }
예제 #30
0
        /// <summary>
        /// Event handler for the Soap Client when it finishes a call to GetBids
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void client_GetBidsCompleted(object sender, GetBidsCompletedEventArgs e)
        {
            //Get the progress indicator from the system tray
            var proggressIndicator = SystemTray.GetProgressIndicator(this);

            proggressIndicator.IsIndeterminate = false;
            proggressIndicator.IsVisible       = false;

            //Detect errors
            if (e.Error == null)
            {
                (IsolatedStorageSettings.ApplicationSettings)["LastUpdated"] = DateTime.Now;
                (IsolatedStorageSettings.ApplicationSettings).Save();
                var bids = getBidListFromXml(e.Result);

                //From DB
                using (var databaseManager = new DatabaseManager())
                {
                    var bidsV = (from b in databaseManager.GovBidContext.BidsViewed select b);
                    foreach (var bV in bidsV)
                    {
                        try
                        {
                            bids.First(p => p.ItemID == bV.Id).Viewed = true;
                        }

                        catch { }
                    }

                    databaseManager.GovBidContext.Bids.DeleteAllOnSubmit(databaseManager.GovBidContext.Bids);
                    databaseManager.GovBidContext.Bids.InsertAllOnSubmit(bids);
                    databaseManager.GovBidContext.SubmitChanges();
                }

                listBox1.ItemsSource = bids;
            }

            else
            {
                MessageBox.Show("Error con conexión de internet.");
            }
        }