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 3 years ago.
Improve this question
Can I add a hyperlink in resource file Strings.resx?
I want that my string to be like this: Text example text example www.test.test.
When I click on www.test.test then the web page to open.
This behavior is for IOS devices.
var link = "http://www.google.com";
var htmlLink = String.Format("<a href='{0}'>{1}</a>", link, link);
var attr = new NSAttributedStringDocumentAttributes()
{
DocumentType = NSDocumentType.HTML
};
var nsError = new NSError();
MyTextView.ShouldInteractWithUrl += delegate
{
return true;
};
MyTextView.Editable = false;
MyTextView.AttributedText = new NSAttributedString(htmlLink, attr, ref nsError);
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 5 hours ago.
Improve this question
Enter a string of characters S. Indicates whether the string S is cyclic or not.
For example S='abcdabcdabcdabcd' is cyclic.
My teacher want me to do this but i think it's too hard. I'm thinking using SplitString but it's just an idea and i dont know how to do. I'm very thankful if someone gives me help
using System;
using System.Collections;
public class MYCLASSNAME {
public static void Main(string[] args){
var str = "abcdabcdabcdabcd";
Console.Write(checkCyclicString(str));
}
static bool checkCyclicString (string str){
var checkString ="";
for(var i=0;i<str.Length-1;i++){
checkString= checkString+ str[i];
var countOfCycles =0;
var haveCycles = false;
for(var j=i+1;j<str.Length-checkString.Length+1;j= j+checkString.Length){
if(checkString==str.Substring(j,checkString.Length)){
haveCycles = true;
countOfCycles++;
}else{
haveCycles =false;
}
}
if(haveCycles && countOfCycles == Math.Ceiling((double)(str.Length/checkString.Length))-1){
return true;
}
}
return false;
}
}
check the cyclic behavior by creating substrigs and comparing them with all the parts of the given string
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 5 years ago.
Improve this question
Here this is my code I try to send text to the text box but I can't it is not working.
ITestControl PointBuildWin = new UITestControl();
PointBuildWin.TechnologyName = "MSAA";
PointBuildWin.SearchProperties[UITestControl.PropertyNames.ClassName] = "WindowsForms10.Window.8.app.0.378734a";
PointBuildWin.SearchProperties[UITestControl.PropertyNames.FriendlyName] = "XLS80ePSPointUtility";
Thread.Sleep(3000);
WinRadioButton UpgradePointBuildBtn = new WinRadioButton(PointBuildWin);
UpgradePointBuildBtn.SearchProperties[WinRadioButton.PropertyNames.Name] = "Upgrade from earlier version of EBI and XLS80ePS";
Mouse.Click(UpgradePointBuildBtn);
Thread.Sleep(1000);
WinCheckBox PointSpecButton = new WinCheckBox(PointBuildWin);
PointSpecButton.SearchProperties[WinCheckBox.PropertyNames.Name] = "Point name specific";
Mouse.Click(PointSpecButton);
Thread.Sleep(2000);
WinEdit TextInput = new WinEdit(PointBuildWin);
TextInput.SearchProperties[WinEdit.PropertyNames.ClassName] = "WindowsForms10.EDIT.app.0.378734a";
Thread.Sleep(2000);
Mouse.Click(TextInput);
TextInput.SetFocus();
Keyboard.SendKeys(TextInput, "Test");
try
TextInput.DrawHighlight() before Mouse.Click(TextInput) and confirm the search properties are pointing to right control.
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 6 years ago.
Improve this question
I want to get blocked file extension and maximum file size for attachment set by admin in c# code .Below image displays what I actually want using c# code.
Please suggest me answer.
Please use the following code to get any property in the System Settings.
var query = new QueryExpression("organization")
{
ColumnSet = new ColumnSet("blockedattachments", "maxuploadfilesize")
};
EntityCollection orgCollection = _service.RetrieveMultiple(query);
if (orgCollection.Entities.Count > 0)
{
Entity org = orgCollection.Entities.First();
string blockedattachments = org.GetAttributeValue<string>("blockedattachments");
int numberMaxUploadFileSize = org.GetAttributeValue<int>("maxuploadfilesize");
}
Try using below code, it is tested and working fine.
var query = new QueryExpression("organization")
{
ColumnSet = new ColumnSet("blockedattachments", "maxuploadfilesize")
};
var record = service.RetrieveMultiple(query).Entities.FirstOrDefault();
if (record != null)
{
var blockedAttachments = record.GetAttributeValue<string>("blockedattachments");
var maxAttachmentSize = record.GetAttributeValue<int>("maxuploadfilesize");
}
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 7 years ago.
Improve this question
I want to create a new database using c#. I just want to pass database name from user interface and for that database name i want to run a sql script of database for creating the same schema of that script for new database.
I do not have exactly whay you intend to do, but I have done some functionality to seed some default data to the master tables.
//sql file location
private static readonly string IndexScriptSeedMasterDataLocation = "SqlSeedMasterData.sql";
In the function I have :
private static void SeedMasterData ( IpDataContext context, string databaseName)
{
context.Database.CreateIfNotExists();
var sqlContent = Content(IndexScriptSeedMasterDataLocation);
var modifiedSqlScript = sqlContent.Replace("#DatabaseName", databaseName);
context.Database.ExecuteSqlCommand(modifiedSqlScript);
}
// Content function :
private static string Content(string fileLocation)
{
using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(fileLocation))
{
if (stream == null)
{
return string.Empty;
}
var streamReader = new StreamReader(stream);
return streamReader.ReadToEnd();
}
}
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 5 years ago.
Improve this question
Any library in C# that allows me to do that?
google result for http://johndyer.name/post/2005/07/22/Retreiving-the-duration-of-a-WMV-in-C.aspx
using WMPLib; // this file is called Interop.WMPLib.dll
WindowsMediaPlayerClass wmp = new WindowsMediaPlayerClass();
IWMPMedia mediaInfo = wmp.newMedia("myfile.wmv");
// write duration
Console.WriteLine("Duration = " + mediaInfo.duration);
// write named attributes
for (int i=0; i<mediaInfo.attributeCount; i++)
{
Console.WriteLine(mediaInfo.getAttributeName(i) + " = " + mediaInfo.getItemInfo(mediaInfo.getAttributeName(i)) );
}
You can try this Extension method.
using Shell32;
public static class Extension
{
public static string GetLength(this FileInfo info)
{
var shell = new ShellClass();
var folder = shell.NameSpace(info.DirectoryName);
var item = folder.ParseName(info.Name);
return folder.GetDetailsOf(item, 27);
}
}
I hope following code snippet will help you :
using WMPLib;
// ...your code here...
var player = new WindowsMediaPlayer();
var clip = player.newMedia(filePath);
Console.WriteLine(TimeSpan.FromSeconds(clip.duration));
and don't forget to add the reference of wmp.dll which will be
present in System32 folder.