Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I need to allow client to add his own language texts for labels which are under resx file. We have created resx file which contain translate text for languages.
Now client wants this feature available to his side. Generally we given option to change his language and by selection we shows label from resx file.
so we need to update this resx file dynamically.
Here is how to add / update a ResX File:
ResXResourceWriter rsxw = new ResXResourceWriter(path);
bool added = false;
if (File.Exists(path))
{
ResXResourceReader reader = new ResXResourceReader(path);
foreach (DictionaryEntry node in reader)
{
if (key == node.Key.ToString())
{
rsxw.AddResource(key, value);
added = true;
}
else rsxw.AddResource(node.Key.ToString(), node.Value);
}
}
if(!added) rsxw.AddResource(key, value);
rsxw.Close();
You should use the resx file as a fallback that is not changeable. To change it clientside is difficult and not a good approach in my opinion. As already suggested, create a database- or XML-based "override" pack. If value x has a definition within this pack, use this. Otherwise use the resx (fallback) value that is provided for value x.
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
What does this code mean? Somehow it generates a .csv file on my side but I cannot seem to find it. I am using it as a data source.
public CSVRepository()
{
var filename = ConfigurationManager.AppSettings["CSVFileName"];
path = AppDomain.CurrentDomain.BaseDirectory + filename;
}
The code runs as the constructor of a class. It looks in an app.config xml file to find a CSVFileName xml element. It uses the value of the element as a filename (no path, just the name). Then it looks up the path where the program is running, appends the filename to that path, and sets the result to a member field in the class that will be used by other code in the class to write out your csv file.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
In my project; I have so many json file from web. And inside json file have campaign datas. But that data numbers is always changing. For example in first json it have 5 data and other json have 15. So I need create labels for that datas. For example if in the json file have 5 campaign data , i need create 5. İf it have 10 then i need create 10. Like this. So how can i make it ? I input json files and its works correctly i just need learn how can i create , position N label in xamarin ? Thanks for your help! <3
just create them and add them to some layout container, like this
var stack = new StackLayout();
foreach(var l in LabelData())
{
stack.Children.Add(new Label { Text = l.SomeProperty });
}
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I have a task like this, I need to create a winform with flow like this:
a textbox for user input a string value. Then, I choose an available file html, and I want to specify <H1> tag and insert these string to it, for example.
I found something on the internet like HtmlTextWriter class but it does not seem feasible...
Maybe I have not understood yet about HtmlTextWriter.
Could you tell me how to use this...Special Thanks for your help.
Use XElement to rebuild the HTML document
string html = #"<html>
<body><div></div></body>
</html>";
string userIput = "hello world";
var document = XElement.Parse(html);
var newDoc = new XElement(document.Name,
new XElement("body",
new XElement("div",
new XElement("h1") { Value = userIput })));
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
The requirement is that a user can choose a file name format from predefined tags.
Example
InvoiceNo Date VendorName
if user chooses InvoiceNo-Date-Vendorname then the file name should be generated like: 001-20170512-ABCElectronics
if user chooses InvoiceNo-Date then the file name should be generated like: 001-20170512
if user chooses VendorName-InvoiceNo-Date then the file name should be generated like: ABCElectronics-001-20170512
format.Replace("InvoiceNo",generateNo());
Will .Replace first check if string exists and then executes the 2nd parameter? The 2nd parameter could be a long running method.
Should I first check if tag exists in the file format and then replace or just use .Replace method without checking?
Thanks
simple way:
input = input.Replace("InvoiceNo",generateInvo());
input = input.Replace("Date",generateDate());
input = input.Replace("Vendorname",generateVendor());
this will change the first occurrence of those strings for the code you desire.
You can also do this in one line like x.Replace(y0,y1).Replace(z0,z1); if you wish.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I need to provide a feature of assigning shortcut keys to any file menu item or buttons at runtime by a user. I am using Visual Studio 2012. Please suggest the standard method to achieve this.
UPDATE
Storing shortcuts in config file is an option. I am searching for the best regarding
Showing shortcut keys along with menu items
Some other commands too will be included which may or may not be
shown in menu
I am lookiing for standard way to proceed not the code. Is storing in config file the best way, what should I consider if any key is changed by user at runtime other than updating config file. This will be some sort of user specific preferences.
private void AssignKey(ToolStripMenuItem item, string keyName)
{
try
{
Keys key = (Keys)Enum.Parse(typeof(Keys), keyName);
item.ShortcutKeys = key;
}
catch (ArgumentException)
{
MessageBox.Show("Unknown key " + keyName);
}
}
EDIT
Missed the update.
Anywho, just store the shortkeys in a "config" class, that has a Save method and save the it every time the software is closed.