Esempio n. 1
0
        bool canvas_checkNodes(object sender, MouseEventArgs e)
        {
            AppNode hitNode = GetAppNodeInCanvas(e.Location);

            // [要修正] ノードを消す
            if (e.Button == System.Windows.Forms.MouseButtons.Right)
            {
                if (hitNode != null)
                {
                    editingNode = null;
                    processComboBox.Hide();
                    appGraph.edges.RemoveAll(edge => edge.Src == hitNode || edge.Dst == hitNode);
                    appGraph.nodes.Remove(hitNode);
                    return(true);
                }
            }

            // コンボボックスが出てないときにノードをクリックしたら
            if (processComboBox.Visible == false && hitNode != null)
            {
                editingNode = hitNode;
                processComboBox.Location = new Point(e.X - processComboBox.Width, e.Y);
                processComboBox.Show();
                return(true);
            }
            // コンボボックスを隠す
            editingNode = null;
            processComboBox.Hide();
            return(false);
        }
Esempio n. 2
0
            private void AddChild(Application app, AppPath appPath, int pathIndex)
            {
                if (pathIndex < 0)
                {
                    return;
                }
                var name        = appPath.Indices[pathIndex];
                var appNodeType = appPath.AppNodeTypes[pathIndex];

                if (pathIndex < appPath.Indices.Length - 1)
                {
                    AppNode child = null;
                    foreach (var pathChild in this.Children)
                    {
                        if (pathChild.Name == name && pathChild.AppNodeType == appNodeType)
                        {
                            child = (AppNode)pathChild;
                            break;
                        }
                    }
                    var nextIndex = appPath.GetNextIndex(pathIndex);
                    if (child == null)
                    {
                        child = new AppNode(name, appNodeType, this);
                    }
                    child.AddChild(app, appPath, nextIndex);
                }
                else
                {
                    var child = new AppNode(name, appNodeType, this, app);
                }
            }
Esempio n. 3
0
        bool canvas_SetEdgePositions(object sender, MouseEventArgs e)
        {
            AppNode hitNode = GetAppNodeInCanvas(e.Location);

            if (hitNode != null)
            {
                if (appendingEdge == null)
                {
                    appendingEdge     = new AppEdge();
                    appendingEdge.Src = hitNode;
                }
                else
                {
                    appendingEdge.Dst = hitNode;
                    appendingEdge.ActionHandler.TriggerType     = TriggerType.ContextMenu;
                    appendingEdge.ActionHandler.ContextMenuText = "to " + appendingEdge.Dst.ProcessName;
                    appGraph.edges.Add(appendingEdge);
                    ShowEdgeDetail(appendingEdge);
                    appendingEdge = null;
                    canvas.Invalidate();
                }
                return(true);
            }
            else
            {
                appendingEdge = null;
                canvas.Invalidate();
            }
            return(false);
        }
        private void GetApplicationsInType(AppNode typeNode, AppPath appPath, string scenario, string[] device, Dictionary<int, Application> allApps)
        {
            foreach (var child in typeNode.Children)
            {
                if (child.AppNodeType == AppNodeType.Action)
                {
                    var search = true;
                    Application existingApp;
                    if (allApps.TryGetValue(child.Name, out existingApp))
                        if (existingApp.Clear || !existingApp.IsOverride)
                            search = false;

                    if (search)
                    {
                        // deepest device
                        var lastDeviceNode = SearchLastNode(child, appPath, appPath.ActionIndex + 1, true);
                        var app = SearchAppInAction(lastDeviceNode, appPath, scenario);
                        if (app != null)
                        {
                            if (existingApp == null)
                            {
                                allApps.Add(child.Name, app);
                            }
                            else
                            {
                                app = Override(app, existingApp);
                                allApps[child.Name] = app;
                            }
                        }
                    }
                }
            }
        }
Esempio n. 5
0
        private void canvas_MouseClick(object sender, MouseEventArgs e)
        {
            // コンボボックスを隠す
            editingNode = null;
            processComboBox.Hide();

            // 1クリック1アクション
            if (appendingNode != null)
            {
                appendingNode.Position = e.Location;
                appGraph.nodes.Add(appendingNode);
                appendingNode = null;
                canvas.Invalidate();
                return;
            }
            if (e.Button == System.Windows.Forms.MouseButtons.Left)
            {
                canvas_MouseLeftClick(sender, e);
                return;
            }
            if (e.Button == System.Windows.Forms.MouseButtons.Right)
            {
                canvas_MouseRightClick(sender, e);
                return;
            }
        }
        private List<Application> GetApplicationsByScenario(AppNode lastNode, AppPath appPath, string scenarioName, string[] device)
        {
            // resolve all applications filtered by scenario
            var apps = new Dictionary<int, Application>();

            while (lastNode != null)
            {
                if (lastNode.AppNodeType == AppNodeType.Type)
                {
                    GetApplicationsInType(lastNode, appPath, scenarioName, device, apps);
                }

                // parent typelevel or pathlevel
                if (lastNode.Name == PathSegmentThisIndex)
                    lastNode = SearchLastNode(lastNode.Parent, appPath, appPath.TypeIndex, false);
                else if (lastNode.AppNodeType == AppNodeType.Type)
                    lastNode = SearchLastNode(lastNode.Parent, appPath, appPath.ActionIndex, true);
                else
                    lastNode = SearchLastNode(lastNode.Parent, appPath, appPath.TypeIndex, true);
            }
            var result = apps.Values.ToList();
            for (int i = result.Count - 1; i >= 0; i--)
                if (result[i].Clear || result[i].IsOverride)
                    result.RemoveAt(i);

            result.Sort(new ApplicationComparer());
            return result;
        }
Esempio n. 7
0
        // ノードの移動
        private void canvas_MouseRightClick(object sender, MouseEventArgs e)
        {
            if (movingNode != null)
            {
                movingNode = null;
                return;
            }

            AppNode hitNode = null;

            // 各ノードと当たり判定
            for (int i = 0; i < appGraph.nodes.Count; i++)
            {
                AppNode   node = appGraph.nodes[i];
                Rectangle rect = new Rectangle(node.Position, nodeSize);
                if (rect.Contains(e.Location))
                {
                    hitNode = node;
                    break;
                }
            }

            if (hitNode != null)
            {
                movingNode = hitNode;
            }
        }
Esempio n. 8
0
        // p1, p2は中心から中心
        // p3, p4はトリミング後
        void EdgePoints(AppNode src, AppNode dst, out Point p1, out Point p2, out Point p3, out Point p4)
        {
            p1 = new Point(
                src.Position.X + nodeSize.Width / 2,
                src.Position.Y + nodeSize.Height / 2);
            p2 = new Point(
                dst.Position.X + nodeSize.Width / 2,
                dst.Position.Y + nodeSize.Height / 2);

            p3 = p1;
            p4 = p2;
            float dx = p2.X - p1.X;
            float dy = p2.Y - p1.Y;

            if (dx * dx + dy * dy <= 0.0001)
            {
                return;
            }
            float dl = (float)Math.Sqrt(dx * dx + dy * dy);
            float nx = dx / dl;
            float ny = dy / dl;
            float l  = nodeSize.Width / 2;

            p3    = p1;
            p3.X += (int)(nx * l);
            p3.Y += (int)(ny * l);

            p4    = p2;
            p4.X -= (int)(nx * l);
            p4.Y -= (int)(ny * l);
        }
Esempio n. 9
0
 private void newNToolStripMenuItem_Click(object sender, EventArgs e)
 {
     appGraph = new AppGraph();
     canvas.Invalidate();
     ClearEdgeDetail();
     editingEdge = appendingEdge = null;
     editingNode = appendingNode = null;
 }
Esempio n. 10
0
        private AppNode SearchLastNode(AppNode appNode, AppPath appPath, int pathIndex, bool thisEnabled)
        {
            if (appNode == null)
            {
                return(null);
            }

            if (pathIndex >= appPath.Indices.Length)
            {
                return(appNode);
            }

            if (!appPath.Truncated && pathIndex == appPath.TypeIndex && appNode.Level == pathIndex - 1 && thisEnabled)
            {
                foreach (var child in appNode.Children)
                {
                    if (child.Name == PathSegmentThisIndex)
                    {
                        if (appPath.Indices[appPath.ActionIndex] < 0)
                        {
                            return(child);
                        }
                        var thisNode = child;
                        var last     = SearchLastNode(thisNode, appPath, appPath.ActionIndex, thisEnabled);
                        if (last != null)
                        {
                            return(last);
                        }
                    }
                }
            }

            var name        = appPath.Indices[pathIndex];
            var appNodeType = appPath.AppNodeTypes[pathIndex];

            if (name < 0)
            {
                return(appNode);
            }

            foreach (var child in appNode.Children)
            {
                if (child.Name == name && child.AppNodeType == appNodeType)
                {
                    return(SearchLastNode(child, appPath, pathIndex + 1, thisEnabled));
                }
            }

            if (pathIndex < appPath.TypeIndex)
            {
                return(SearchLastNode(appNode, appPath, appPath.TypeIndex, thisEnabled));
            }
            if (pathIndex < appPath.ActionIndex)
            {
                return(SearchLastNode(appNode, appPath, appPath.ActionIndex, thisEnabled));
            }
            return(appNode);
        }
Esempio n. 11
0
        /// <summary>
        /// 导入 JSON 文件,生成 Treeview 节点
        /// </summary>
        /// <param name="app"></param>
        /// <param name="tvwAppdata"></param>
        public static AppNode ImportNode(KNXApp app /*, TreeView tv, UIEditor.Entity.ViewNode.PropertiesChangedDelegate proChangedDelegate*/)
        {
            AppNode appNode = null;

            if (app != null)
            {
                //tvwAppdata.BeginUpdate();
                //tvwAppdata.Nodes.Clear();

                appNode = new AppNode(app);

                //tvwAppdata.Nodes.Add(appNode);

                if (app.Areas != null && app.Areas.Count > 0)
                {
                    foreach (KNXArea itemArea in app.Areas)
                    {
                        var areaNode = new AreaNode(itemArea);
                        appNode.Nodes.Add(areaNode);

                        if (itemArea.Rooms != null && itemArea.Rooms.Count > 0)
                        {
                            foreach (KNXRoom itemRoom in itemArea.Rooms)
                            {
                                var roomNode = new RoomNode(itemRoom);
                                areaNode.Nodes.Add(roomNode);

                                if (itemRoom.Pages != null && itemRoom.Pages.Count > 0)
                                {
                                    foreach (KNXPage itemPage in itemRoom.Pages)
                                    {
                                        var pageNode = new PageNode(itemPage);
                                        //pageNode.PropertiesChangedEvent += proChangedDelegate;
                                        roomNode.Nodes.Add(pageNode);

                                        // 给页面添加控件
                                        if (itemPage.Controls != null && itemPage.Controls.Count > 0)
                                        {
                                            foreach (var item in itemPage.Controls)
                                            {
                                                AddControlNode(pageNode, item /*, proChangedDelegate*/);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }

                //tvwAppdata.EndUpdate();
            }

            return(appNode);
        }
Esempio n. 12
0
        AppNode GetAppNodeInCanvas(Point pos)
        {
            AppNode hitNode = null;

            // 各ノードと当たり判定
            for (int i = 0; i < appGraph.nodes.Count; i++)
            {
                AppNode   node = appGraph.nodes[i];
                Rectangle rect = new Rectangle(node.Position, nodeSize);
                if (rect.Contains(pos))
                {
                    hitNode = node;
                    break;
                }
            }
            return(hitNode);
        }
Esempio n. 13
0
 string NodeTitle(AppNode appNode)
 {
     try
     {
         if (appNode.Any)
         {
             return("Any");
         }
         Process p = appNode.Process;
         return(p.MainWindowTitle);
     }
     catch (Exception ee)
     {
         Console.WriteLine(ee);
     }
     return("");
 }
Esempio n. 14
0
        private static IList <AppNode> GetNodeChildren(this YamlNode yamlParent, AppNode appParent)
        {
            var nodes = new List <AppNode>();

            switch (yamlParent)
            {
            case YamlMappingNode map:
                foreach (var mapNode in map)
                {
                    var mNode = new AppNode
                    {
                        Name   = mapNode.Key.ToString(),
                        Parent = appParent,
                    };

                    mNode.Children = GetNodeChildren(mapNode.Value, mNode);
                    nodes.Add(mNode);
                }
                break;

            case YamlSequenceNode seq:
                foreach (var seqNode in seq)
                {
                    var ssNode = new AppNode
                    {
                        Name   = seqNode.ToString(),
                        Parent = appParent,
                    };

                    ssNode.Children = GetNodeChildren(seqNode, ssNode);
                    nodes.Add(ssNode);
                }
                break;

            case YamlScalarNode scalar:
                //var scNode = new AppNode
                //{
                //    Name = scalar.Value,
                //    Parent = appParent,
                //};
                //appParent.Children.Add(scNode);
                break;
            }

            return(nodes);
        }
Esempio n. 15
0
 public AppNode(int name, AppNodeType type, AppNode parent, Application app)
 {
     Name        = name;
     AppNodeType = type;
     Application = app;
     Children    = new List <AppNode>();
     Parent      = parent;
     if (parent != null)
     {
         Parent.Children.Add(this);
         Level = Parent.Level + 1;
     }
     if (app != null)
     {
         Disabled = app.Disabled;
         var list = app.ScenarioList;
         _scenarioList = list.Count > 0 ? list : null;
     }
 }
Esempio n. 16
0
        private Application SearchAppInAction(AppNode appNodeInAction, AppPath appPath, string scenario)
        {
            var         ovrList   = new List <Application>();
            Application resultApp = null;

            var appNode = appNodeInAction;

            while (appNode.AppNodeType != AppNodeType.Type)
            {
                var app = appNode.Application;
                if (app != null)
                {
                    if (app.Clear)
                    {
                        return(app);
                    }

                    if (String.IsNullOrEmpty(scenario) || appNode.HasScenario(scenario))
                    {
                        if (!appNode.Disabled && (app.Security.HasPermission(PermissionType.Open) || app.Security.HasPermission(PermissionType.RunApplication)))
                        {
                            if (app.IsOverride)
                            {
                                if (resultApp != null)
                                {
                                    app = Override(app, resultApp); // app.Override = resultApp;
                                }
                                resultApp = app;
                            }
                            else
                            {
                                resultApp = app;
                                break;
                            }
                        }
                    }
                }
                appNode = appNode.Parent;
            }
            return(resultApp);
        }
Esempio n. 17
0
        //--------------------------------------------------
        // アプリケーションリストへの操作
        //--------------------------------------------------

        private void appListView_Click(object sender, EventArgs e)
        {
            if (appListView.SelectedItems.Count >= 1)
            {
                var item = appListView.SelectedItems[0];

                if (appendingNode != null && appendingNode.ProcessName == item.Text)
                {
                    // トグル
                    appendingNode = null;
                    return;
                }

                var imgKey = appListView.LargeImageList.Images.Keys[item.Index];
                var img    = appListView.LargeImageList.Images[item.Index];
                appendingNode = new AppNode()
                {
                    ProcessName = item.Text,
                    Path        = imgKey,
                    Icon        = img
                };
            }
        }
Esempio n. 18
0
 private void SetProjectOutline(AppNode node)
 {
     this.ucdo.SetOutlineNode(node);
     this.ucdo.Title = ResourceMng.GetString("DocumentOutline") + "-" + node.Text;
 }
Esempio n. 19
0
        private List <Application> GetApplicationsByAppName(AppNode lastNode, AppPath appPath)
        {
            // resolve one application
            Application app = null;
            Application ovr = null;

            while (lastNode != null)
            {
                if (lastNode.AppNodeType == AppNodeType.Action || lastNode.AppNodeType == AppNodeType.Device)
                {
                    app = SearchAppInAction(lastNode, appPath, null);
                    if (app != null)
                    {
                        if (app.Clear)
                        {
                            app = null;
                            break;
                        }
                        if (app.IsOverride)
                        {
                            if (ovr != null)
                            {
                                app = Override(app, ovr);// app.Override = ovr;
                            }
                            ovr      = app;
                            app      = null;
                            lastNode = lastNode.Parent;
                        }
                    }
                    else
                    {
                        while (lastNode.AppNodeType != AppNodeType.Type)
                        {
                            lastNode = lastNode.Parent;
                        }
                    }
                }
                if (app == null)
                {
                    // parent typelevel or pathlevel
                    if (lastNode.Name == PathSegmentThisIndex)
                    {
                        lastNode = SearchLastNode(lastNode.Parent, appPath, appPath.TypeIndex, false);
                    }
                    else if (lastNode.AppNodeType == AppNodeType.Type)
                    {
                        lastNode = SearchLastNode(lastNode.Parent, appPath, appPath.ActionIndex, true);
                    }
                    else if (lastNode.AppNodeType == AppNodeType.Path)
                    {
                        lastNode = SearchLastNode(lastNode.Parent, appPath, appPath.TypeIndex, true);
                    }
                    else
                    {
                        throw new SnNotSupportedException("@@@@");
                    }
                }
                else
                {
                    break;
                }
            }
            if (app == null)
            {
                return(new List <Application>());
            }
            if (ovr != null)
            {
                app = Override(app, ovr); // app.Override = ovr;
            }
            return(new List <Application>(new[] { app }));
        }
Esempio n. 20
0
        private void canvas_Paint(object sender, PaintEventArgs e)
        {
            Graphics g = e.Graphics;

            g.Clear(Color.White);

            // 頂点の描画
            if (appGraph != null)
            {
                // appGraph, appendingNodeの描画
                for (int i = 0; i < appGraph.nodes.Count; i++)
                {
                    AppNode node = appGraph.nodes[i];
                    g.DrawImage(node.Icon, new Rectangle(node.Position, nodeSize));
                    try
                    {
                        if (node.Process != null)
                        {
                            string text = NodeTitle(node);
                            if (text.Length >= AppNodeTitleCharLimit)
                            {
                                text = text.Remove(AppNodeTitleCharLimit - 4) + "...";
                            }
                            SizeF textSize = g.MeasureString(text, fnt);
                            float textX    = node.Position.X + nodeSize.Width / 2 - textSize.Width / 2;
                            float textY    = node.Position.Y + nodeSize.Height;
                            g.DrawString(text, fnt, Brushes.Black, new PointF(textX, textY));
                        }
                    }
                    catch (Exception ee)
                    {
                        Console.WriteLine(ee);
                    }
                }
            }

            if (appendingNode != null)
            {
                g.DrawImage(appendingNode.Icon, new Rectangle(appendingNode.Position, nodeSize));
            }

            // 枝の描画
            if (appGraph != null)
            {
                for (int i = 0; i < appGraph.edges.Count; i++)
                {
                    AppEdge edge = appGraph.edges[i];
                    Point   p1, p2, p3, p4;
                    EdgePoints(edge.Src, edge.Dst, out p1, out p2, out p3, out p4);

                    if (edge.Src != edge.Dst)
                    {
                        g.DrawLine(edgePen, p3, p4);
                    }
                    else
                    {
                        g.DrawArc(edgePen, new Rectangle(p1.X, p1.Y - 64, 64, 64), 90, -270);
                    }
                    // TODO
                    string text = "";
                    if (edge.ActionHandler.TriggerType == TriggerType.ContextMenu)
                    {
                        text = "\"" + edge.ActionHandler.ContextMenuText + "\"";
                    }
                    else
                    {
                        text += edge.ActionHandler.Ctrl ? "Ctrl + " : "";
                        text += edge.ActionHandler.Win ? "Ctrl + " : "";
                        text += edge.ActionHandler.Fn ? "Fn + " : "";
                        text += edge.ActionHandler.Shift ? "Sfhift + " : "";
                        text += edge.ActionHandler.Alt ? "Alt + " : "";
                        text += edge.ActionHandler.Key;
                    }
                    g.DrawString(text, fnt, Brushes.Black, new PointF((p1.X + p4.X) / 2, (p1.Y + p4.Y) / 2));
                }
            }

            if (appendingEdge != null)
            {
                Point srcPos = new Point(
                    appendingEdge.Src.Position.X + nodeSize.Width / 2,
                    appendingEdge.Src.Position.Y + nodeSize.Height / 2);
                Point dstPos = canvas.PointToClient(Cursor.Position);
                g.DrawLine(edgePen, srcPos, dstPos);
            }
        }
Esempio n. 21
0
        private static AppNode LoadApps(out List <string> appNames, out List <Application> appList, out List <string> scenarioNames)
        {
            using (new SystemAccount())
            {
                //var result = nq.Execute();
                var result = ContentQuery.Query(SafeQueries.TypeIs, QuerySettings.AdminSettings, typeof(Application).Name);
                appList = result.Nodes.Cast <Application>().ToList();
                appList.Sort((xa, ya) => xa.Path.CompareTo(ya.Path));
            }

            PathSegments = new List <string>();
            PathSegments.Add("root");
            PathSegments.Add("this");
            PathSegmentThisIndex = 1;
            var root = new AppNode(0, AppNodeType.Path, null);

            appNames      = new List <string>();
            scenarioNames = new List <string>();

            foreach (var node in appList)
            {
                // store scenario names
                foreach (var scenario in node.ScenarioList)
                {
                    if (!scenarioNames.Contains(scenario))
                    {
                        scenarioNames.Add(scenario);
                    }
                }

                root.AddChild(node);
                var appName = node.AppName;

                // ------------PATCH START: set AppName property if null (compatibility reason));
                if (string.IsNullOrEmpty(appName))
                {
                    var originalUser = AccessProvider.Current.GetCurrentUser();

                    try
                    {
                        // We can save content only with the Administrator at this point,
                        // because there is a possibility that the original user is the
                        // STARTUP user that cannot be used to save any content.
                        AccessProvider.Current.SetCurrentUser(User.Administrator);

                        node.Save(SavingMode.KeepVersion);
                        appName = node.AppName;
                    }
                    finally
                    {
                        AccessProvider.Current.SetCurrentUser(originalUser);
                    }
                }
                // ------------PATCH END

                if (!string.IsNullOrEmpty(appName) && !appNames.Contains(appName))
                {
                    appNames.Add(appName);
                }
            }

            scenarioNames.Sort();
            appList.Sort(new ApplicationComparer());

            return(root);
        }
Esempio n. 22
0
 public AppNode(int name, AppNodeType type, AppNode parent) : this(name, type, parent, null)
 {
 }
Esempio n. 23
0
        private void OpenKnxUiPrject()
        {
            Cursor = Cursors.WaitCursor;

            if (Saved == false)
            {
                var result = MessageBox.Show(ResourceMng.GetString("Message7"), ResourceMng.GetString("Message4"), MessageBoxButtons.YesNoCancel,
                                             MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);

                if (DialogResult.Yes == result)
                {
                    SaveKnxUiProject(ProjectFile);
                    Cursor = Cursors.Default;
                    return;
                }
                else if (DialogResult.No == result)
                {
                }
                else if (DialogResult.Cancel == result)
                {
                    Cursor = Cursors.Default;
                    return;
                }
            }

            try
            {
                using (var ofd = new OpenFileDialog())
                {
                    ofd.InitialDirectory = MyCache.DefaultKnxProjectFolder;
                    ofd.Filter           = KnxFilter;
                    ofd.FilterIndex      = 1;
                    ofd.DefaultExt       = MyConst.KnxUiEditorFileExt;
                    ofd.RestoreDirectory = true;

                    if (ofd.ShowDialog(this) == DialogResult.OK)
                    {
                        // 新建项目文件夹
                        CreateProjectFolder();
                        var projectFile = ofd.FileName;
                        Debug.WriteLine(projectFile);
                        Debug.WriteLine(MyCache.ProjectFolder);

                        ZipHelper.UnZipDir(projectFile, MyCache.ProjectFolder, MyConst.MyKey);

                        var app = AppStorage.Load();

                        if (app != null)
                        {
                            // 导入所有节点
                            AppNode appNode = FrmMainHelp.ImportNode(app);
                            SetProjectOutline(appNode);

                            ProjectFile = ofd.FileName;
                            ShowProjectFile(ProjectFile);

                            //
                            //ToolBarStatus status = new ToolBarStatus { collapse = true, expand = true, searchBox = true, importKnx = true };
                            //SetButtonStatus(status);
                            SetToolStripButtonStatus(false);
                            SetToolStripButtonKNXAddrStatus(true);
                            SetToolStripButtonSaveStatus(true);

                            ResetParameter();
                            CreateCommandManager();
                            CloseAllTabPages();

                            Saved = true;
                        }
                        else
                        {
                            throw new ApplicationException(ResourceMng.GetString("Message8"));
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                string errorMsg = ResourceMng.GetString("Message8");
                MessageBox.Show(errorMsg, ResourceMng.GetString("Message6"), MessageBoxButtons.OK, MessageBoxIcon.Error);
                Log.Error(errorMsg + LogHelper.Format(ex));
            }
            finally
            {
                Cursor = Cursors.Default;
            }
        }