Ferrous Moon
http://www.ferrousmoon.com:80/forums/

Need some help coding an HTML Thin Client
http://www.ferrousmoon.com:80/forums/viewtopic.php?f=45&t=1435
Page 1 of 1

Author:  Gwanky [Wed Jul 23, 2008 10:06 am ]
Post subject:  Need some help coding an HTML Thin Client

Hey guys I have to code an HTML Thin Client and really don't know how to go about it. Anyways I've created a kind of psuedocode and a mock up of the program and I'm wondering if the folks here at Onlink could lend me a hand.
Code:
Maps a root drive Allows user to browse root drive Allows user to upload a file to folder of their choice It should invoke the Windows File Browser to choose a folder once folder is chosen user should be able to choose file's that they wish to upload within the client
Heres a (bad) mockup I mad in MSPaint

Image

Author:  eddieringle [Thu Jul 24, 2008 11:02 am ]
Post subject:  Re: Need some help coding an HTML Thin Client

So you want an HTML page that allows a user on a mobile device to do what exactly?

Where is the directory to be mapped? (Desktop computer, mobile device)

Author:  Gwanky [Thu Jul 24, 2008 12:35 pm ]
Post subject:  Re: Need some help coding an HTML Thin Client

Not form a mobile device, but from a computer. I've already got he upload part figured out as we have something in place here I can recycle. I built a local app thinking it would be easy to transition it to a we app that was a mistake :? . Anyways I'm posting my code and the compiled program. By the way thats not really a zip, its a compiled Exe the message board just wouldn't let me attach exes. Just change the extension to exe once you download it.

Heres my code
Code:
//Downloaded from //Visual C# Kicks - http://vckicks.110mb.com/ //The Code Project - http://www.codeproject.com/ //This final program is the work of Joe LoGuidice //Code was borrowed from the above websites using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.IO; //Needed namespace ScanFiles { public partial class xCreditLabel : Form { public xCreditLabel() { InitializeComponent(); } //Recursive function to scan through directories bool stop; //Tells the function to stop private void scanFiles(string rootDirectory) { this.Text = "Scanning Files..."; try { if (stop) return; foreach (string dir in Directory.GetDirectories(rootDirectory)) { if (stop) return; Application.DoEvents(); if (dir.ToLower().IndexOf("$recycle.bin") == -1) scanFiles(dir); //recursive call } foreach (string file in Directory.GetFiles(rootDirectory)) { if (stop) return; Application.DoEvents(); addNode(file, null); //null because we might not have the first node yet } } catch (Exception) { } } //Recursive function to add a full path into a treeview private void addNode(string text, TreeNode parent) { if (text.EndsWith("\\")) text.TrimEnd(new char[] { '\\' }); if (parent == null) { //Add/Find the first node if (text.IndexOf("\\") != -1) { int parentIndex; string nodeString; if (text.IndexOf(":") != -1) //C:\ want to preserve the backslash { //Check to see if it exists first nodeString = text.Substring(0, text.IndexOf("\\") + 1); parentIndex = treeFiles.Nodes.IndexOfKey(nodeString); //Node does not exist so create it if (parentIndex == -1) { //Important to set the key to the text so it is easier to look up the node later treeFiles.Nodes.Add(nodeString, nodeString); parentIndex = treeFiles.Nodes.Count - 1; } } else { nodeString = text.Substring(0, text.IndexOf("\\")); parentIndex = treeFiles.Nodes.IndexOfKey(nodeString); if (parentIndex == -1) { treeFiles.Nodes.Add(nodeString, nodeString); parentIndex = treeFiles.Nodes.Count - 1; } } parent = treeFiles.Nodes[parentIndex]; text = text.Substring(text.IndexOf("\\") + 1); } else { //Simply add it if it does not exist if (treeFiles.Nodes.IndexOfKey(text) == -1) treeFiles.Nodes.Add(text, text); } } if (text.IndexOf("\\") != -1) { string nodeString = text.Substring(0, text.IndexOf("\\")); int parentIndex = parent.Nodes.IndexOfKey(nodeString); if (parentIndex == -1) { parent.Nodes.Add(nodeString, nodeString); parentIndex = parent.Nodes.Count - 1; } addNode(text.Substring(text.IndexOf("\\") + 1), parent.Nodes[parentIndex]); } else { //No children nodes necessary, just add it if (parent.Nodes.IndexOfKey(text) == -1) parent.Nodes.Add(text, text); } } private void btnScan_Click(object sender, EventArgs e) { { stop = false; btnScan.Enabled = false; scanFiles("C:\\"); this.Text = "Done"; btnScan.Enabled = true; } } private void treeFiles_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e) { treeFiles.PathSeparator = "\\"; //Make sure to separate by \ string fullPath = e.Node.FullPath; //fullPath will most likey having somethinc like C:\\hello\file.txt //Check for the double backlash and remove it //Note: "\\" means \ and @"\\" means \\ if (fullPath.IndexOf(@"\\") != -1) { fullPath = fullPath.Substring(0, fullPath.IndexOf(@"\\")) + "\\" + fullPath.Substring(fullPath.IndexOf(@"\\") + 2); } System.Diagnostics.Process.Start(fullPath); } private void btnClear_Click(object sender, EventArgs e) { treeFiles.Nodes.Clear(); } private void xExitButton_Click(object sender, EventArgs e) { Close(); } } }
Can anyone help me transition this to a web app I keep getting errors about

"'System.Windows.Controls.TreeView' does not contain a definition for 'Nodes' and no extension method 'Nodes' accepting a first argument of type 'System.Windows.Controls.TreeView' could be found (are you missing a using directive or an assembly reference?)"

Thanks in advance for the help!

Attachments:
File comment:Its not really a zip just change the extension back to exe
TreeBuilder.zip [10KiB]
Downloaded 711 times

Page 1 of 1 All times are UTC-05:00
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/