Is it possible to add a locked WorkflowDesigner View to a WPF application? By locked I mean no change or editing whatsoever can be done to the Workflow Model.
Yes by changing the ReadOnlyState
var readOnlyState = _workflowDesigner.Context.Items.GetValue<ReadOnlyState>();
readOnlyState.IsReadOnly = true;
Related
We are managing an umbraco site which has over 2000 nodes .We have recently added a new property in one of our master document type,since it is a new property the existing nodes doesn't have the property value .We have to update the value of that property in each node before deploying the new changes.It is very difficult to update the values manually since it takes a lot of time.What we are planning is to use a one time upgrade aspx page or user control to accomplish this job. has anyone ever been into this kind of a situation ?how to make a one time upgrade page ? Any help would be appreciated .
I fairly sure that this isn't in the core and that there hasn't been a package created for exactly this purpose. But it's pretty simple to create a macro containing a razor (cshtml) script that updates a single property for all the descendants of a particular node:
Something like (just from memory of the Level 2 course):
var nodes = #Model.DescendantsOrSelf(-1); //-1 is the root node
foreach (var node in nodes)
{
Document doc = new Document(node.Id);
doc.getProperty("yourProperty").Value = "xxx"; // the getProperty looks wrong, I know
doc.Publish(new User(0)); //User 0 is the admin user
umbraco.library.UpdateDocumentCache(doc.Id);
}
This great package http://our.umbraco.org/projects/developer-tools/content-maintenance-dashboard-package does mass updating, but last time I checked it didn't update single fields - but it might do by now.
I would have thought doing a republish of the xml cache should do this if you go to the following url:
/umbraco/dialogs/republish.aspx?xml=true
I have a requirement where I need to update system properties (mainly created & modified date) of component / multimedia component. But while creating component I can access only Title property through which I can set name of component, so is there a way to update created and modified date through code as well.
In most of the repositories like Filenet etc system properties are not directly editable but after some configuration changes, system properties are also editable.
In SDL Tridion too after changing configuration file we can make other system properties editable? If yes then where exactly I need to do changes?
Below is the code I'm using to create a component:
core_service.ServiceReference1.SessionAwareCoreService2010Client client =
new SessionAwareCoreService2010Client();
client.ClientCredentials.Windows.ClientCredential.UserName = "myUserName";
client.ClientCredentials.Windows.ClientCredential.Password = "myPassword";
client.Open();
ComponentData component = (ComponentData)client.GetDefaultData(
ItemType.Component, folderUri);
component.Title = targetFileName;
component.ComponentType = ComponentType.Normal;
Please suggest.
If you want to maintain date information between systems where migration is taking place then a good approach would be to add "created" and "modified" date fields as metadata to the items being migrated. You would then need to populate these fields with the appropriate values prior to exporting them from the source repository.
There is no other supported approach that I can think of.
As stated by #Jeremy, these are read only properties. It is very rare that these values will ever be used for something other than providing information for editors.
Perhaps if you can explain you business requirments, someone can provide an alternative solution.
You can't modified and created through core srevice or any interface becuase tridion mainting the version.
you can set the created and revision date but core service will not change date.
What I'm trying to do here is to allow my user to select a path in a data server on a network, so that I could generate a configuration file.
I hope to be able to replicate the function of OpenFileDialog() on my asp.net page. However this function does not exist on asp.net, and I do know that there is this control in asp.net call FileUpload. But what I required here, is just the path/directory for the folder. I do not require my files to be uploaded.
How can it be done?
Doing this in a web application is tricky. You would have to enumerate the folders on the server that you want to browse (presumably this is the same server that's running the web application), and then present that hierarchy to the user to select a folder. If it's not too big a hierarchy, you could just enumerate the whole bunch up front, and display it in a tree. If it's big for that, you could use an Ajax approach: select the top-level folder, then send an Ajax request to get the next level, and so on.
To enumerate the folders, you'll need to walk the filesystem yourself. See http://msdn.microsoft.com/en-us/library/dd997370(v=vs.100).aspx for one way.
No, there is no inbuilt control for this. It is not a normal requirement cause most site don't let their users see their file structures.
Building a user control that does this will be simple though.
I suggest using a TreeView asp.net control, attached to your datasource where you have listed the files.
This sample on binding a treeview should get you started.
You can populate your data using
var path = Server.MapPath("/");
var dirs = Directory.[EnumerateDirectories][2](path);
var files = Directory.[EnumerateFiles][3](path );
Finally to make it look like a dialog, you could use the jQuery UI dialog component.
The solution I have found is, this is just for anyone looking for answer:-
protected void browse_Click(object sender, EventArgs e)
{
Thread thdSyncRead = new Thread(new ThreadStart(openfolder));
thdSyncRead.SetApartmentState(ApartmentState.STA);
thdSyncRead.Start();
}
public void openfolder()
{
FolderBrowserDialog fbd = new FolderBrowserDialog();
DialogResult result = fbd.ShowDialog();
string selectedfolder = fbd.SelectedPath;
string[] files = Directory.GetFiles(fbd.SelectedPath);
System.Windows.Forms.MessageBox.Show("Files found: " + files.Length.ToString(), "Message");
}
The asp.net site is a completely disconnected environment to your server. As other people have mentioned, to replicate an OpenFileDialog() you will need to look at the folder structure and present this to the user in the web/disconnected environment. In this case the user is abstracted from the actual file system... since this abstraction already occurs, it would be a good time to consider the route you're taking. It might be worth considering that a direct replication of the file system is not required, you could manage the "virtual" folder structure in the database with links/paths to files on disk are maintained there?
I've seen way too many times in my event logs this "ContextId" for a given ASP.NET request. I've recently started looking into ETW events that are pushed out by ASP.NET, and want to re-use this ContextID in my own events that I fire.
How can I do this?
System.Threading.Thread.CurrentContext doesn't seem to have it. It's always 0.
This is a poorly documented feature, but yes you can get it.
It sits on the HttpWorkerRequest RequestTraceIdentifier property.
http://msdn.microsoft.com/en-us/library/system.web.httpworkerrequest.requesttraceidentifier.aspx
You can get it from the HttpWorkerRequest.RequestTraceIdentifier property. Note that obviously you need to have the IIS ETW (Event Tracing for Windows) feature enabled or this property will be Guid.Empty. The following is how to get it from HttpContext:
var serviceProvider = (IServiceProvider)HttpContext.Current;
var workerReqest = (HttpWorkerRequest)serviceProvider.GetService(typeof(HttpWorkerRequest));
var requestId = workerReqest.RequestTraceIdentifier;
Reference: https://github.com/serilog/serilog/commit/b289dbcde3e0f7366d90daf66e00c94f4cc58de3#diff-4934d624fc1d467b08411d520972e840R48
We have a set of code that is going to be used in both standalone ASP.NET and SharePoint. I'm wondering if there's any legitimate way to write conditional code in the CS file to detect whether SharePoint is present?
It needs to be able to run in or before OnPreInit, because based on this decision we'll be switching the MasterPageFile attribute, and that needs to be done early in the page lifecycle.
I suppose I can do something like checking for the existence of a "~/layouts" directory, etc. but there must be a better way to do this. And besides, who knows - for compatibility reasons (location of images, etc) we might actually adopt the SharePoint directory structure in the ASP.NET standalone mode.
It's okay to require the Microsoft.SharePoint.DLL even if it goes mostly unused when running standalone.
Thanks!
Since you are allowed to reference Microsoft.SharePoint:
using Microsoft.SharePoint;
// ...
if (SPContext.Current == null)
// Not running in SharePoint
else
// Running in SharePoint
Edit -- alternate approach taking NullReferenceException into consideration:
bool runningInSharePoint = false;
try
{
if (SPContext.Current != null)
runningInSharePoint = true;
}
catch (NullReferenceException e)
{
// SharePoint is not present on the system
}
The above assumes that the exception you mentioned is thrown when accessing SPContext, not earlier.
I wonder if you are better off not including the SharePoint dll in your straight ASP.NET code.
If you partial/sub class the SharePoint bit and include two build targets, you should be able to tack on the extra code needed for SharePoint without turding up your ASP.NET build.