A Simple Windows Vista/7 Gadget To Preview Code. Project's Featured Articles. Editorial Note. This article is one of the articles in the series that demonstrate the development of the Code. Project's foundation miscellaneous tools and API's that can be easily and conveniently used for an offline articles editing and previewing, showing a member's reputation statistics, using Code. Project's search engine to find articles about the topics a reader is interested in, etc. The Windows Vista/7 sidebar gadget introduced in this article is the most an up- to- date web application that can be used to preview the featured contents once published at the Code. ![]() Project's web site by its members and contributors. Hope that, the following gadget will be extremely useful for a large audience of readers and members contributing and reading articles once ever published at the Code. Project's web site. Another valuable purpose of this paper and the code being uploaded is to demonstrate how to easily create and deploy a Windows Vista/7 sidebar gadget based on the example of creating the gadget mentioned above. ![]() Introduction"Gadgets are lightweight HTML and script- based applications that provide the abillity to derive and present information or functionality from a variety of sources, such as local applications and controls, or websites and services. Developers with experience authoring webpages will find the process of creating a gadget very familiar.." - Microsoft Developers Network (MSDN): Developing Gadgets For Windows Vista/7 Sidebar. In this article we'll introduce the implementation of a simple lightweight Windows Vista/Seven desktop gadget that allows to preview the featured articles ever published and announced at the Code. Project's main page. The following gadget will automatically refresh in a certain interval of time specified by a user to render those new featured articles currently exhibited on the Code. Microsoft Silverlight library, learning resources, downloads, support, and community. Evaluate and find out how to install and use Silverlight. - Could not load file or assembly 'csla, version=2.1.4.0, culture=neutral, PublicKeyToken=93be5fdc093e4c30'or one of its dependencies. There are many ways to deploy a WPF application from our development computer to an end user’s desktop. Here you will learn about deploying WPF Application. New Features. WPF and Silverlight WorkbookView and FormulaBar controls. Support for 64 new Excel 2010 compatible functions (see list below). Support for Windows 8. Project's main web page. The using of this gadget allows a user to keep up with the latest Code. Project's featured articles published at the Code. Project's web site as if a user has manually opened the Code. Project's main page with a regular web browser. Moreover, the following gadget provides a functionality that could be very useful to the Code. Project's members contibuting articles to the Code. Project's web site. In particular, when a featured article that a member once has published is presently annouced in the Code. Project's main web page, the gadget reminds about it by either playing a notification sound or delaying on showing up the article's announcement: During the discussion, we'll take a closer look at such fundamental aspects as using HTML/CSS markup language to create the core gadget's main web page rendered at the gadget's window in the desktop's sidebar when the gadget is run. Particularly, we'll explain how to use HTML and CSS- styles to author the basic layout of the core gadget's main web page. As well, we'll delve into such important topics of the web application developement as the implementation of the basic gadget's functionality by using DHTML/Javascript language, including the event handling mechanism that orchestrates the dynamic responsive gadget's behavior, Ajax- requests to download and retrieve the contents of the Code. Project's main web page as well as using the Javascript's regular expressions Reg. Exp object, string manipulation functions and other parsing mechnisms such as (DOM - Document Object Model) used to either extract particular data on a featured article from the main web page being loaded or update the gadget's HTML- document contents programmatically, using timers to provide the gadget's dynamically refresh the contents rendered by the gadget in a specific interval of time, etc. In particular, we'll demonstrate how to maintain the core gadget's main web page, that has a specific layout in which featured articles announcements are rendered. At the same time, we'll particularly spotlight on such essential topics as designing the gadget's core web page, using CSS- stylesheets to provide the attribute values of certain HTML- elements used in the core gadget's main web page HTML- document. To provide the basic functionality of the gadget being discussed, we'll find out how to implement the number of functions written in Javascript that will perform such tasks as rendering the core gadget's main web page, loading the Code. Project's main web page contents as well as retrieving and parsing them programmatically by using regular expressions and DOM, handling events to provide the basic gadget's dynamic behavior and functionality such as refreshing the gadget's window in a certain interval of time, using Javascript's random number generator and math functions to randomly select the Code. Project's web site category under which the current featured article is being announced, firing the sound notifications when the featured article once contributed by a specific Code. Project's member is exhibited, etc. Additionally, we'll spend a moment to discuss about creating the gadget's settings dialog box that allows to personalize the using of the following gadget by setting the timeout of the refresh interval in seconds, the name of Code. Project's member identity used for notification purposes. In addition, we will discuss about such aspects of the Windows 7 sidebar gadgets development as creating a gadget's installable package, using various built- in and external development tools to perform the gadget's main scripts debugging, etc. Background. At this point, let's thoroughly discuss about the fundamental steps of the development process, which is based on using various scripting languages such as HTML/CSS and Javascript as well as using Microsoft UI development tools for that purpose. Creating Project. The first initial aspect that we're about to discuss at the very beginning in this article is creating the new project from a "scratch" containing all necessary files required to provide the gadget's basic appearence and functionality under the Windows Vista/7 sidebar desktop application. Specifically, at the very beginning we should create a simple directory, at the whatever location, locally at your PC, and name it, for example, Code. Project_Featured. Notifier. Inside this directory we're simply intended to create the following set of sub- directories and files: The list of sub- directories to be created inside project's directory./css - the sub- directory that will contain CSS- stylesheet files for the gadget's HTML- documents such as either main. HTML- document./sounds - the sub- directory containing the various sounds played when the gadget is used; The list of the gadget's project files./main. CSS- stylesheet file loaded by the gadget's main web page main. CSS- stylesheet file used in the settings. Main. min. css - the local copy of the main Code. Project's web page CSS- stylesheet loaded by the gadget./js/main. Java. Script file containing functions that implement the basic gadget's functionality./js/settings. Java. Script file containing functions written in Java. Script used to manage settings./images/logo. Code. Project's logo rendered at the top of the gadget's main web page./images/logo. The Gadget's Main Web Page Layout Using HTML/CSSAs we've already discussed above, in the introduction to this article, the main building block of a Windows sidebar gadget is the main web page (e. To be more specific, in this particular case, we'll not, in fact, implement our own custom layout for that purpose. Instead, we'll use an already existing HTML- document loaded by the gadget from the original Code. Project's main web page. Also, for that purpose we'll need to download and use the appropriate CSS- stylesheet externally located at the https: //codeproject. App_Themes/Code. Project/Css/Main. In this case, rather than downloading this CSS- stylesheet from the file whenever the gadget's main web page is loaded, we're just aiming to manually download this file and modify its contents by adjusting specific attribute values of several elements within the layout to make sure that the needed HTML- contents are properly rendered within the gadget's window being discussed. The following HTML- source illustrates the gadget's main web page layout: main. Code. Project's Featured Article Gadget< /title> < linktype="text/css"rel="stylesheet"href="./css/gadget. Main. min. css"> < scriptsrc="./js/main. Creating an MSI Package for C# Windows Application Using a Visual Studio Setup Project. Introduction. There are many ways provided by Microsoft to create a setup project for Windows applications. But when I started to create one, I got nothing but queries and confusion of how to start and where to start. There are numerous articles I found over the network, explaining how to create a setup project, but some do not work as they say, and some do not have a live example to follow. The driving force for me to write this article is my QC team, who accepts the main application to test and verifies my setup installer with their 1. And guess what, they were successful in finding bugs in that too. In this article I would like to explain a step- by- step procedure to create a Windows application and a setup installer for it in a very simple manner, that is easy to understand and follow. There are many alternative ways to do it. Start the Show. First let's create a simple one- form Windows application, having a text box and a button only. The creation of the Windows application is just for the sake of having one to install. I gave the name Creating. Installer to my Windows application, obviously you can have your own. Thus adding a new Windows Form Application in my solution and adding a text box and button to the default form resulted in the figure as shown below. Decorate the control properties as per your prefer. I just wanted to write a few lines of code, so I bound the button's click event to show the text box's text: Primary Objective. So far so good. Now let's create an installer for the same Windows application. Right- click on the solution and add a new project to your solution like in the following figure: And add a Setup Project by "Other Project Types" - > "Setup and Deployment" - > "Visual Studio Installer" as in the following: The project will be added to the solution. Now open the file system editor by clicking on the project and select the option to open the file system editor, as shown in the following figure. You'll get to see the Application Folder, User's Desktop and User's Program Menu. Right- click on the Application Folder and add an output project; the output project specifies the project we are creating an installer for, like in the following figure: Select "Creating. Installer", in other words the Windows application project name in the "Add Output Project Group" window, select it as the primary output as shown below and click "Ok". The Primary output will be added as shown below, having a type defined as Output. In the meanwhile let's add some more functionality to our Windows application, let's read a file and show its output in a message box on button click. Therefore just add a text file, I called it Sample. Input" folder, Input is the custom folder I created to place my txt file. Write a few lines of code just to read the txt file from the Startup path, in my case "bin\debug". It could also be "bin\release" as per the project build, and specify the file folder name and file name to read the content. I chose to keep my txt file at the startup path so that I could explain how to create files and folders at the time of installation. Now we also need this Input folder and a Sample. For file operations I added the namespace System. IO, needless to specify this thou. Therefore running the application will show two message boxes, one after another showing the text box text and text from the Sample. Now in this folder creation logic has to be implemented in the out setup project, so that when the application installs, it has all the pre- requisites required to run the application, like the Input folder and the Sample. So, right- click on the Application Folder in the File system editor and add a folder. The folder will be created just below the Application Folder, name that folder Input. Right- click on the folder, select properties and mark Always Create property to True. That means the folder will always be created whenever we run the installer, after a fresh build release. Create Shortcuts. You can decorate your form to add an icon to it, that icon will also be required at the time of installation to create a shotcut icon to our application. Add an icon to the form like in the following figure: It is now time to add the Sample. Right- click the Input folder created and Add file to it, browse for the Sample. Windows Application project we created earlier. To create a shortcut to the application, right- click on the Primary output in the middle window pane and select "Create Shortcut to Primary Output", name that shortcut as Creating. Installer. Select the properties of the shortcut by right- clicking it and add an icon to it. This icon will be created on the Desktop when the application launches. The following figures shows how to add an icon. Cut the shortcut created at the Application Folder and paste it under the User's Desktop Folder. The job is done to create a shortcut to the user's Desktop. For shortcuts to be created in the User's Program Menu, add a new folder to the User's Program Menu that will be created at the program's menu location. In that folder create a new shortcut pointing to the primary output as done for creating a Desktop shortcut. The following three images shows the process: Name the folder Creating. Installer. Right- click on the middle window pane to create a new shortcut. Select the shortcut source to the primary output as selected. Also add an icon to the shortcut, as done for the Desktop shortcut. Right- click the Application folder to set the properties of where to install the application, as in the following: Uninstall. We always have an option to uninstall the application from the Control panel's Programs and Features list (as simple as that) but how about creating our own uninstaller, that too is under the programs menu so that we do not need to disturb the Control Panel. Step 1. Right- click on the File System on the target Machine and "Add Special Folder" - > "System Folder" as shown in the following figure: Step 2. Right- click on the newly created system folder and browse for the msiexec. System. Windows. 32 folder. This file provides the parameters and other data to install and uninstall the application based on certain parameters specified. Set the properties of the file exactly as shown in the following figure: Step 4. Now create a new shortcut under the User's program Menu and point its source to msiexec as shown below. You can add icons and a name to your shortcut. I have given it the name "Uninstall". Step 5. Press the F4 key by selecting the setup project. We see a list of properties, we can customize these properties as per our installation needs, like set Product name, Author, Installation location. I'll not go into a deep discussion about all this, since they are quite easy to understand and set. Just take a note of the product code shown below in the list of properties. We will need the product code as a parameter to msiexec for uninstallation. Step 6. Right- click the Uninstall shortcut and set the arguments property as shown in following: /x {product code} /qr/x is for uninstalltion. You can get the entire detailed list of parameters and their use at http: //technet. Step 7. Save all and Rebuild the setup project. Job Done ! Now our setup is ready to install our Windows application. Just browse the debug folder location of the Setup project, we find a msi and a setup. When started we see a setup wizard, having screens that welcomes User and that asks for the location to install to (already showing the default location). After completing the wizard, click the Close button. Now the job is done, we will see our shortcuts to the application created on the Desktop and the User's Program Menu like in the following figure. Now if we navigate to our installation location then we can also see the Input folder created and Sample. Run the application and see the output; it works perfectly as was when executed from Visual Studio. Click on uninstall to remove the application, the wizard launches as in the following: Custom Actions. I just want to provide a glimpse of Custom Actions we can define while creating a setup. Custom actions are the actions that contains customized functionality apart from the default ones at the time of installation and uninstallation. For example my QC team reported a bug that when the application is run and in the background the application uninstall is done, the application continues to run.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
November 2017
Categories |