Having problems with the documentmanager upload trying to upload PDF's.
The problem happens when creating or deleting folders. The get create/deleted in the correct location but the refresh/processing image stays, crashing the tool from navigating the folder structure. See screen shot:
There is a Javascript error :
this._clientParameters.get_value is not a function
CODE
FileManagerDialogParameters documentManagerParameters = new FileManagerDialogParameters();
documentManagerParameters.ViewPaths = new string[] { uploadPath };
documentManagerParameters.UploadPaths = new string[] { uploadPath };
documentManagerParameters.DeletePaths = new string[] { uploadPath };
documentManagerParameters.SearchPatterns = pattern;
documentManagerParameters.MaxUploadFileSize = maxFileSize;
if (string.IsNullOrEmpty(dialog))
{
// use a default
dialog = "~/modules/uploadcentre/dialogs/default/";
}
documentManagerParameters["ExternalDialogsPath"] = dialog;
DialogDefinition documentManager = new DialogDefinition(typeof(DocumentManagerDialog), documentManagerParameters)
{
ClientCallbackFunction = "DocumentManagerFunction",
Width = Unit.Pixel(694),
Height = Unit.Pixel(440)
};
DialogOpener1.DialogDefinitions.Add("DocumentManager", documentManager);
Telerik.web.ui version 2011.1.519.40
Thanks in advance
Peter
Please, see the following forum thread which discusses the same JS error:
DocumentManager open with DialogOpener javascript error - http://www.telerik.com/community/forums/aspnet-ajax/editor/documentmanager-open-with-dialogopener-javascript-error.aspx
If you need further help, please open a support ticket from www.telerik.com and send a sample fully working project that demonstrates the problem.
Best regards,
Rumen
http://www.telerik.com/community/forums/aspnet-ajax/editor/document-manage-refreshing-image-stays-on.aspx
Related
Goal: Using an iOS native method, push a user made picture onto their Instagram feed in C#.
public bool ShareImage(byte[] imageByte)
{
bool result = false;
//string fileName = "xxx.png";
//string path = Path.Combine(FileSystem.CacheDirectory, fileName);
//File.WriteAllBytes(path, imageByte);
NSData data = NSData.FromArray(imageByte);
UIImage image = UIImage.LoadFromData(data);
//NSUrl url = NSUrl.FromString($"instagram://library?AssetPath={path}"); // Only opens
NSUrl url = NSUrl.FromString($"instagram://library?LocalIdentifier={1}");
if (UIApplication.SharedApplication.CanOpenUrl(url))
{
UIApplication.SharedApplication.OpenUrl(url);
}
return result;
}
As far as I'm aware the way I have to do this is to save my image to the device and get a Local Identifier for this.
I have constructed this from the snippets of objective-c code I have seen. Sharing photos only works with the native app installed, as I have learnt from my trials to get the facebook module working.
Edit: Using PHAssetChangeRequest from the iOS Photos namespace does not work.
A collegue has pointed out to me about the possibility of saving then using a photo picker to get the PHAsset for the Local Identifier. But this is an extra step I do not want the users of the App to go through. Better to just remove Instagram support as I just can go through the generic share method as shown below. The disadvantage of this method is that the user has then to pick the medium to share over.
public async void ShareImage(byte[] imageByte)
{
string fileName = "xxx.png";
string path = Path.Combine(FileSystem.CacheDirectory, fileName);
File.WriteAllBytes(path, imageByte);
await Share.RequestAsync(
new ShareFileRequest()
{
File = new ShareFile(path),
Title = "xxx"
}
);
}
Edit 2
Tried a different way using UIDocumentInteractionController but it is showing nothing and not posting, it is not throwing any exceptions to give me any clues as to what I'm doing wrong.
public bool ShareImage(byte[] imageByte)
{
bool result = false;
string fileName = "xxx.igo";
string path = Path.Combine(FileSystem.CacheDirectory, fileName);
File.WriteAllBytes(path, imageByte);
//string caption = "xxx";
string uti = "com.instagram.exclusivegram";
UIImageView view = new UIImageView();
//UIDocumentInteractionController controller = UIDocumentInteractionController.FromUrl(NSUrl.FromString(path));
UIDocumentInteractionController controller = new UIDocumentInteractionController
{
//controller.Url = NSUrl.FromString(path);
Url = NSUrl.FromFilename(path),
Uti = uti
};
//CoreGraphics.CGRect viewDimensions = new CoreGraphics.CGRect(0, 0, 200, 100);
_ = controller.PresentOpenInMenu(CoreGraphics.CGRect.Empty, view, true);
//_ = controller.PresentOpenInMenu(viewDimensions, view, true);
return result;
}
Edit 3
Using
UIView view = new UIImageView();
if (UIApplication.SharedApplication.KeyWindow.RootViewController is UIViewController uiController && uiController.View != null)
{
view = uiController.View;
}
I was able to get the possible share options to show. I was logged in to Instagram using the native App, but the post did not show.
Change
Url = NSUrl.FromFilename(path)
to
Url = new NSUrl(path,false)
The second way is pointing to the correct file path not the file name .
Change
controller.PresentOpenInMenu(CoreGraphics.CGRect.Empty, view, true);
to
controller.PresentOptionsMenu(UIScreen.MainScreen.Bounds, (UIApplication.SharedApplication.Delegate as AppDelegate).Window, true);
Show UIDocumentInteractionController inside current Window and set the proper frame.
I am trying to apply "PRINT" UserRight to ProtectionDescriptor but its not opening PDF file content.
Trying to find list of UserRights for MIP SDK. I tried "OWNER", it works. But I do not want to give "OWNER" rights. Any help would be great.
var newRights = new List<UserRights>();
foreach (UserSet userset in options.userSet)
{
newRights.Add(new UserRights(new List<string> { userset.Users }, new List<string> { "PRINT" }));
};
ProtectionDescriptor protectionDescriptor = new ProtectionDescriptor(newRights);
You must also include VIEW. VIEW is the base required right to open the content.
Full rights are here: https://learn.microsoft.com/en-us/azure/information-protection/configure-usage-rights
I am working with FileNet API and I can create document's attachments correctly.
First, I create the document in the CE and later i connect the new pid in the PE.
Here it is the core of my code.
//update mode
parameter.Modified = true;
//Attchment creation
attachment = new peWS.Attachment();
attachment.LibraryType = peWS.LibraryTypeEnum.LIBRARY_TYPE_CONTENT_ENGINE;
attachment.Type = peWS.AttachmentTypeEnum.ATTACHMENT_TYPE_DOCUMENT;
attachment.Id = version_series;
attachment.Version = null;
attachment.Library = obj;
attachment.Name = System.IO.Path.GetFileName(path);
attachment.Description = description;
//value updates
list_values = parameter.Values.ToList();
val.ItemElementName = peWS.ItemChoiceType.attachmentField;
val.Item = attachment;
list_values.Add(val);
parameter.Values = list_values.ToArray();
//save
peWS.UpdateStepRequest updStepRequest = new peWS.UpdateStepRequest();
peWS.UpdateFlagEnum updFlagEnum = peWS.UpdateFlagEnum.UPDATE_SAVE_UNLOCK;
updStepRequest.stepElement = stepElement;
updStepRequest.updateFlag = updFlagEnum;
peWSClient.updateStep(updStepRequest);
It works correctly and if I loop the attachments I can manage them (show, update, delete).
The problem is in the front end tool Navigator: i see the added attachments but the first one is always unreadable.
I can't even click on it because it is enabled by Navigator itself.
It does not seem a code problem, but maybe i am missing some tricky parameter. Could someone help?
I found a solution of the problem that i posted.
It was a Navigator's bug of the version that i was using.
If I update Navigator at the 2.0.2. version it will work just fine.
I'd like to know if it's possible to set/edit a file extended properties (Explorer: Right-click > Properties > Details) using the Windows API Code Pack.
var shellFile = Microsoft.WindowsAPICodePack.Shell.ShellObject.FromParsingName(filePath);
var artistName = shellFile.Properties.GetProperty(SystemProperties.System.Music.DisplayArtist).ValueAsObject.ToString();
var duration = TimeSpan.FromMilliseconds(Convert.ToDouble(shellFile.Properties.GetProperty(SystemProperties.System.Media.Duration).ValueAsObject) * 0.0001);
I use these few lines to get the properties I want, but I don't know how to edit one of them (the artist name for example).
I know I can use taglib-sharp, but I'll use it only if there is no solution without external code.
Thanks you all for taking the time to help me.
I found a way to edit some properties with ShellPropertyWriter but some properties are read-only.
var shellFile = ShellFile.FromParsingName(filePath);
ShellPropertyWriter w = shellFile.Properties.GetPropertyWriter();
try
{
w.WriteProperty(SystemProperties.System.Author, new string[] { "MyTest", "Test" });
w.WriteProperty(SystemProperties.System.Music.Artist, new string[] { "MyTest", "Test" });
w.WriteProperty(SystemProperties.System.Music.DisplayArtist, "Test");
}
catch (Exception ex)
{
}
w.Close();
In this sample, the 2 first occurences of ShellPropertyWriter.WriteProperty() will do exactly the same, edit the "Contributing artists" field of the file (Explorer: Right-click > Properties > Details). The third call will throw an "Access denied" exception.
Some are editable, others are not. Just need to try.
You can write to the ShellFile directly by setting the value of the properties without ShellPropertyWriter:
var shellFile = ShellFile.FromFilePath(filePath);
shellFile.Properties.System.Author.Value = new string[] { "MyTest", "Test" };
shellFile.Properties.System.Music.Artist.Value = new string[] { "MyTest", "Test" };
shellFile.Properties.System.Music.DisplayArtist.Value = "Test";
Just be aware, that to be able to edit codec-specific fields of a file, it's necessary to have the codec installed on the computer.
Hello All I have various web cameras i would like to embed in my site
http://81.137.212.183:4483/GetData.cgi
The problem is at times the cameras go down so i need to check they are active in c# before attempting to render:
<img height="240" width="320" src="http://81.137.212.183:4483/GetData.cgi" />
Please can someone advise how i can check the cgi is active in c# or any other recommendation. If i simple load the cgi and it is down it causes the browser to crash
One recommendation was to use the code below:
The problem with the below approach is the site is forever loading and a fav icon is never shown as can be seen http://www.camsecure.co.uk/
newImage = new Image();
function LoadNewImage() {
var unique = new Date();
document.images.webcam.src = newImage.src;
newImage.src = "http://collectart.dyndns.org:4484/Jpeg/CamImg.jpg?time=" + unique.getTime();
}
function InitialImage() {
var unique = new Date();
newImage.onload = LoadNewImage();
newImage.src = "http://collectart.dyndns.org:4484/Jpeg/CamImg.jpg?time=" + unique.getTime();
document.images.webcam.src = "http://collectart.dyndns.org:4484/Jpeg/CamImg.jpg?time=" + unique.getTime();
document.images.webcam.onload = "";
}
First off, you need to put some security over that first link. It appears the camera settings are public and available to anyone.
If the only problem is the long loading times slowing the rest of the site down, you could load the images in an iframe rather than directly in an image tag -- then the hang is only in the iframe:
<iframe src="http://81.137.212.183:4483/Simple/home.htm?IMG"></iframe>
To check the IP camera is up, you could simply try to get it's host page:
using System.Net.Http;
...
var uri = new Uri("http://81.137.212.183:4483/Simple/index.htm");
var task = new HttpClient().GetAsync(uri);
if (task.Wait(TimeSpan.FromSeconds(1)) && task.Result.IsSuccessStatusCode)
{
// SUCCESS!
}
else
{
// FAILURE... try next camera
}
However, it looks like the image .cgi location can still fail if the camera is available. In that case it would be best to load in an iframe even if you get success.