Exemplo n.º 1
0
        public CommandCanvasList()
        {
            InitializeComponent();
            AssetXML = new _AssetXML <CommandCanvasList>(this);
            ClearPublicExecuteEntryPoint(null);
            Instance = this;

            // Consoleの出力先を変更する
            Console.SetOut(new SystemTextWriter());

            Tab.Items.Clear();
            Dispatcher.BeginInvoke(new Action(() =>
            {
                // アイドル状態になってから新規シートを作成する

                AddNewContents();
                if (reserveLoadCbsFilePath != null)
                {
                    // 起動読み込みをキックする(タイミングが不安…)

                    KickLoadCbsFile();
                }
            }), DispatcherPriority.ApplicationIdle);
        }
Exemplo n.º 2
0
        private object _CallPublicExecuteEntryPoint(object owner, bool fromScript, string entryPointName = null)
        {
            if (!fromScript && CommandCanvasList.GetOwnerCursor() == Cursors.Wait)
            {
                return(null);
            }

            object result = null;

            if (entryPointName != null)
            {
                if (entryPointName.Trim().Length == 0)
                {
                    entryPointName = null;
                }
                else if (PublicExecuteEntryPointList.Where(n => n.function.Invoke(false, ":" + entryPointName) != null).Count() > 1)
                {
                    if (owner != null)
                    {
                        // CommandCanvas から呼ばれた

                        Console.WriteLine(nameof(CommandCanvas) + $": multiple \"{entryPointName}\" entry points!");
                        return(null);
                    }
                    else
                    {
                        // CallEntryPoint から呼ばれた

                        throw new Exception($"multiple \"{entryPointName}\" entry points!");
                    }
                }
            }

            var entryPoints = PublicExecuteEntryPointList.Where(n => n.function != null);

            if (owner != null)
            {
                // オーナー限定

                entryPoints = PublicExecuteEntryPointList.Where(n => n.owner == owner);
            }
            // 1件のみ実行
            if (!entryPoints.Any(n =>
            {
                result = n.function.Invoke(fromScript, entryPointName);
                return(result != null);
            }))
            {
                if (entryPointName != null)
                {
                    var errorMessage = $"\"{entryPointName}\" entry point not found!";
                    if (owner != null)
                    {
                        // CommandCanvas から呼ばれた

                        Console.WriteLine(nameof(CommandCanvas) + $": {errorMessage}");
                    }
                    else
                    {
                        // CallEntryPoint から呼ばれた

                        throw new Exception(errorMessage);
                    }
                }
            }

            return(result);
        }
Exemplo n.º 3
0
 private void Grid_MouseLeave(object sender, MouseEventArgs e)
 {
     CommandCanvasList.SetOwnerCursor(null);
 }
Exemplo n.º 4
0
 private void Grid_MouseEnter(object sender, MouseEventArgs e)
 {
     CommandCanvasList.SetOwnerCursor(Cursors.Hand);
 }