Skinnable Windows Forms App: Handle different icon sets - winforms

When we started, we put all icons inside a folder in source control, and all Windows Forms projects reference icons inside that folder from their .resx file.
Now that we decided to have different-looking GUIs, we created two more icon sets, all with same names, each into its own folder, so that when we want to use a different one, we just copy and paste into the "main" folder.
The problem with this approach is source control: whenever we commit, we must be careful not to send our icons, if we changed them. This is very bothersome.
How can this be avoided, while keeping all icons under source control? Is there a standard way to handle this?

Have a configuration flag that indicates which set of icons to use. Then, instead of stomping on each other's icon sets, you only need to configure your workspace to point at the correct one.
To keep from having config files stomping on each other in VC, have the VC store a template of the config file with sensible default values, and then have the actual config file be ignored by the VC system.
For example, we will have web.config.template checked in to the VC system and make any system-wide config changes in there. Each developer (and any other sort of deployment) will have their own copy of the template file with their specific config needs in it.
To assist with knowing when the master config file has been changed, we have a set of hook scripts that notify the user that there have been changes and auto-diff against the local file, as well as requiring explicit flags to be set when changing the master file.

Related

Changing Directory of STM32CubeIDE Projects

When I create a new STM32CubeIDE project, it default saves it to my /Documents directory. This isn't too bad except I like to have a folder for each application so that it isn't just a bunch of files. I tried creating a folder called "STM32CubeIDE" to save new projects to, put it gives me an error: "overlaps the location of another project".
I've done some googling and found that this issue also exists in Eclipse (which makes sense) but couldn't solve my problem from those solutions.
I was also wondering if there is a way to move all of my existing projects to this newly created folder? Last time I tried, the IDE flipped out on me and couldn't find my stuff.
First of all, do not call your folder "STM32CubeIDE" if this already exists. Use a different name, because this is normally used by default and it may cause issues (probably the reason why you are getting that error).
When you install or update STM32CubeIDE it gives you the option to choose where you want your default folder to be. For example, my default folder is
C:\Users\%USERPROFILE%\STM32CubeIDE\workspace_1.6.0\
Now if you want to use different folders for different projects, there are two options:
You can Export your project (application) to a desired folder and then Import it using the File tab. This is a good method if you want to make backups, or just want to make sure that all relevant files are transferred correctly to avoid "missing file" issues.
The other method (my favourite) is to simply copy you project folders and paste them to a different folder, wherever you want to put them. Then you simply open STM32CubeIDE, go to File > Open Projects from File System... and chose your project. You might get a pop-up about software compatibility issues (if you made an update), etc. but this should open up your project and show it in the Project Explorer.

Emacs home directory

Many commands access files, and they usually take a path relative to ~/ which I gather is the "home" directory. In my case, C:\Users\Grant\AppData\Roaming\ which is where .emacs.d\ and my init files live.
This is great for Emacs, but not as useful for me. I typically would be over in C:\Users\Grant\Documents\ or my Python script files directory.
Also, I'm using Customize and typing in absolute file names for things like Org capture templates (currently anything I capture goes into files in one particular directory). Not that it's likely that these locations will change, but I was wondering if there are variables I can set for these places, which I can use in Customize or when invoking Dired - maybe some sort of environment variable? And if so, how can I refer to them when typing in a file name?

How to put all the files used inside the winform application in the exe itself?

I am making a winform application whereby I am using some images to show .It works fine when run . But what if I want to take the exe out from the debug folder and use it in some other machine then it will give exceptions that it can't find images on the same path(its obvious as it is not there in that machine path).
Idea to overcome this is to make a setup out of it,but that too is a tedious task.
Can it be possible that we can accomodate all the other sources(like images) used in the project in such a way that it should go along with the exe ?
It's a kind of an odd error, because the *.exe file in the Debug folder is created after adding all the resources into it. And that's why the *.exe file gets lager in size. But it will be a problem if you have mentioned the paths of the resources (like images) manually.
To avoid that always use the properties panel to import resources to the project and this will create the Resoures.resx automatically. Then all the resources will stick to the *.exe file.
But if you have mentioned the paths manually you must provide them in the targeted computer which you are going to use the *.exe file. To make it more easier, give a path in the same folder where the *.exe file exist.
For example give simple paths like (#"image.jpg"), without giving paths like ("C:\Users\Sam\Pictures\image.jpg").
And create a setup including all the resources like images, databases, etc.

WPF - INSTALLSHIELD LE - Additional Files

I have the following situation:
WPF Application
I know about the different ways of deploying. (CAO, InstallShield, ..)
Project includs some Report Files (.rdlc) which
are used by calling them via Path - Right now in a Subdirectory of my PRojectfolder
The Paths are defined in Settings
BUT:
I absolutely dont know how to handle this situation during and after Installation.
If I provide the rdlc files as additional files, how can I automatically change the path, after installation (so that the App can find them), because I dont know before the path of the new client machine. Or do I misunderstood an the InstallShield is managing this files and paths automatically!
Can anybody help me with the right strategy (I am not looking for Code)!?!?
Thanky in Advance
In the installer, place the files relative to INSTALLDIR directory. INSTALLDIR can be modified by the user during installation. You may want to save the value in a registry or a configuration file. For registry, create the required hive and key and set its value to [INSTALLDIR]. For configuration file, you would need to write a custom action that modifies the file with the chosen INSTALLDIR.

How to open multiple files in explorer at the same time?

It is a little tricky to describe my question, but I'll try my best.
First, I am developing a Multi-Document-Interface app using C and WinAPI. My program is able to parse command line arguments to open multiple files. I put this string:
"X:\MyAppName.exe" "%1"
under the open with command list of the txt files so that now I can right click any .txt files in Windows Explorer and open it with my app. However, when I select multiple files, the explorer runs command "X:\MyAppName.exe" "%1" multiple times so that multiple instances of my app are started.
But wait! That's not the most tricky part. Instead, it is that my app treats opening a single file and opening multiple files at a time as two different things with seperate visual styles. I know the idea of keeping one instance running at a time (though I don't know the C code to implement it). But I don't know how to tell the difference between open several files one by one and opening multiple files at the same time.
I hope I make it clear.
Using the Registry like you currently are, you will not be able to directly differentiate between multiple files from single files. Each requested file will start a new copy of your app, as you have already noticed. If you implement single-instancing (which is not that hard to do), what you could do is detect when the first file is requested and start a short timer, then have each subsequent file reset that timer. When it finally elapses, check how many files you collected and act on them as needed.
A better, and preferred, solution is to instead create an out-of-process COM object in your app that implements the IDropTarget interface. Windows will then be able to funnel file information through a single entry point into your app. Your app will not have to care where the information is coming from. You will be able to support not only multiple files at a time, but even different formats of file information (Windows could pass you just the file names, or it could pass you the actual file data itself).
Windows will construct a single IDataObject object to hold whatever file information is needed, and will then pass it to your IDropTarget object. If your app is already running, COM will be able to access your existing IDropTarget object. If your app is not already running, COM will automatically start your app before then accessing its IDropTarget object. Either way, once it is running, your IDropTarget can look at whatever data is passed to it and decide whether to accept it or reject it.
If you register your COM object's CLSID as a DropTarget for the desired file extensions, users will be able to double-click on such files, or select such files and press Enter, and they will be passed to your IDropTarget object.
If you register an AppPath for your app and then register the CLSID as a DropTarget for it, users will be able to drag files, regardless of extension, onto your app's exe file itself, and they will be passed to your IDropTarget object.
If you use the same COM object with the RegisterDragDrop() function, users will be able to drag files, regardless of extension, onto your app's UI directly, and they will be passed to your IDropTarget object.

Resources