|
I have a a windows application which works great written in C#, and I was wondering what are the steps to take to convert it to a mobile device application? Is the process just a copy and paste process? Or is there more to it?
It would be helpful if you tell me what the difference between the two?
Thanks in advance.
|
|
|
|
|
Star09 wrote: Is the process just a copy and paste process?
Yes
|
|
|
|
|
Just tried it, groupbbox can't be used among many other controls. Is there something I'm missing?
|
|
|
|
|
Star09 wrote: Is there something I'm missing?
No
|
|
|
|
|
A mobile device usually doesn't have XP/Vista/Weven installed. That means that some functionality that's present on your PC won't be present in your mobile.
Start your mobile adventure here[^]
I are troll
|
|
|
|
|
The framework is different - although very similar in many respects.
You will need to research to see what controls are not there / behave differently, and the same for any other inbuilt classes you're using, and redesign accordingly.
Mostly, it's stuff taken out, but there are additions too. Most of the stuff that's not there can be recreated easily enough with some 'googling' and some API calls.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
Scenario:
I have a few sub-folders and files in a folder named MYMAINFOLDER.
I read all those sub-folders and files and load them in a form, but if i want to change the MYMAINFOLDER name through windows explorer I got an exception saying that files are being used.
Thing I have tried out:
1). I get no exception if I were to change the subfolder and files names through windows exploere.But as soon as i try to rename the MYMAINFOLDER i get exceptions.
|
|
|
|
|
I guess you can't rename the folder cause it's locked for use. Maybe you are running an executable that resides in the folder, or something similar.
2+2=5 for very large amounts of 2
(always loved that one hehe!)
|
|
|
|
|
Your app, or something else, has files that are still open in that folder.
In order to change the name of the folder, ALL of the files in that folder, and any subfolders must be closed.
|
|
|
|
|
Thanks for answering guys, but here are few more detailed I found out and never knew.
I drilled down to the lowest level while debuggin my apps and found something very interesting point. At Line 5 execution if i were to go rename the foldername through windows explorer no problem but as soon as i were to come in line 7 and then go back on windows exploere to rename the folder then i get the exception.
Could gurus enlightend me with their suggestions.
1) string filename = "";
2) OpenFileDialog openDialog = null;
3) using (openDialog = new OpenFileDialog())
4) {
5) openDialog.InitialDirectory = TempFolderpath ; ---> No problem
6)
7) if (openDialog.ShowDialog(this) == DialogResult.OK)-----> Problem.....
8) {
9) filename = openDialog.FileName;
10) openDialog.Dispose();
11) GC.Collect();
12) }
13)
14)
15) if(openDialog != null)
16) {
17) penDialog = null;
18) }
Folder Structure
----TempFolder
|
|____MYMAINFOLDER
|
|__Folder1
|__Folder2
|__File1.xml
|__File2.html
modified on Tuesday, May 19, 2009 4:55 PM
|
|
|
|
|
At line 7 you create an open file dialog which starts in the folder contained in TempFolderpath. If that's your MYMAINFOLDER folder, then it gets locked and that's why you cannot rename it.
2+2=5 for very large amounts of 2
(always loved that one hehe!)
|
|
|
|
|
That's not the case that's y i had shown my folder structure. At this point i am not sure where the where folder gets locked. Do you think the place where i pointed out that's causing the problem or there may be somewhere something else i need to focus on.
I don't even start to read the files but as soon as the File1.xml is selected through the OpenDialog then the MYMAINFOLDER gets locked. I don't think, it should behave like this becuase i didn't even start reading the files yet. u know what i mean.
Folder Structure
----TempFolder
|
|____MYMAINFOLDER
|
|__Folder1
|__Folder2
|__File1.xml
|__File2.html
|
|
|
|
|
As soon as you select the file, you have an intention of using it or doing something to/with it. It's a good idea to prevent the possibility that someone moves the things that you intend to use.
Swap the "file" idea with a "chair". Now, what Windows' does is preventing that someone moves your chair if it looks like you want to sit on it
I are troll
|
|
|
|
|
My bad, I misread the folders structure. But still, my point remains. You are pointing at the folder with your dialog, so you can't rename it.
2+2=5 for very large amounts of 2
(always loved that one hehe!)
|
|
|
|
|
The OpenFileDialog is using whatever path it's showing as the "Current Directory", and locks this path while the dialog is active. You can't rename any folder along this path until the dialog is dismissed.
You'll also see this issue if there is a command prompt open. If it's, say, sitting in the path C:\TopFolder\SubFolder\SubFolder2, you can't rename or delete any folder in that path.
Also, do NOT call GC.Collect. You'll just end up screwing up the GC's internal self-tuning algorithm.
|
|
|
|
|
Well if that's the case I tried renaming the folder name once the file is selected from the OpenDialog and i clicked on OK button. right. If i were to rename MYMAINFOLDER at
if (filename != "")
{---------------------------->even here doesn't let me to rename
Open(filename);
}
I have spent 2 hours and this thing making me to pull out my hairs. only couple left
|
|
|
|
|
Hi,
you must be doing something special you didn't mention since normally renaming a folder works just fine. Here is test code that works as expected for me:
using (OpenFileDialog d=new OpenFileDialog()) {
if (d.ShowDialog()==DialogResult.OK) {
string f=d.FileName;
log("f="+f);
string f2=f+"a";
File.Move(f, f2);
log("File rename OK");
string dir=Path.GetDirectoryName(f2);
log("dir="+dir);
string dir2=dir+"a";
Directory.Move(dir, dir2);
log("Folder renamed to "+dir2);
}
}
I do have some remarks when looking at your code;
1.
your if(openDialog != null) {openDialog = null;} isn't very useful; first of all, if you want it to be null, just write openDialog = null; . However if openDialog doesn't interest you any more, once your using block is closed, keep the declaration inside the using (as I did).
2.
Calling Dispose() on the subject of a using block is not looking good. The using block is there to take care of it.
3.
Don't call GC.Collect(), the way it works automatically will do a better job if you don't interfere with it.
Now the problem you are having may be caused by something you did not tell us; here are two likely causes:
1.
you did open and not close one of the files inside the path you are trying to rename; e.g. maybe you do a myPictureBox.Image=Image.FromFile(aFileInsideTheChosenFolder);
2.
you did create, write and close a new file inside the folder; although you closed it, some other process may be busy reading the file (an anti-virus scanner, an automatic indexing program, whatever). Try inserting a Thread.Sleep(3000) before you attempt to rename.
Hope this helps.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
|
|
d'oh!!! I can't believe I was actually sent an MSDN link. Not quite as bad as getting a "letmegooglethatforyou", but still ...I looked on the MSDN, but apparently didn't dig deep enough.
Actually, I think this isn't going to be a problem, after all. The mainframe database doesn't do any manipulation to the file coming in to it, so data gets stored as a binary stream in whatever encoding variant it was received in. Therefore, if it was originally encoded in ASCII before it was sent to the mainframe, when it will be retrieved, it will be thrown back in ASCII encoded binary. The program that creates the "bmp" or "3ds" or "mb" or "doc" or "rtf" or whatever would be responsible for encoding/decoding the binary stream that it created.
"I need build Skynet. Plz send code"
|
|
|
|
|
Alaric_ wrote: Not quite as bad as getting a "letmegooglethatforyou"
Sorry, I didn't intentionally snub you.
LetMeMakeThatUpToYou[^]
|
|
|
|
|
Hi,
1.
I am not following you. A binary file is a binary file, there is no ASCII and no EBCDIC involved. If the blob is truly binary, just get it in the normal way and use it.
2.
If your binary data is converted to a string (maybe using base64 encoding), then such string would be represented using some encoding, such as ASCII or EBCDIC; decoding a Unicode base64 is supported by .NET; decoding an EBCDIC base64 string would need explicit code, but could be made to run at the same speed as the normal Unicode (or ASCII) base64 decoding.
3.
Some data formats (JPEG is one of them) include a couple of characters; a JPEG file often starts with the letters JFIF. I do not know they always are in ASCII, I do know they are 8-bit. Check on an IBM system, if they start with ASCII "JFIF" then point 1 applies. If they start with EBCDIC "JFIF" them you need a smart converter, i.e. some code that knows which bytes are actually characters and knows how to translate them.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
|
As Luc said, if the data in your BLOB is, for example, a jpg file then it's binary data, and you don't need to convert it in any way.
On the other hand, if the BLOB contains a text file, and the text file is in EBCDIC, then you must convert it in order to be able to use it.
So, if I understand correctly your issue, you would need conversion only for a specific kind of content (pure text), and you must bypass conversion for all other "binary" data.
Note that passing binary data (like the content of a jpg file) to some EBCDIC to ASCII conversion routine will alter it and it won't be usable anymore!
The only other option I can think of is you are using some kind of encoding from binary data to EBCDIC, something similar to uuencoding[^], so you encode your binary data to EBCDIC and then store it in the BLOB. This wouldn't make much sense, but if that's how it works then you simply must decode it, and there's no way to avoid it.
2+2=5 for very large amounts of 2
(always loved that one hehe!)
|
|
|
|
|
I've been working on automating a file download from the swift.com website. I don't know if this makes a difference but the site uses the Apache webserver. The documentation from SWIFT stresses that they're using the Apache HTTP Client Library, but their sample code is in Java, so that might be why. I assumed that a web request is a web request, regardless of the library you use to create it, but here I am asking for help, so maybe my assumption is incorrect. I've included a portion of the code I wrote to download the file.
...
WebRequest myReq = WebRequest.Create(URL);
string username = "me@mydomain.com";
string password = "myPassword";
string usernamePassword = username + ":" + password;
CredentialCache mycache = new CredentialCache();
mycache.Add(new Uri(URL), "Basic", new NetworkCredential(username, password, "swift.com"));
myReq.Credentials = mycache;
myReq.PreAuthenticate = true;
myReq.Headers.Add("Authorization", "Basic " + Convert.ToBase64String(new ASCIIEncoding().GetBytes(usernamePassword)));
myReq.Proxy = WebProxy.GetDefaultProxy();
myReq.Proxy.Credentials = CredentialCache.DefaultCredentials;
<-- Error occurs on the next line: The remote server returned an error: (401) Unauthorized -->
WebResponse wr = myReq.GetResponse();
Stream receiveStream = wr.GetResponseStream();
StreamReader sr = new StreamReader(receiveStream, Encoding.UTF8);
StringBuilder bicFile = new StringBuilder();
...
Anyone care to shed some light on this for me? I've logged into the site using the credentials so I know I have them right.
Mike Devenney
|
|
|
|
|