コード例 #1
0
        private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            DataSafe ds = new DataSafe(Paths.SettingsPath, "MainWindow.xml");

            ds.Bools["Maximized"] = this.WindowState == System.Windows.WindowState.Maximized;

            List<string> s = Data.CodeTextFieldItems;
            if (s == null)
                s = new List<string>();
            ds.Ints["CodeTextFieldItemsCount"] = s.Count;
            for (int i = 0; i < s.Count; ++i)
            {
                ds.Strings["CTFI-" + i] = s[i];
            }
        }
コード例 #2
0
        public void SetAxisAndInitGUI(HardwareController hwc, Axis axis)
        {
            HWC = hwc;
            MyAxis = axis;
            Data.AxisName = MyAxis.ControlIdent;

            EnableChange(axis, axis.IsEnable);
            HasFaultChange(axis, axis.HasFault);

            this.Data.AbsPosStr = Axis.SConvertIntToStr(MyAxis.Position, true);
            this.Data.RelPosStr = Axis.SConvertIntToStr(HWC.ConvertCoordinatesAlways(MyAxis.ControlIdent, -MyAxis.Position) * (-1), true);

            //Verbinde Notifyer
            MyAxis.IsEnableChanged += EnableChange;
            MyAxis.HasFaultChange += HasFaultChange;
            MyAxis.PositionChange += PositionChange;
            MyAxis.VelocityChange += VelocityChange;

            //Load Values
            DataSafe ds = new DataSafe(Paths.SettingsPath, "MainWindow");
            Speed = ds.Ints[axis.ControlIdent + "-FR-Speed", 0];
            Distance = ds.Ints[axis.ControlIdent + "-FR-Distance", 0];
            UseDistance = ds.Bools[axis.ControlIdent + "-FR-UseDis", false];
            DisplayFreeRunValues();

            FreeRunThread = new TrackedThread("Free Run Distance Thread: "+ MyAxis, this.FreeRunThreadMethod);
            FreeRunQueue = new Queue<Action>();
            FreeRunThread.Start();
        }
コード例 #3
0
ファイル: FunctionLib.cs プロジェクト: Lowhuhn/LaserControl
        public static void Load()
        {
            if (!Loaded)
            {
                AllCategories.Clear();
                AllFunctions.Clear();

                FunctionCategory AllCat = new FunctionCategory("All Functions");
                //AllCategories.Add(AllCat);

                //1) Lade alle Kategorien!
                DataSafe ds = new Data.DataSafe(Data.Paths.SettingsPath, "Functions");
                int catCount = ds.Ints["Categories", 0];
                for (int i = 0; i < catCount; ++i)
                {
                    string name = ds.Strings["Category-" + i, ""];
                    /*if (string.IsNullOrEmpty(name) || string.IsNullOrWhiteSpace(name))
                    {
                        throw new Exception("Error in Function Categories -> Functions.xml");
                    }*/

                    FunctionCategory category = new FunctionCategory(name );

                    DataSafe catSafe = new DataSafe(Data.Paths.SettingsScriptFunctionsPath, "Category-" + name);
                    int funCount = catSafe.Ints["Functions", 0];
                    for (int f = 0; f < funCount; ++f)
                    {
                        string funName = catSafe.Strings["Function-" + f, ""];
                        AllCat.Functions.Add(funName);
                        category.Functions.Add(funName);

                        //Lade eine Funktion
                        AllFunctions.Add( Function.Load(funName) );

                    }

                    category.Sort();
                    AllCategories.Add(category);
                }

                //AllFunctions.Sort();
                AllCat.Sort();

                AllCategories.Sort();
                AllCategories.Insert(0,AllCat);

                /*
                string code = "$RETURN = 1;if( $i > 1 ){ $RETURN = FAK($i - 1) * $i; }";
                Function fak = new Function("FAK", code, typeof(int));
                fak.AddParameterInt("I");
                AllFunctions.Add(fak);
                */
                Loaded = true;
            }
            else
            {
                Console.WriteLine("All Functions have been loaded before!");
            }
        }
コード例 #4
0
ファイル: FunctionLib.cs プロジェクト: Lowhuhn/LaserControl
 public static void Save()
 {
     DataSafe ds = new Data.DataSafe(Data.Paths.SettingsPath, "Functions");
     ds.Ints["Categories"] = AllCategories.Count-1;
     for (int i = 1; i < AllCategories.Count; ++i)
     {
         FunctionCategory category = AllCategories[i];
         ds.Strings["Category-" + (i-1)] = category.Title.ToUpper();
         DataSafe catSafe = new DataSafe(Data.Paths.SettingsScriptFunctionsPath, "Category-" + category.Title);
         catSafe.Ints["Functions"] = category.Functions.Count;
         for (int f = 0; f < category.Functions.Count; ++f)
         {
             catSafe.Strings["Function-" + f] = category.Functions[f].ToUpper();
             GetFunction(category.Functions[f]).Save();
         }
     }
 }
コード例 #5
0
        protected void LoadValues()
        {
            DataSafe ds = new DataSafe(Paths.SettingsPath, "MainWindow");
            CamMoveXmm = ds.Doubles["CamMoveXmm", 0];
            CamMoveYmm = ds.Doubles["CamMoveYmm", 0];

            ds.Doubles["CamMoveXmm"] = CamMoveXmm;
            ds.Doubles["CamMoveYmm"] = CamMoveYmm;
        }
コード例 #6
0
ファイル: Getter.cs プロジェクト: Lowhuhn/LaserControl
 public DoubleGetter(DataSafe ds)
 {
     this.ds = ds;
 }
コード例 #7
0
 public BoolGetter(DataSafe ds)
 {
     this.ds = ds;
 }
コード例 #8
0
ファイル: Function.cs プロジェクト: Lowhuhn/LaserControl
        public static Function Load(string name)
        {
            name = name.ToUpper();
            DataSafe ds = new DataSafe(Data.Paths.SettingsScriptFunctionsPath, name);

            //Function f = new Function(name, ds.Strings["Code", ""]);
            Type t = typeof(bool);
            int rt = ds.Ints["ReturnType", 0];
            t = Function.IndexToType(rt);
            Function f = new Function(name, ds.Strings["Code", ""], t);
            int pCount = ds.Ints["Parameter", 0];
            for (int i = 0; i < pCount; ++i)
            {
                string pname = ds.Strings["ParamName-" + i, ""];
                f.AddParameter(pname, Function.IndexToType(ds.Ints["ParamType-" + i, 0]));
            }

            return f;
        }
コード例 #9
0
ファイル: Getter.cs プロジェクト: Lowhuhn/LaserControl
 public LongGetter(DataSafe ds)
 {
     this.ds = ds;
 }
コード例 #10
0
ファイル: Getter.cs プロジェクト: Lowhuhn/LaserControl
 public IntGetter(DataSafe ds)
 {
     this.ds = ds;
 }
コード例 #11
0
 public DoubleGetter(DataSafe ds)
 {
     this.ds = ds;
 }
コード例 #12
0
 public IntGetter(DataSafe ds)
 {
     this.ds = ds;
 }
コード例 #13
0
 public StringGetter(DataSafe ds)
 {
     this.ds = ds;
 }
コード例 #14
0
 public LongGetter(DataSafe ds)
 {
     this.ds = ds;
 }
コード例 #15
0
        private void SetSpeedBtn_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                FreeRunSpeed frs = new FreeRunSpeed(Axis.SConvertIntToStr(Speed), Axis.SConvertIntToStr(Distance), UseDistance);
                if (frs.ShowDialog() == true)
                {
                    Speed = Axis.SConvertDoubleString(frs.SpeedStr);
                    Distance = Axis.SConvertDoubleString(frs.DistStr);
                    UseDistance = frs.UseDistVal;
                    //Save Values
                    DataSafe ds = new DataSafe(Paths.SettingsPath, "MainWindow");
                    ds.Ints[MyAxis.ControlIdent + "-FR-Speed"] = Speed;
                    ds.Ints[MyAxis.ControlIdent + "-FR-Distance"] = Distance;
                    ds.Bools[MyAxis.ControlIdent + "-FR-UseDis"] = UseDistance;

                    DisplayFreeRunValues();
                }
            }
            catch
            {

            }
        }
コード例 #16
0
ファイル: Function.cs プロジェクト: Lowhuhn/LaserControl
 public void Save()
 {
     DataSafe ds = new DataSafe(Data.Paths.SettingsScriptFunctionsPath, this.FunctionName);
     ds.Ints["ReturnType"] = Function.TypeToIndex(this.ReturnType);
     ds.Strings["Code"] = this.Code;
     ds.Ints["Parameter"] = ParameterCount;
     for (int i = 0; i < ParameterCount; ++i)
     {
         ds.Strings["ParamName-" + i] = ParameterNames[i];
         ds.Ints["ParamType-" + i] = Function.TypeToIndex(ParameterTypes[i]);
     }
 }
コード例 #17
0
ファイル: Getter.cs プロジェクト: Lowhuhn/LaserControl
 public StringGetter(DataSafe ds)
 {
     this.ds = ds;
 }
コード例 #18
0
 public LoadingWindow( DataSafe ds)
 {
     InitializeComponent();
     MWDS = ds;
 }
コード例 #19
0
ファイル: Getter.cs プロジェクト: Lowhuhn/LaserControl
 public BoolGetter(DataSafe ds)
 {
     this.ds = ds;
 }