示例#1
0
        public FlowInfo(EditableFlow flow, string path)
        {
            Flow      = flow;
            this.path = path;

            /*foreach (NodeInfo node in Nodes)
             * {
             *  foreach (VariableInfo input in node.Inputs)
             *      if (input.Variable.Linked != null && !Variables.Any(v => v.Variable == input.Variable.Linked))
             *          Variables.Add(VariableInfo.From(this, input.Variable.Linked));
             *
             *  foreach (VariableInfo output in node.Outputs)
             *      if (output.Variable.Linked != null && !Variables.Any(v => v.Variable == output.Variable.Linked))
             *          Variables.Add(VariableInfo.From(this, output.Variable.Linked));
             * }*/
        }
示例#2
0
        public void Open(string path)
        {
            Log.Info("Opening \"{0}\"", path);

            FileInfo fileInfo = new FileInfo(path);

            if (!fileInfo.Exists)
            {
                MessageBox.Show("Could not find specified file " + path, "FlowTomator", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            FlowInfo flowInfo = null;
            string   error    = "";

            try
            {
                EditableFlow flow = EditableFlow.Load(fileInfo.FullName);
                flowInfo = new FlowInfo(flow, fileInfo.FullName);
            }
            catch (Exception e)
            {
                error = e.Message;

                if (System.Diagnostics.Debugger.IsAttached)
                {
                    System.Diagnostics.Debugger.Break();
                }
            }

            if (flowInfo == null || flowInfo.Flow == null)
            {
                MessageBox.Show("Could not open specified file " + path + "." + Environment.NewLine + error, "FlowTomator", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            Flows.Add(flowInfo);
            NotifyPropertyChanged(nameof(Flows));
        }