示例#1
0
        private void initPublishHistory()
        {
            XmlDocument doc  = new XmlDocument();
            var         path = App.LocalRPAStudioDir + @"\Config\RPAStudio.settings";

            doc.Load(path);
            var rootNode = doc.DocumentElement;
            var publishHistoryElement = rootNode.SelectSingleNode("PublishHistory") as XmlElement;
            var lastPublishUriElement = publishHistoryElement.SelectSingleNode("LastPublishUri") as XmlElement;

            CustomLocation = lastPublishUriElement.InnerText;

            var workflowUriHistoryElement = publishHistoryElement.SelectSingleNode("WorkflowUriHistory") as XmlElement;
            var publishUriEntryList       = workflowUriHistoryElement.SelectNodes("PublishUriEntry");

            foreach (XmlElement item in publishUriEntryList)
            {
                var publishUriElement = item.SelectSingleNode("PublishUri") as XmlElement;
                CustomLocations.Add(publishUriElement.InnerText);
            }

            if (string.IsNullOrEmpty(CustomLocation))
            {
                CustomLocation = m_robotPackagesLocation;
            }
        }
示例#2
0
 private void Button_Click_2(object sender, RoutedEventArgs e)
 {
     if (!string.IsNullOrEmpty(SelectedCustomLocation))
     {
         CustomLocations.Remove(SelectedCustomLocation);
     }
 }
        private DictionaryReplacement CreateBuildReplacer()
        {
            var buildReplacer      = new DictionaryReplacement("build");
            var replacerProperties = GetType().GetProperties()
                                     .Where(p => p.GetCustomAttribute <TaskReplacerPropertyAttribute>() != null);

            Log.LogMessage(MessageImportance.Low, "Common replace properties:");
            foreach (var replacerProperty in replacerProperties)
            {
                var value = replacerProperty.GetValue(this) as string;
                if (value != null)
                {
                    buildReplacer.Set(replacerProperty.Name, value);
                    Log.LogMessage(MessageImportance.Low, $"  * {replacerProperty.Name} = {value}");
                }
            }

            if (!string.IsNullOrWhiteSpace(CustomLocations))
            {
                Log.LogMessage(MessageImportance.Low, "  - Custom replace properties:");
                foreach (var customProperty in CustomLocations.Split(';'))
                {
                    var customPropertyParts = customProperty.Split('=');
                    if (customPropertyParts.Length == 2)
                    {
                        buildReplacer.Set(customPropertyParts[0], customPropertyParts[1]);
                        Log.LogMessage(MessageImportance.Low, $"    * {customPropertyParts[0]} = {customPropertyParts[1]}");
                    }
                }
            }
            return(buildReplacer);
        }
示例#4
0
        private void updateSettings(string publishUri)
        {
            XmlDocument doc  = new XmlDocument();
            var         path = App.LocalRPAStudioDir + @"\Config\RPAStudio.settings";

            doc.Load(path);
            var rootNode = doc.DocumentElement;

            var publishHistoryElement = rootNode.SelectSingleNode("PublishHistory") as XmlElement;
            var lastPublishUriElement = publishHistoryElement.SelectSingleNode("LastPublishUri") as XmlElement;

            lastPublishUriElement.InnerText = publishUri;

            bool bFound = false;

            foreach (var item in CustomLocations)
            {
                if (item.ContainsIgnoreCase(publishUri))
                {
                    bFound = true;
                    break;
                }
            }

            if (!bFound)
            {
                CustomLocations.Insert(0, publishUri);
            }


            var workflowUriHistoryElement = publishHistoryElement.SelectSingleNode("WorkflowUriHistory") as XmlElement;

            workflowUriHistoryElement.RemoveAll();

            int count = 0;

            foreach (var item in CustomLocations)
            {
                XmlElement publishUriEntryElement = doc.CreateElement("PublishUriEntry");
                workflowUriHistoryElement.AppendChild(publishUriEntryElement);

                XmlElement publishUriElement = doc.CreateElement("PublishUri");
                publishUriElement.InnerText = item;
                publishUriEntryElement.AppendChild(publishUriElement);

                if (++count >= 10)
                {
                    //限制历史记录最多N条
                    break;
                }
            }

            doc.Save(path);
        }
示例#5
0
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            var dlg = new Dialogs.GetLocationWindow();

            if (dlg.ShowDialog() == true)
            {
                if (dlg.Location != null)
                {
                    CustomLocations.Add(Utils.Conversion.GetCoordinatesPresentation(dlg.Location));
                }
            }
        }