Related
here is a code, i have a basic login screen and if username is correct it need to swiitch to AndroidTab.java view, i cant write a correct code for it any one can help ?
Code:
[SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]btnLogin[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].setOnClickListener([/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]new[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] OnClickListener() {[/SIZE]
[LEFT][SIZE=2][COLOR=#646464][SIZE=2][COLOR=#646464] @Override[/COLOR][/SIZE][/COLOR][/SIZE]
[LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055] public [/COLOR][/SIZE][/COLOR][/SIZE][/B][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]void[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] onClick(View v) {[/SIZE]
[SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f] // Check Login[/COLOR][/SIZE][/COLOR][/SIZE]
[SIZE=2] String username =[/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]etUsername[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].getText().toString();[/SIZE][/LEFT]
[/LEFT]
[LEFT][SIZE=2] String password = [/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]etPassword[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].getText().toString();[/SIZE][/LEFT]
[LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055] if[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2](username.equals([/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"User1"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]) && password.equals([/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"pass"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2])){[/SIZE]
[LEFT][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0] lblResult[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].setText([/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"Login successful."[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]);[/SIZE][/LEFT]
[LEFT][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]/* ************************************[/COLOR][/SIZE][/COLOR][/SIZE]
[SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]* ************************************[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#3f7f5f]
[SIZE=2][COLOR=#3f7f5f]* [/COLOR][/SIZE]
[SIZE=2][COLOR=#3f7f5f]* [/COLOR][/SIZE]
[SIZE=2][COLOR=#3f7f5f]* CODE TO GO TO AndoidTab VIEW Class[/COLOR][/SIZE]
[SIZE=2][COLOR=#3f7f5f]* [/COLOR][/SIZE]
[SIZE=2][COLOR=#3f7f5f]* ************************************[/COLOR][/SIZE]
[SIZE=2][COLOR=#3f7f5f]**************************************/[/COLOR][/SIZE][/COLOR][/SIZE][/LEFT]
[/LEFT]
[SIZE=2][COLOR=#3f7f5f]
[/COLOR][/SIZE]
[LEFT][SIZE=2]} [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]else[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] {[/SIZE]
[LEFT][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]lblResult[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].setText([/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"Login failed. Username and/or password doesn't match."[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]);[/SIZE]
[SIZE=2] }[/SIZE]
[SIZE=2] }[/SIZE][/LEFT]
[SIZE=2]});[/SIZE][/LEFT]
(if u full code neccessery i can add it)
Look up Intent & startActivity(); there are alot of examples out there.
jug6ernaut said:
Look up Intent & startActivity(); there are alot of examples out there.
Click to expand...
Click to collapse
i know and im looking for an answer online too,
but atm i really could do with a quick fix lol
one learns nothing if everything is handed to them
With that said xD.
Code:
Intent myIntent = new Intent();
//being package name & activity name
myIntent.setClassName("jug6ernaut.lwp.tetris", "jug6ernaut.lwp.settings.ColorSettings");
startActivity(myIntent);
note that the activity will have to be identified in you manifest file.
also note that if you are not going to use your life first activity anymore you will probably want to remove it from the activity stack so that when you press the back button it doesnt reopen it.
hi,
is there any way to set the sim pin by my applikation?
we don't want our customers to know the sim pin, so our applikation will know it (encrypted config file). if the device needs the sim pin, it shouldn't prompt the user for a sim pin. my application should set it for the user.
Maybe the following code would be helpful for you:
Code:
TelephonyManager tm =
(TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE);
Class clazz = Class.forName(tm.getClass().getName());
Method m = clazz.getDeclaredMethod("getITelephony");
m.setAccessible(true);
ITelephony it = (ITelephony) m.invoke(tm);
it.supplyPin("1111");
Please keep in mind that you also need ITelephony.aidl from Android sources.
rwxer said:
Maybe the following code would be helpful for you:
Code:
TelephonyManager tm =
(TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE);
Class clazz = Class.forName(tm.getClass().getName());
Method m = clazz.getDeclaredMethod("getITelephony");
m.setAccessible(true);
ITelephony it = (ITelephony) m.invoke(tm);
it.supplyPin("1111");
Please keep in mind that you also need ITelephony.aidl from Android sources.
Click to expand...
Click to collapse
thank you very much.
can you please tell me, where to get the right ITelephony.aidl? i tried searching in my sdk folder, but didn't found anything. google found a couple of different versions. what should i do exactly with the aidl file?
bassmaster said:
thank you very much.
can you please tell me, where to get the right ITelephony.aidl? i tried searching in my sdk folder, but didn't found anything. google found a couple of different versions.
Click to expand...
Click to collapse
I used aidl from source repository http://android.git.kernel.org/ , version 2.2. You can try the one you found.
bassmaster said:
what should i do exactly with the aidl file?
Click to expand...
Click to collapse
Did you try to google?
http://developer.android.com/guide/developing/tools/aidl.html
Place ITelephony.aidl in package com.android.internal.telephony in your source dir. After that java classes should be generated from .aidl files and compiled if you're using standard build script.
I added “ITelephony.aidl” and the code to my app. It all works fine. Thank you.
But now I have the following problem:
My App starts within the device. While booting, the sim pin dialog request appears. This screen is blocking everything - including the start of my app.
How can I avoid that?
The only workaround known to me is to do the following:
I enabled the flight mode before I shut down the device. After reboot my app starts, disables the flight mode and sets the pin.
But I don't know an efficient way that always starts the device in flight mode.
Can you help me please?
You can try to handle android.intent.action.BOOT_COMPLETED intent (see example http://www.androidcompetencycenter.com/2009/06/start-service-at-boot/) and provide sim pin code just after boot. Don't forget to add permission android.permission.RECEIVE_BOOT_COMPLETED
I was able to install the HTC Sprint Diagnosis app on my Nokia Lumia 1520 and also have the HTC CSDDiag app installed.
Interesting Part : I was able to run CSDDiag on the Lumia handset and all tests were completed.
Now what i would like to know is how do i run this code in the Native Toast Launcher :
Code:
// Type: DiagnosticTool_Sprint.MainPage
// Assembly: DiagnosticTool_Sprint, Version=1.3.2319.13220, Culture=neutral, PublicKeyToken=null
// MVID: B9415712-08FA-4E66-9A8E-A318594B96CD
// Assembly location: C:\Users\Joshua\Desktop\SPRINT\Data\programs\{E69A2877-59B8-43ED-898D-554FBC4B8B2B}\Install\DiagnosticTool_Sprint.dll
using HTCLogUtil;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using System;
using System.Diagnostics;
using System.Reflection;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using Windows.System;
namespace DiagnosticTool_Sprint
{
public class MainPage : PhoneApplicationPage
{
public static string DIALER_CODE_CT_LAB = "0000";
public static string DIALER_CODE_EMBEDDED_TOOL = "634";
public static string DIALER_CODE_SERVICE_TOOL_1 = "778";
public static string DIALER_CODE_SERVICE_TOOL_2 = "786";
public static string DIALER_CODE_VZW_TOOL = "522";
public static string DIALER_CODE_CSDIAG_TOOL = "3424";
public static string DIALER_CODE_DEBUG = "33284";
public static string DIALER_CODE_ZONE_TOOL = "611";
public static string DIALER_CODE_DIAG = "3424";
public static string DIALER_CODE_SCRTN = "72786";
public static string DIALER_CODE_DATA = "3282";
public static string DIALER_CODE_UPDATE = "873283";
public static string strUri;
internal Grid LayoutRoot;
internal StackPanel TitlePanel;
internal Grid ContentPanel;
private bool _contentLoaded;
static MainPage()
{
}
public MainPage()
{
this.InitializeComponent();
}
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
DiagDebugLogUtil.DiagDebugLog(LOG_SEVERITY.LOG_INFO, "[PC Tools]: OnNavigatedTo()++++", new object[0]);
try
{
if (!PhoneApplicationService.Current.State.ContainsKey("VersionNumber"))
PhoneApplicationService.Current.State.Add("VersionNumber", (object) ((object) Assembly.GetExecutingAssembly().GetName().Version).ToString());
string str = "634";
if (this.NavigationContext.QueryString.TryGetValue("DialString", out str))
{
if (str.Equals(MainPage.DIALER_CODE_SERVICE_TOOL_1) || str.Equals(MainPage.DIALER_CODE_SERVICE_TOOL_2) || (str.Equals(MainPage.DIALER_CODE_DATA) || str.Equals(MainPage.DIALER_CODE_SCRTN)))
this.NavigationService.Navigate(new Uri("/ServiceToolLib;component/View/PageLists.xaml", UriKind.Relative));
else if (str.Equals(MainPage.DIALER_CODE_EMBEDDED_TOOL) || str.Equals(MainPage.DIALER_CODE_DEBUG))
{
if (!PhoneApplicationService.Current.State.ContainsKey("DialString"))
PhoneApplicationService.Current.State.Add("DialString", (object) "634");
this.NavigationService.Navigate(new Uri("/EmbeddedTool;component/EmbMainPage.xaml", UriKind.Relative));
}
else if (str.Equals(MainPage.DIALER_CODE_CSDIAG_TOOL))
this.NavigationService.Navigate(new Uri("/RedirectionTool;component/RedirectionPage.xaml?tool=CSDDiag", UriKind.Relative));
else if (str.Equals(MainPage.DIALER_CODE_VZW_TOOL))
this.NavigationService.Navigate(new Uri("/RedirectionTool;component/RedirectionPage.xaml?tool=LabApp", UriKind.Relative));
else if (str.Equals(MainPage.DIALER_CODE_ZONE_TOOL))
{
if (!App.bNoBackForLaunchAPP)
{
MainPage.strUri = "sprintzone:callintercept?code=" + str;
App.bNoBackForLaunchAPP = true;
this.LaunchSprintAP();
}
}
else if (str.Equals(MainPage.DIALER_CODE_UPDATE))
{
if (!App.bNoBackForLaunchAPP)
{
MainPage.strUri = "ms-settings-networkprofileupdate:";
App.bNoBackForLaunchAPP = true;
this.LaunchUpdate();
}
}
else
this.NavigationService.Navigate(new Uri("/EmbeddedTool;component/EmbMainPage.xaml", UriKind.Relative));
}
else
this.NavigationService.Navigate(new Uri("/EmbeddedTool;component/EmbMainPage.xaml", UriKind.Relative));
}
catch (Exception ex)
{
DiagDebugLogUtil.DiagDebugLog(LOG_SEVERITY.LOG_ERROR, "[MainPage] Get Exception msg :" + ((object) ex.Message).ToString(), new object[0]);
this.NavigationService.Navigate(new Uri("/EmbeddedTool;component/EmbMainPage.xaml", UriKind.Relative));
}
DiagDebugLogUtil.DiagDebugLog(LOG_SEVERITY.LOG_INFO, "[PC Tools]: OnNavigatedTo()----", new object[0]);
}
public async void LaunchUpdate()
{
Uri uri = new Uri(MainPage.strUri);
int num = await Launcher.LaunchUriAsync(uri) ? 1 : 0;
}
public async void LaunchSprintAP()
{
Uri uri = new Uri(MainPage.strUri);
int num = await Launcher.LaunchUriAsync(uri) ? 1 : 0;
}
protected override void OnNavigatedFrom(NavigationEventArgs e)
{
base.OnNavigatedFrom(e);
this.RemoveEntry("MainPage");
}
private void RemoveEntry(string sPageName)
{
foreach (JournalEntry journalEntry in this.NavigationService.BackStack)
{
if (journalEntry.Source.ToString().Contains(sPageName))
{
this.NavigationService.RemoveBackEntry();
break;
}
}
}
[DebuggerNonUserCode]
public void InitializeComponent()
{
if (this._contentLoaded)
return;
this._contentLoaded = true;
Application.LoadComponent((object) this, new Uri("/DiagnosticTool_Sprint;component/MainPage.xaml", UriKind.Relative));
this.LayoutRoot = (Grid) this.FindName("LayoutRoot");
this.TitlePanel = (StackPanel) this.FindName("TitlePanel");
this.ContentPanel = (Grid) this.FindName("ContentPanel");
}
}
}
I can reach the Main page by issuing :
Code:
app://E69A2877-59B8-43ED-898D-554FBC4B8B2B/_default
However I would like to run the Dialer commands to see if I can mod anything else on the phone. Could some with good brain explain how this will be possible.
I have tried install other platform Diag tools but was only able to install the two above using fiddler ( thanks ngame for your tutorial )
Who did you do that ? I Try it many times before to install these aps on RM-821 Nokia Lumia 920 but didn't work !
how did you do that ? Could you please P.M Me ?
ngame said:
Who did you do that ? I Try it many times before to install these aps on RM-821 Nokia Lumia 920 but didn't work !
how did you do that ? Could you please P.M Me ?
Click to expand...
Click to collapse
It wasnt hard to install those apps. Just followed the fiddler tutorial posted.
Then I connected the phone and installed SysPushApp onto the device and did an update for the SysPushApp to get the non_OEM files of Samsung and HTC . I couldnt install Samsung Diagnosis as it wasn't letting nor was I able to install HTC Hub ( I dont know why, may be they check some .dll specific to them in the phone before install ) .
Change the oSession in fiddler config file to the specific OEM you want to install the app. Example for HTC[ ->
oSession (NOKIA)
(NOKIA), (HTC) /B]
Mt device is Dev-Unlock.
tids2k said:
It wasnt hard to install those apps. Just followed the fiddler tutorial posted.
Then I connected the phone and installed SysPushApp onto the device and did an update for the SysPushApp to get the non_OEM files of Samsung and HTC . I couldnt install Samsung Diagnosis as it wasn't letting nor was I able to install HTC Hub ( I dont know why, may be they check some .dll specific to them in the phone before install ) .
Change the oSession in fiddler config file to the specific OEM you want to install the app. Example for HTC[ ->
oSession (NOKIA)
(NOKIA), (HTC) /B]
Mt device is Dev-Unlock.
Click to expand...
Click to collapse
Samsung diagnosis already removed from wp store so you can't install it easy
and diagnosis you can see in store may different from one in Samsung phones! If you check file sizes you will get what i say
Most of HTC apps only can install ID_Resolution_HD720p and WVGA devices i don't know how is it possible to deploy them on 1080 devices
maybe MS accept this resolution for all apps because the old apps have to add 1080 support?
ngame said:
Samsung diagnosis already removed from wp store so you can't install it easy
and diagnosis you can see in store may different from one in Samsung phones! If you check file sizes you will get what i say
Most of HTC apps only can install ID_Resolution_HD720p and WVGA devices i don't know how is it possible to deploy them on 1080 devices
maybe MS accept this resolution for all apps because the old apps have to add 1080 support?
Click to expand...
Click to collapse
correct some Samsung apps are Unpublished like Diagnosis. Can you tell me how to run the above codes in Native Launcher .. what to type after app://GUID/??
tids2k said:
correct some Samsung apps are Unpublished like Diagnosis. Can you tell me how to run the above codes in Native Launcher .. what to type after app://GUID/??
Click to expand...
Click to collapse
I don't have this xaps but you have to use .Net Reflector 8 or any .net Decompiler then u can see all hidden xamls after _default you have to enter a #/ then dll name without it's dll them a ; and then folder and xaml address
example :
app://GUID/_default#/dllname;Pages/ExamplePage.xaml
ngame said:
I don't have this xaps but you have to use .Net Reflector 8 or any .net Decompiler then u can see all hidden xamls after _default you have to enter a #/ then dll name without it's dll them a ; and then folder and xaml address
example :
app://GUID/_default#/dllname;Pages/ExamplePage.xaml
Click to expand...
Click to collapse
here is the XAP
tids2k said:
here is the XAP
Click to expand...
Click to collapse
app://e69a2877-59b8-43ed-898d-554fbc4b8b2b/_default
app://e69a2877-59b8-43ed-898d-554fbc4b8b2b/_default#/DiagnosticTool_Sprint;Component/app.xaml
app://e69a2877-59b8-43ed-898d-554fbc4b8b2b/_default#/DiagnosticTool_Sprint;Component/MainPage.xaml
app://e69a2877-59b8-43ed-898d-554fbc4b8b2b/_default#/EmbeddedTool;Component/app.xaml
app://e69a2877-59b8-43ed-898d-554fbc4b8b2b/_default#/EmbeddedTool;Component/dmswitchpage.xaml
app://e69a2877-59b8-43ed-898d-554fbc4b8b2b/_default#/EmbeddedTool;Component/embcheckspc.xaml
app://e69a2877-59b8-43ed-898d-554fbc4b8b2b/_default#/EmbeddedTool;Component/embmainpage.xaml
app://e69a2877-59b8-43ed-898d-554fbc4b8b2b/_default#/EmbeddedTool;Component/fieldtrialpage.xaml
app://e69a2877-59b8-43ed-898d-554fbc4b8b2b/_default#/EmbeddedTool;Component/ft1xpage.xaml
app://e69a2877-59b8-43ed-898d-554fbc4b8b2b/_default#/EmbeddedTool;Component/ftactiveapnconnpage.xaml
app://e69a2877-59b8-43ed-898d-554fbc4b8b2b/_default#/EmbeddedTool;Component/ftbtpage.xaml
app://e69a2877-59b8-43ed-898d-554fbc4b8b2b/_default#/EmbeddedTool;Component/ftconfigpage.xaml
app://e69a2877-59b8-43ed-898d-554fbc4b8b2b/_default#/EmbeddedTool;Component/ftdatastatuspage.xaml
app://e69a2877-59b8-43ed-898d-554fbc4b8b2b/_default#/EmbeddedTool;Component/ftehrpdpage.xaml
app://e69a2877-59b8-43ed-898d-554fbc4b8b2b/_default#/EmbeddedTool;Component/ftgpspage.xaml
app://e69a2877-59b8-43ed-898d-554fbc4b8b2b/_default#/EmbeddedTool;Component/fthdrpage.xaml
app://e69a2877-59b8-43ed-898d-554fbc4b8b2b/_default#/EmbeddedTool;Component/ftltepage.xaml
app://e69a2877-59b8-43ed-898d-554fbc4b8b2b/_default#/EmbeddedTool;Component/ftmemorypage.xaml
app://e69a2877-59b8-43ed-898d-554fbc4b8b2b/_default#/RedirectionTool;Component/redirectionpage.xaml
app://e69a2877-59b8-43ed-898d-554fbc4b8b2b/_default#/ServiceToolLib;Component/homepage.xaml
app://e69a2877-59b8-43ed-898d-554fbc4b8b2b/_default#/ServiceToolLib;Component/view/checkspc.xaml
app://e69a2877-59b8-43ed-898d-554fbc4b8b2b/_default#/ServiceToolLib;Component/view/grouplists.xaml
app://e69a2877-59b8-43ed-898d-554fbc4b8b2b/_default#/ServiceToolLib;Component/view/itemedit.xaml
app://e69a2877-59b8-43ed-898d-554fbc4b8b2b/_default#/ServiceToolLib;Component/view/itemlists.xaml
app://e69a2877-59b8-43ed-898d-554fbc4b8b2b/_default#/ServiceToolLib;Component/view/lteavailablefile.xaml
app://e69a2877-59b8-43ed-898d-554fbc4b8b2b/_default#/ServiceToolLib;Component/view/pagelists.xaml
app://e69a2877-59b8-43ed-898d-554fbc4b8b2b/_default#/ServiceToolLib;Component/view/rwchoice.xaml
OMG!!!!!!!! so many xamls !
If you can get a Screen Shot of each xaml is more useful I think
None of them works. We need to add Dialercodes in the end.
tids2k said:
None of them works. We need to add Dialercodes in the end.
Click to expand...
Click to collapse
Oh i'm Really sorry . I have to buy an Ativ S to be a bit useful for other users but I have no money to buy
I'm again sorry I don't know what's going wrong in the Uris I provided :|
ngame said:
Oh i'm Really sorry . I have to buy an Ativ S to be a bit useful for other users but I have no money to buy
I'm again sorry I don't know what's going wrong in the Uris I provided :|
Click to expand...
Click to collapse
its alright mate.thanks for your help. I will try tomorrow.
did you check the xap's i posted in the other thread. I hope they will be useful. Thanks.
btw my phone came with Hong Kong firmware but I have installed the Australian firmware. Im glad atleast this was possible.
tids2k said:
its alright mate.thanks for your help. I will try tomorrow.
did you check the xap's i posted in the other thread. I hope they will be useful. Thanks.
btw my phone came with Hong Kong firmware but I have installed the Australian firmware. Im glad atleast this was possible.
Click to expand...
Click to collapse
@nGage were you able to install those apps on your phone ?
@nGage there is some good news i was able to run the strings which you posted. It was all about changing 'Component' -> 'component' and some other tweaks. But the .dll library refers to something else and hence the data is not fetchable. I will post the screenshots tomorrow. @W_O_L_F can this file 'HTC Diagnostics_Sprint be hacked in any way as I was able to install this on Nokia 1520 via Windows App Store -> SysPush ( via Fiddler i.e chainging the OEMID=HTC )
tids2k said:
@nGage there is some good news i was able to run the strings which you posted. It was all about changing 'Component' -> 'component' and some other tweaks. But the .dll library refers to something else and hence the data is not fetchable. I will post the screenshots tomorrow. @W_O_L_F can this file 'HTC Diagnostics_Sprint be hacked in any way as I was able to install this on Nokia 1520 via Windows App Store -> SysPush ( via Fiddler i.e chainging the OEMID=HTC )
Click to expand...
Click to collapse
Not for Nokia.
Be very careful with the HTC Sprint tool, since it has the ability to change NV values, even if it is commented out. (don't know why.) but it sure does.
hutchinsane_ said:
Be very careful with the HTC Sprint tool, since it has the ability to change NV values, even if it is commented out. (don't know why.) but it sure does.
Click to expand...
Click to collapse
thanks for the advice. But the app is pointless on Nokia phones as i have tried it and it doesn't work ... It can go to the menu's bit cannot get the values either it needs Interop or the dll linked is not for the device.
I need a way to search in StorageFiles with dynamically pattern, which comes from a TextBox. The directive "Windows.Storage.Search" doesnt exist in windows phone 8.1 runtime, as i saw. Now my question is, how can i do this in alternative way?
The only way to do it with WP 8.1 since Microsoft ALWAYS fails to implement the important things are to query using LINQ.
Ex:
Code:
var result = (await Windows.Storage.ApplicationData.Current.LocalFolder.GetFilesAsync(Windows.Storage.Search.CommonFileQuery.OrderByName)).
Where(x => x.Name.
Contains(x => txtBox.Text));
That's about all you can do pretty much. (Thanks Microsoft).
Thank you for the example. But it wont work for me, it shows me the following error(s):
Code:
A local variable named 'x' cannot be declared in this scope because it would give a different meaning to 'x', which is already used in a 'parent or current' scope to denote something else
and
Code:
Cannot convert lambda expression to type 'string' because it is not a delegate type
Thats really odd from Microsoft, that they havent implementet the search function like in WinRT (Windows Store App).
The first error is pretty simple. You already have the variable named "x" and it would be very bad if compiler didn't give you that error.
Change the name of the variable to something else that you don't use in that scope and it will work.
And for second problem, try this one:
Code:
private List<string> Result()
{
var result = ((List<Windows.Storage.Search.CommonFileQuery>)Windows.Storage.ApplicationData.Current.LocalFolder.GetFilesAsync(Windows.Storage.Search.CommonFileQuery.OrderByName)).Where(x => x.ToString().Contains(txtBox.Text));
return result as List<string>;
}
private async Task<List<string>> ResultAsync()
{
return await Task.Run(() => Result()).ConfigureAwait(continueOnCapturedContext: false);
}
You should call ResultAsync method and get the result in this way:
Code:
List<string> myList = ResultAsync().Result;
That's not going to work. You can't cast a StorageFile as a string.
To fix my code (simple lambda typo)
Code:
var result = (await Windows.Storage.ApplicationData.Current.LocalFolder.GetFilesAsync(Windows.Storage.Search.CommonFileQuery.OrderByName)).
Where(x => x.Name.
Contains(txtBox.Text));
if(result.Any())
{
// Do shtuff
}
Also, you should never access the .Result of an async task because you never know if it completed yet.
Ok, first error is done, but the second error is still here
Code:
Cannot convert lambda expression to type 'string' because it is not a delegate type
You are missing the point of the TAP (Task Async Pattern).
Both main thread and async method will be in execution in the same time. When the async method finish his work, main thread will stop and catch the result trough the Result property.
TAP is the recommended way of asynchronous programming in C#. The only thing with TAP is to use ConfigureAwait method in non-console type of apps to avoid deadlock.
Sooner or later you will get the result from TAP method. Nothing will get in the conflict with the main thread.
Oh wait, @andy123456 I updated my response. I forgot String.Contains ISNT a lambda .
@Tonchi91, I know all about the TAP. I've been using it since it was CTP. I've seen the awkward situations with threading in WP .
Now... if he did
Code:
List<string> myList;
ResultAsync().ContinueWith(t=> { myList = t.Result; });
I wouldn't be worried .
Ok the errors are gone, but the debugger show me the following exception:
Code:
Value does not fall within the expected range
Is this search method case-sensitive? I tried with an exact input in the TextBox.
Hmmm. Let's see your full code.
its actually only for testing, so i added your code to a button (asnyc) and will show the output in a textBlock.
Code:
private async void buttonTest_Click(object sender, RoutedEventArgs e)
{
//Result();
var result = (await Windows.Storage.KnownFolders.CameraRoll.GetFilesAsync(Windows.Storage.Search.CommonFileQuery.OrderByName)).
Where(x => x.Name.
Contains(textBox_test.Text));
if (result.Any())
{
// Do shtuff
textBlock_test.Text = result.ToString();
}
}
The error is coming from here
Code:
var result = (await Windows.Storage.KnownFolders.CameraRoll.GetFilesAsync(Windows.Storage.Search.CommonFileQuery.OrderByName))
andy123456 said:
its actually only for testing, so i added your code to a button (asnyc) and will show the output in a textBlock.
Code:
private async void buttonTest_Click(object sender, RoutedEventArgs e)
{
//Result();
var result = (await Windows.Storage.KnownFolders.CameraRoll.GetFilesAsync(Windows.Storage.Search.CommonFileQuery.OrderByName)).
Where(x => x.Name.
Contains(textBox_test.Text));
if (result.Any())
{
// Do shtuff
textBlock_test.Text = result.ToString();
}
}
The error is coming from here
Code:
var result = (await Windows.Storage.KnownFolders.CameraRoll.GetFilesAsync(Windows.Storage.Search.CommonFileQuery.OrderByName))
Click to expand...
Click to collapse
Oh Camera Roll.. You MIGHT need to have the capability to view the camera roll enabled. I forget what it's called, but you need a specific cap in order to view from there. Also, I would try to see if you can use a generic folder instead.
I would try Windows.Storage.ApplicationData.Current.LocalFolder.GetFilesAsync() as your method after the await just to test whether you can read correctly.
Yes but in wp8.1 runtime app, there arent caps anymore. The capability for access to the pictures is simply calles pictures library and is enabled. I have tested it as you said, but it gives me the same exception.
A quick tip: another way to do this is to use the Win32 C runtime API. You can, for example, use the FindFirst/NextFile functions (http://msdn.microsoft.com/en-us/library/windows/desktop/aa364418(v=vs.85).aspx) which support searches using wildcards (* and ? characters in the first parameter). These functions are wrapped in my NativeLibraries classes, but are also just publicly available for third0party developers to call from their own C++ DLLs.
Alternatively, you can use the .NET System.IO.Directory class, which has functions like EnumerateFiles(String path, String searchPattern). This is probably the better way to do it, actually.
Of course, if you want these operations to not block the current thread, you'll need to explicitly put them in their own thread or async function.
EDIT: This also assumes you have read access to the relevant directories. You application data directory works fine, for example (you can get its path from the relevant StorageFolder object). Other directories that can be accessed via WinRT functions may go through a broker function instead of being directly readable.
The point is, that i have an array with filenames. Now i need the StorageFile files which contains these filenames. My idea was to search for these files and return the files as StorageFile, so i can work with these. Or is there a simpler / another way?
http://msicc.net/?p=4182 <-- try this
Thank you, i have already done this and its working. But how can i compare the Files to read, with already read files and take only the not yet read files?
This trick is not working anymore.Thanks!
Hi guyz,
This trick lets u install w10 on all sd card enabled lumia's.Use with own care. you must have preview for developers installed in prior to continue with these steps.
1.Download and deploy custom_wpsystem.xap tool from this link.
Note:install this tool only on phone memory.
Link : fileshub.in/5AX
2.next download custom_pfd tool and place it in sd card.
Link : fileshub.in/5AY
3.Now open customWPSystem tool.At startup u can see "SD Card permissions" as red in color.Now click on that , browse and select SDcard again to apply permissions.
4.Now you can see "SD Card Permissions" as green in color.
5.After changing SD Card permissions click on browse xap button.
6.Browse and select custom_pfd.xap from SD card and click Apply Xap Button.
7.After successfully applying custom_pfd tool to preview for developers goto preview for developers.
8.Now u can see the registry editor.
9.Browse to HKLM -> SYSTEM -> Platform -> DeviceTargettingInfo
10.there we have to change couple of values.
1.change phoneFirmwareRevision from default to ->>01061.00066.14235.36002 and click the write button.
2.change phoneManufacturerModelName ->> RM-978_1046 and click the write button.
11.Thats it!.Goto windows insider app and choose update of your choice.
Thanks to "Danteswap" for helping with me this trick.
Also we will not take any responsibility if your phone got bricked.
Thanks Again! :angel:
as anaheiim said ...
There is No need to mod "PhoneFirmwareRevision".
You must mod "PhoneManufacturerModelName" and "PhoneMobileOperatorName".
You need to match PhoneManufacturerModelName and PhoneMobileOperatorName together. For example:
- "PhoneManufacturerModelName": RM-984_1004
- "PhoneMobileOperatorName": 000-FR
Because RM-984_1004 corresponds to the variant FR CV of NL830, so PhoneMobileOperatorName in 000-FR value. Should therefore mod what you have written, because it is incompleted.
u can also try these values......
- RM-978_1051 / 000-PL
- RM-984_1001 / 000-DE
- RM-984_1037 / 000-GB
Thanks to 'anaheiim for this informations... :good:
I don't know is that trick work or not after the Windows insider update... please check it and inform me...
Okay mate. Gonna try it.
Hi @Riyad_,
No need to mod "PhoneFirmwareRevision".
You must mod "PhoneManufacturerModelName" and "PhoneMobileOperatorName".
You need to match PhoneManufacturerModelName and PhoneMobileOperatorName together. For example:
- "PhoneManufacturerModelName": RM-984_1004
- "PhoneMobileOperatorName": 000-FR
Because RM-984_1004 corresponds to the variant FR CV of NL830, so PhoneMobileOperatorName in 000-FR value. Should therefore mod what you have written, because it is incompleted.
.....
anaheiim said:
Hi @Riyad_,
No need to mod "PhoneFirmwareRevision".
You must mod "PhoneManufacturerModelName" and "PhoneMobileOperatorName".
You need to match PhoneManufacturerModelName and PhoneMobileOperatorName together. For example:
- "PhoneManufacturerModelName": RM-984_1004
- "PhoneMobileOperatorName": 000-FR
Because RM-984_1004 corresponds to the variant FR CV of NL830, so PhoneMobileOperatorName in 000-FR value. Should therefore mod what you have written, because it is incompleted.
Click to expand...
Click to collapse
i didn't get you bro . can you explain please....??/
Riyad_ said:
i didn't get you bro . can you explain please....??/
Click to expand...
Click to collapse
What do you want that I you explain?
- There is no need to change the value of the registry key "PhoneFirmwareRevision".
- In your post, you say to mod the value of the registry key "PhoneManufacturerModelName" for the value "RM-978_1046".
RM-978_1046 corresponds to the variant 059V994 RM-978 VAR IMEA IN CV. I just told you that the value of the registry key "PhoneMobileOperatorName" must match with RM-978_1046, so the value of "PhoneMobileOperatorName" should be 000-IN.
Some other examples:
RM-978_1051 = 000-PL (so PL CV of NL630)
RM-984_1001 = 000-DE (so DE CV of NL830)
RM-984_1004 = 000-FR (so FR CV of NL830)
etc
anaheiim said:
What do you want that I you explain?
- There is no need to change the value of the registry key "PhoneFirmwareRevision".
- In your post, you say to mod the value of the registry key "PhoneManufacturerModelName" for the value "RM-978_1046".
RM-978_1046 corresponds to the variant 059V994 RM-978 VAR IMEA IN CV. I just told you that the value of the registry key "PhoneMobileOperatorName" must match with RM-978_1046, so the value of "PhoneMobileOperatorName" should be 000-IN.
Some other examples:
RM-978_1051 = 000-PL (so PL CV of NL630)
RM-984_1001 = 000-DE (so DE CV of NL830)
RM-984_1004 = 000-FR (so FR CV of NL830)
etc
Click to expand...
Click to collapse
ok..now i get it..Thank u..
It doesn't seem to work on my Lumia 1520.... no builds...
OrionBG said:
It doesn't seem to work on my Lumia 1520.... no builds...
Click to expand...
Click to collapse
Hi,
See this post http://forum.xda-developers.com/showpost.php?p=59013229&postcount=3 and make the modification of two mentionned registry keys.
anaheiim said:
Hi,
See this post http://forum.xda-developers.com/showpost.php?p=59013229&postcount=3 and make the modification of two mentionned registry keys.
Click to expand...
Click to collapse
Used the exact same values from the post... still no builds...
My original product code is 059V330: RM-937 VAR EURO CZ CV BLACK
OrionBG said:
Used the exact same values from the post... still no builds...
My original product code is 059V330: RM-937 VAR EURO CZ CV BLACK
Click to expand...
Click to collapse
Try with other value:
- RM-978_1051 / 000-PL
- RM-984_1001 / 000-DE
- RM-984_1037 / 000-GB
anaheiim said:
Try with other value:
- RM-978_1051 / 000-PL
- RM-984_1001 / 000-DE
- RM-984_1037 / 000-GB
Click to expand...
Click to collapse
Tried those... no builds...
OrionBG said:
Tried those... no builds...
Click to expand...
Click to collapse
You have changed each value correctly (two values)? For exemple:
First value:
- Path: HKLM\SYSTEM\Platform\DeviceTargetingInfo
- Key: PhoneManufacturerModelName
- Value: RM-984_1037
Second value:
- Path: HKLM\SYSTEM\Platform\DeviceTargetingInfo
- Key: PhoneMobileOperatorName
- Value: 000-GB
anaheiim said:
You have changed each value correctly (two values)? For exemple:
First value:
- Path: HKLM\SYSTEM\Platform\DeviceTargetingInfo
- Key: PhoneManufacturerModelName
- Value: RM-984_1037
Second value:
- Path: HKLM\SYSTEM\Platform\DeviceTargetingInfo
- Key: PhoneMobileOperatorName
- Value: 000-GB
Click to expand...
Click to collapse
Yes. I did exactly this. I've rechecked and rechecked...
OrionBG said:
Yes. I did exactly this. I've rechecked and rechecked...
Click to expand...
Click to collapse
Weird, it works for me (NL620). And some of my MVP colleagues have tried, it works for them.
You have connected your Microsoft account at the Windows Insider app (Microsoft account must be registered on Windows Insider)?
anaheiim said:
Weird, it works for me (NL620). And some of my MVP colleagues have tried, it works for them.
You have connected your Microsoft account at the Windows Insider app (Microsoft account must be registered on Windows Insider)?
Click to expand...
Click to collapse
Yes, I've also been receiving all the Windows Phone 8.1 beta updates. I've also rechecked my account and at least what I can see i that I'm signed up for the preview and in the app. I also have about 600MB of free space on my system partition. I've already reset my 1520 twice with the Microsoft Recovery Tool tried every method that I could find (with or without SD Card) and every time I get the " no builds " message from the insider program... I can't explain it...
OrionBG said:
Yes, I've also been receiving all the Windows Phone 8.1 beta updates. I've also rechecked my account and at least what I can see i that I'm signed up for the preview and in the app. I also have about 600MB of free space on my system partition. I've already reset my 1520 twice with the Microsoft Recovery Tool tried every method that I could find (with or without SD Card) and every time I get the " no builds " message from the insider program... I can't explain it...
Click to expand...
Click to collapse
The updates Windows Phone 8.1 beta as you call it, is different from Windows Insider. Registration are separated.
What is your OS version?
anaheiim said:
The updates Windows Phone 8.1 beta as you call it, is different from Windows Insider. Registration are separated.
What is your OS version?
Click to expand...
Click to collapse
I've checked again. I'm subscribed for both Windows 10 for PC and Windows 10 for Phones. It asked me on the web page if I'm sure and after that there was a message don't say we didn't warn you or something like that and then redirected me to the store to download the Windows Insider program. So I should be registered for the preview...
OS Version: 8.10.14226.359
Firmware revision: 02540.00019.14522.26005
OrionBG said:
I've checked again. I'm subscribed for both Windows 10 for PC and Windows 10 for Phones. It asked me on the web page if I'm sure and after that there was a message don't say we didn't warn you or something like that and then redirected me to the store to download the Windows Insider program. So I should be registered for the preview...
OS Version: 8.10.14226.359
Firmware revision: 02540.00019.14522.26005
Click to expand...
Click to collapse
Take a screenshot of complete informations of "extras+info", for that I check a trick or two. I do not know what else to tell you other. Your case is bizarre.
anaheiim said:
Take a screenshot of complete informations of "extras+info", for that I check a trick or two. I do not know what else to tell you other. Your case is bizarre.
Click to expand...
Click to collapse
here they are:
Also, you can see from the second picture that the Operator and Model have already been changed. My Original
were: RM-937_eu_hungary_1002 and 000-33
OrionBG said:
here they are:
Also, you can see from the second picture that the Operator and Model have already been changed. My Original
were: RM-937_eu_hungary_1002 and 000-33
Click to expand...
Click to collapse
I do not know what else to tell you. It's weird because, as I say, it works for me and some of my MVPs colleagues who have tried.
Perhaps a sign of destiny that don't want that you install on your device W10 TP (as it is not yet officially listed) ^^