Using the right search method in windows 8 app - c#

I'm creating a Windows 8 app that can upload content from the local machine into the app (for local storage). I need to search through this content. What is the preferred strategy to use to incorporate this search functionality?
I have been trying to use the SampleData.json and SampleDataSource.cs from the grid template app as a starting point, but to me, it seems like the SampleData.json file will need to be updated each time new content is added to the app, seeing that data is populated from the SampleData.json file.
I have been going through the tutorial from MSDN:
Is there any other tutorials or advice anyone has for me? I need to incorporate this asap

Windows can index files for you, and then you can use the StorageFolder.CreateFileQuery[WithOptions] APIs to search via properties. If you place content inside a folder called "Indexed" in local or roaming app data, then indexing happens automatically and queries execute very quickly. You can also store the content in "appcontent-ms" files if that works better.
There's also the [Windows.Storage.Search.ContentIndexer][2] API for nonfile content or content that can't live in Indexed appdata folders. The ContentIndexer has its own query methods.
For all the details, see the section "Indexing and Searching Content" in Chapter 15 of my free ebook, Programming Windows Store Apps with HTML, CSS, and JavaScript, 2nd Edition. Even though it's using JS as the language, much of the book is just about WinRT so it's entirely useful even if you're working with C#. And it's free, so there's nothing to lose!

Related

Get Html from Web page and create Setup project for Wpf Application (C#)

I'm trying to create a wpf application such as a movies library because i would like to manage and sort out my movies with a pretty interface.
I'd like to create a library with all my movies getting information from the web, but i don't know how very well.
I thought to get the information from a web site, for example imdb, but i don't know if it's legally to capture html from page to get the nested information.
It's my first desktop application and I would also like to know if it is necessary to create a database within the project and then create a setup project with specified script for deploy it.
Sorry for the confusion but i would like to know too much things :)
Thanks a lot in advance.
The legality of web scraping is a grey area. See my question, "Legality of Web Scraping vs Normal Use" and the corresponding answers for some insight.
Even if the legality is not a problem, web scraping is a flimsy approach because the webpage structure may change without notice, making your application suddenly useless until you update it to the new format. You are much better off using some sort of web API (if the site providing the information offers it).
Whether you need a database or not depends entirely on what your application will be doing and how you design it - it's not something any of us can tell you.
Same goes for the setup project - in fact I wouldn't worry about that until you actually have a working application. Take it step by step and keep the scope within control.
Yes I did not think about api.
It's a great idea, maybe use "themoviedb".
But if i create an application based on it, that has to show all the movies that you have stored on your hdd and get , for example, the posters, the description and the ranking, i have to create a database according to you?
Thanks a lot.

Serve canned offline web content using the Web Browser control

I'm developing a C# replacement for a legacy VB app for my company. The front end is basically a Web Browser control inside of a Windows form, serving offline content which is sometimes altered to include the user's data. Because there are 100 or more web files in the legacy app, we are going to reuse the web UI from the old application with a new C# wrapper around it, modifying them as needed.
My questions are about how to store and deliver the web content.
Does it make sense to copy the web files to a temporary folder and point the Web Browser control to the file:// address of the temporary folder?
Is there some kind of pre-built offline-friendly server framework that makes more sense than copying the files to a temporary folder?
I have the web source files in my project as resources, but I'm not sure if that is appropriate for my uses. Is it?
The legacy VB implementation alters the web files to inject data using Substring methods; it searches for magic strings and replaces them with the appropriate data. That code smells pretty bad, is there a better, more native data injection strategy I should look at?
Some background:
The data is presented using HTML\CSS\JS and also sometimes XSL.
The browser delivers content that is available at compile time.
I'm going to have to handle some events using c# code when users click on buttons of the page.
I'm free to choose whatever approach is necessary to implement the application.
Hosting
I would probably avoid using a temporary location for the web content it just seems a little crude. If there is no internal linking between your html pages and all the css/js is embedded in one file it may be easier to just use the WebBrowser.DocumentText property.
Another option I have successfully used as a lightweight embedded web server is logv-http, it has a pretty easy to configure syntax. If you want to configure against anything other than localhost it does require administrator privileges but it sounds like everything will be local.
var server = new Server("localhost", 13337);
server.Get("http://localhost:13337" ,(req, res) => res.Write("Hello World!"));
server.Start();
Templating
I think the string replaces aren't necessarily bad depends how many there are and how complicated they are trying to be, but for simple find replace it shouldn't be too hard to manage. If there are lots of replaces wrapping them into a RegEx should help performance.
Storing the web content as embedded resources is probably how I would go that way you can read them out at run-time do you pre-processing and then return either via the the web server method or direct into the DocumentText.

monitoring most common web browsers c#/vc++/c

i'm trying to do a download manager just for learning cos i'm new in windows programming,
could someone tell me how to monitor most common web browsers,
i'd like to implement something like:
http://www.iwisoft.com/videodownloader/video-downloader-features.php
everytime you visit a web page in common browsers detects all video files in the web page and allow you to download or not the file, any idea how to do that without building an app for every browser, which is the best language to do it c#/vc++/managed/unmanaged,
i'm learning and using a mix of all to do other parts like download files, add rules to firewall or modify the registry
thanks a lot
I don't really know a neat way of doing this, but you could try the following :
Enumerate the name of the current window using GetForegroundWindow.
Check if the name you get using GetWindowText matches the usual name of the browser.
If it is a browser, moniter the clipboard and check for hyperlinks
then do your download stuff.
I program in C++ and assembly, but I wouldn't be able to advice you on the programming language since I don't have any experience with C#. But since you are new, I would suggest starting out with basic stuff. As pointed out in your comment, this is not something that can be achieved easily.

Home/Landing screen design for a website in asp.net

I have an web based application. The content for the Home page has been currently mentioned in the HTML code for the Home page using , and tags. To change the content anytime in future, it needs to be changed in the HTML code. :(
Is there a way that we can pick up the content from some external place and get it reflected through the website. This ways, any change if required can be made at the external location without referring to the application's code.
Please advise if there is any solution for it.
Thanks.
You can
Use a database
Include external files using Server Side Includes
Read external files and write their contents and an alternative method
Sounds like you're looking for a Content Management System (CMS), which will allow your content editors access to modify only specific blocks of a page that you specify.
There are a ton out there to do what you want, so you don't have to start from scratch. Just Google 'CMS'.
Although I haven't used it myself, DotNetNuke is a popular one these days and has a free version.

How can I read data from a textbox with no web server, then save it in an XML file?

I am studying computer science and we have to do a programming project which must be strongly related to XML and using XSD and XSLT or XQuery/XPath at least. Because I like C# I'd like to do it in this language, but I could use another if anyone has another idea.
My Idea is now to code some kind of appointment book. I imagine that all appointments for the week are shown as HTML and you can enter for each day appointment notes in the textarea for this day.
Now my question: How can I take over the data entered in the textboxes? The application is an offline one so I have no web server receiving the GET request containing the entered data. Is it possible to read the current HTML DOM from memory with all its entered values and then transform it to an XML format for persistent storage from which it could be read in later?
Or is this idea totally stupid?
How else can I put all those XML technologies in one app?
If you want to show UI Generation from XSLT, the web page approach is easiest.
More impressive is generation of XAML from XSLT -> windows app (WPF).
Download Visual Web Developer (FREE)
or
Visual C#
Why does it have to be Web based?
You can use those technologies in a Windows Application.
You can use JavaScript. Convert the data into XML or JSON and output it to another element, like div, or textarea.
What you need to do is set a function that does all this and gets executed on submit.
Check this example. Also to speed things up, you can use a library like jQuery.
Being at home and offline do not mean you don't have a Web server. There are zillions of ready-made packages which offer an embedded HTTP server so that the same application can run online and offline without any modification. Very convenient.
(I know you us C# but, just to show an example, I use wsgiref.simple_server for that purpose.)
Why not make a windows app that allows the user to update the appointments which are stored in an XML file. Then use a stylesheet to display the appointments in a web browser.

Categories

Resources