Esempio n. 1
0
        /// <summary>
        /// Parses the Movie specific data from the input string.
        /// </summary>
        /// <param name="input">Input string</param>
        /// <param name="dir">Switch whenever it is a directory name.</param>
        private void ParseMovie(String input, Boolean dir = false)
        {
            mediaKind = EMP.MediaKind.Movie;
            String inputCl = helperDictionary.CleanFileName(input);
            Int32 TmpStart;
            String TmpString;
            #region year
            //A little regex for recognizing the year
            Regex rgx = new Regex(@"((19|20)\d{2})");

            if (rgx.IsMatch(input))
            {
                if (year == 0)
                {
                    Match match = rgx.Matches(inputCl)[rgx.Matches(input).Count - 1];
                    TmpString = match.ToString();
                    if (match.Length > 0)
                        Index.Add(new StringLocation(TmpString, match.Index, match.Length, true, dir));
                    Int32.TryParse(TmpString, out year);
                }
            }
            #endregion
            #region cut
            if (cut == Cut.Final)
            {
                TmpString = Check(inputCl, helperDictionary.CutStrings, out TmpStart);
                cut = helperDictionary.StrToCut(TmpString);
                if (TmpString.Length > 0)
                    Index.Add(new StringLocation(TmpString, TmpStart, TmpString.Length, true, dir));
            }
            #endregion
            #region IMDBid
            if (imdbid == String.Empty || imdbid == null)
            {
                // Here we call Regex.Match.
                Match match = Regex.Match(input, @"tt[0-9]{7}",
                    RegexOptions.IgnoreCase);

                // Here we check the Match instance.
                if (match.Success)
                {
                    // Finally, we get the Group value and display it.
                    imdbid = match.Value;
                    Index.Add(new StringLocation(match.Value, match.Index, match.Length, false, dir));
                }
            }
            #endregion
        }
Esempio n. 2
0
 protected virtual Cut LoadMethodArgument(Cut pc, AdviceArgument parameter)
 {
     return(pc.MethodOf(_target).Cast(StandardTypes.Object, WellKnownTypes.MethodBase));
 }
 protected override Cut LoadReturnValueArgument(Cut pc, AdviceArgument parameter)
 {
     return(pc.This());
 }
Esempio n. 4
0
        public void Cut()
        {
            PrinterServiceFunction f = new Cut(this);

            f.RunFunction();
        }
Esempio n. 5
0
 protected virtual Cut LoadReturnValueArgument(Cut pc, AdviceArgument parameter)
 {
     return(pc.Null());
 }
Esempio n. 6
0
 public Cut AssignNullAndReturn(Cut c)
 {
     c = null;
     return c;
 }
Esempio n. 7
0
        protected override Cut LoadTargetArgument(Cut pc, AdviceArgument parameter)
        {
            var targetMethod = _wrapper.MakeCallReference(GetOrCreateUnwrapper().MakeHostInstanceGeneric(_target.DeclaringType));

            return(pc.ThisOrNull().Call(_funcCtor, args => args.Delegate(targetMethod)));
        }
Esempio n. 8
0
        public override void UpdateCoeff()
        {
            base.UpdateCoeff();
            //a questo punto vorrei arrivare ad avere

            //devo capire quale tipo quantità usare e che moltiplicatore usare!!!!
            //lo devo salvare in una proprietà del dettaglio costo

            double gain = 1;

            if (ProductPart != null)
            {


                var x = Cuts;

                Cut currentCut = new Cut("manuale", 1, 1);

                foreach (var item in Cuts)
                {
                    var res = item.GetCuttedFormat(BuyingFormat,false);
                    if (res == WorkingFormat)
                    {
                        gain = item.Gain;
                        currentCut = item;
                    }
                }

                Console.WriteLine(Cuts);

                double gainSide1 = 1;
                double gainSide2 = 1;
                double gainForRun = 1;

                double dCut1 = 0, dCut2 = 0;
                string format = "1x1";

                if (Printers != null)
                {
                    foreach (var fromP in this.Printers)
                    {
                        //                    Starts = fromP.GainOnSide1;
                        gainForRun *= fromP.GainForRunForPrintableArticle ?? 1;
                        gainSide1 *= fromP.ProductPartPrinting.CalculatedSide1Gain;
                        gainSide2 *= fromP.ProductPartPrinting.CalculatedSide2Gain;

                        dCut1 = fromP.ProductPartPrinting.CalculatedDCut1;
                        dCut2 = fromP.ProductPartPrinting.CalculatedDCut2;

                        format = fromP.ProductPart.Format;
                    }
                }

                gainSide1 = gainSide1 / currentCut.PartsOnSide1;
                gainSide2 = gainSide2 / currentCut.PartsOnSide2;

                if (this.TaskCost.ProductPartTask.CodOptionTypeOfTask.Contains("TAGLIO"))
                {
                    //nuber of cuts
                    double cuts = 0;
                    cuts += dCut1 == 0 ? gainSide1 + 1 : gainSide1 * 2;
                    cuts += dCut2 == 0 ? gainSide2 + 1 : gainSide2 * 2;

                    if (cuts != 0)
                    {
                        gain = 1 / cuts;
                    }
                    else
                    {
                        gain = 1;
                    }
                }

            }
            else
            {
                Console.WriteLine();
            }

            TypeOfQuantity = Convert.ToInt16(QuantityType.RunTypeOfQuantity);  //TaskexEcutorSelected.TypeOfImplantQuantity;

            GainForRun = gain;

            //            _calculateMqImplant = side1 * side2 / 10000;

            //calcolo di quanti impianti sono necessari!!!!
            //    Implants = TaskexEcutorSelected.GetImplants(TaskCost.ProductPartTask.CodOptionTypeOfTask);
            //   Starts = TaskexEcutorSelected.GetStarts(TaskCost.ProductPartTask.CodOptionTypeOfTask);
            //            GainForRun = Starts * gainForRun / gain;


        }
Esempio n. 9
0
        private void Cut(object sender, EventArgs e)
        {
            Cut cut = new Cut();

            cut.Execute(textEditorControl);
        }
Esempio n. 10
0
 public static Cut LoadAspect(this Cut cut, AspectDefinition aspect)
 {
     return(LoadAspect(cut, aspect, cut.Method, c => c.ThisOrStatic()));
 }
Esempio n. 11
0
        private static FieldReference GetInstanceAspectField(AspectDefinition aspect, TypeDefinition source, Cut cut)
        {
            var type = source;

            var fieldName = $"{Constants.AspectInstanceFieldPrefix}{aspect.Host.FullName}";

            var field = FindField(type, fieldName);

            if (field == null)
            {
                field = new FieldDefinition(fieldName, FieldAttributes.Family, cut.Import(aspect.Host));
                type.Fields.Add(field);

                var fieldRef = field.MakeReference(type.MakeSelfReference());

                InjectInitialization(GetInstanсeAspectsInitializer(type, cut), fieldRef, c => c.CreateAspectInstance(aspect));
            }

            return(field.MakeReference(type.MakeSelfReference()));
        }
Esempio n. 12
0
        private static MethodDefinition GetInstanсeAspectsInitializer(TypeDefinition type, Cut cut)
        {
            var instanceAspectsInitializer = type.Methods.FirstOrDefault(m => m.Name == Constants.InstanceAspectsMethodName);

            if (instanceAspectsInitializer == null)
            {
                instanceAspectsInitializer = new MethodDefinition(Constants.InstanceAspectsMethodName,
                                                                  MethodAttributes.Private | MethodAttributes.HideBySig, type.Module.ImportReference(StandardTypes.Void));

                type.Methods.Add(instanceAspectsInitializer);

                instanceAspectsInitializer.Body.Instead(i => i.Return());
                instanceAspectsInitializer.Mark(WellKnownTypes.DebuggerHiddenAttribute);

                var ctors = type.Methods.Where(c => c.IsConstructor && !c.IsStatic).ToList();

                foreach (var ctor in ctors)
                {
                    ctor.Body.AfterEntry(i => i.This().Call(instanceAspectsInitializer.MakeReference(type.MakeSelfReference())));
                }
            }

            return(instanceAspectsInitializer);
        }
 protected Cut LoadOriginalThis(Cut pc)
 {
     return(_originalThis == null ? pc : pc.This().Load(_originalThis()));
 }
 protected override Cut LoadArgumentsArgument(Cut pc, AdviceArgument parameter)
 {
     return(pc.This().Load(GetArgsField()));
 }
Esempio n. 15
0
 public bool Intersects(Cut c2)
 {
     return this.L < c2.R && c2.L < this.R;
 }
Esempio n. 16
0
 public static void Rule(StatementElement lhs, Cut cut)
 {
     lhs.CodeCompoundTerm = new CodeCompoundTerm(CodeFunctor.CutFunctor);
 }
Esempio n. 17
0
        static List<int> Solve(Cut[] cuts)
        {
            List<int>[] complementaryGraf;
            List<int>[] graf = MakeGraf(cuts, out complementaryGraf);

            List<int> maxFullSubGraf = FindMaxFullSubGraf(complementaryGraf);
            return maxFullSubGraf;
        }
Esempio n. 18
0
        /// <summary> Split the room with a direction and position. </summary>
        /// <param name="direction"> The direction of the split. </param>
        /// <param name="position"> Where the split is located. </param>
        /// <param name="door"> Where the door is located on the split. </param>
        public void SplitRoom(CutDirections direction, Vector position, int door)
        {
            Split = new Cut { Direction = direction, Position = position, Door = door };
            Transparent = true;

            if (direction == CutDirections.Horizontal)
            {
                var x = (int)RoomRect.Left;
                var y1 = (int)RoomRect.Top;
                var y2 = (int)Split.Position.Y;

                var width = (int)RoomRect.Width;
                var height1 = (int)(Split.Position.Y - RoomRect.Top + 1);
                var height2 = (int)(RoomRect.Bottom - Split.Position.Y);

                ChildA = new Room(x, y1, width, height1, this);
                ChildB = new Room(x, y2, width, height2, this);

                ChildA.AddDoor(door, (int)position.Y);
                ChildB.AddDoor(door, (int)position.Y);
            }
            else
            {
                var x1 = (int)RoomRect.Left;
                var x2 = (int)Split.Position.X;
                var y = (int)RoomRect.Top;

                var width1 = (int)(Split.Position.Y - RoomRect.Left + 1);
                var width2 = (int)(RoomRect.Right - Split.Position.X);
                var height = (int)RoomRect.Height;

                ChildA = new Room(x1, y, width1, height, this);
                ChildB = new Room(x2, y, width2, height, this);

                ChildA.AddDoor((int)position.X, door);
                ChildB.AddDoor((int)position.X, door);
            }

            // Add parent doors to room
            var parent = this;

            while (parent != null)
            {
                for (var y = (int)parent.RoomRect.Y; y < parent.RoomRect.Y + parent.RoomRect.Height; y++)
                {
                    for (var x = (int)parent.RoomRect.X; x < parent.RoomRect.X + parent.RoomRect.Width; x++)
                    {
                        if (!parent.GetDoor(x, y)) continue;

                        ChildA.AddDoor(x, y);
                        ChildB.AddDoor(x, y);
                    }
                }

                parent = parent.Parent;
            }
        }
Esempio n. 19
0
        void CutToolStripMenuItemClick(object sender, EventArgs e)
        {
            Cut cut = new Cut();

            cut.Run();
        }
    void MakeBin(string MakeWorld)
    {
        string world = "x";
        string scene = "x";
        string cut   = "x";
        string ext   = ".sce";
        //read .txt
        string path = "Scenario\\world" + MakeWorld + ext;

        string[] readins = File.ReadAllLines(path);

        path = "Text";

        //check the directory
        if (!Directory.Exists(path))
        {
            Directory.CreateDirectory(path);
        }

        Story story  = new Story();
        Cut   OneCut = new Cut();

        foreach (string readin in readins)
        {
            //comment
            if (readin.Length > 2)
            {
                if (readin[0] == '/' && readin[1] == '/')
                {
                    continue;
                }
            }
            {
                //split by \s
                string[] commands = readin.Split(' ');
                //execute commands
                switch (commands[0])
                {
                //file name
                case "world":
                    world = commands[1] + commands[2];
                    break;

                case "scene":
                    if (scene != "x")
                    {
                        SaveStory(path, story);
                    }
                    story = new Story();
                    scene = commands[1] + commands[2];
                    path  = "Text/" + world + scene + ".story";
                    break;

                case "cut":
                    if (cut != "x")
                    {
                        story.cuts.Add(OneCut);
                        Debug.Log(cut + " success!");
                    }
                    OneCut    = new Cut();
                    cut       = "PLOT" + commands[1];
                    OneCut.no = cut;
                    break;

                case "npccut":
                    if (cut != "x")
                    {
                        story.cuts.Add(OneCut);
                        Debug.Log(cut + " success!");
                    }
                    OneCut    = new Cut();
                    cut       = "NPC" + commands[1];
                    OneCut.no = cut;
                    break;

                case "":
                    break;

                //file contents
                default:
                    if (isNpcName(commands[0]) || isCommand(commands[0]))
                    {
                        Line line = new Line();
                        line.args = commands;
                        OneCut.contents.Add(line);
                    }
                    else
                    {
                        Debug.Log("cannot understand this command: " + readin);
                    }
                    break;
                }
            }
        }
        story.cuts.Add(OneCut);
        Debug.Log(cut + " success!");

        SaveStory(path, story);
    }
Esempio n. 21
0
 protected override Cut LoadArgumentsArgument(Cut pc, AdviceArgument parameter)
 {
     return(pc.Load(_wrapper.Parameters[0]));
 }
Esempio n. 22
0
 void Start()
 {
     //cam = GetComponent<CameraControl>();
     //Debug.Log(cam);
     setValues();
     recycle = GetComponent<RecyclePizza>();
     player = GameObject.FindGameObjectWithTag(TagManager.PLAYER);
     switcher = pizza.GetComponent<CameraSwitcher>();
     cut = gameObject.GetComponent<Cut>();
     cutLine = GameObject.Find("PizzaCutParent");
     logic = GameObject.FindGameObjectWithTag(TagManager.MAIN_CAMERA).GetComponent<Tutorial>();
 }
Esempio n. 23
0
 protected virtual Cut LoadNameArgument(Cut pc, AdviceArgument parameter)
 {
     return(pc.Value(_injection.Target.Name));
 }
Esempio n. 24
0
        private void reDoneGains()
        {
            var x = Cuts;
            double gainSide1Printer = 1;
            double gainSide2Printer = 1;

            Cut currentCut = new Cut("manuale", 1, 1);

            foreach (var item in Cuts)
            {
                var res = item.GetCuttedFormat(BuyingFormat, false);
                if (res == WorkingFormat)
                {
                    gainOnSide1 = item.PartsOnSide1;
                    gainOnSide2 = item.PartsOnSide2;

                    gain = item.Gain;
                    currentCut = item;
                }
            }

            Console.WriteLine(Cuts);

            gainForRun = 1;
            gainSide1Printer = 1;
            gainSide2Printer = 1;

            double dCut1 = 0, dCut2 = 0;
            string format = "1x1";

            if (Printers != null)
            {
                foreach (var fromP in this.Printers)
                {
                    //                    Starts = fromP.GainOnSide1;
                    gainForRun *= fromP.GainForRunForPrintableArticle ?? 1;
                    gainSide1Printer *= fromP.ProductPartPrinting.CalculatedSide1Gain;
                    gainSide2Printer *= fromP.ProductPartPrinting.CalculatedSide2Gain;

                    dCut1 = fromP.ProductPartPrinting.CalculatedDCut1;
                    dCut2 = fromP.ProductPartPrinting.CalculatedDCut2;

                    format = fromP.ProductPart.FormatOpened;
                }
            }

            gainSide1Printer = gainSide1Printer / currentCut.PartsOnSide1;
            gainSide2Printer = gainSide2Printer / currentCut.PartsOnSide2;

            double side1 = 2 + format.GetSide1() * gainSide1Printer + dCut1 * (gainSide1Printer - 1);
            double side2 = 2 + format.GetSide2() * gainSide2Printer + dCut2 * (gainSide2Printer - 1);

            _calculateMqImplant = side1 * side2 / 10000;

        
        }
Esempio n. 25
0
 protected virtual Cut LoadReturnTypeArgument(Cut pc, AdviceArgument parameter)
 {
     return(pc.TypeOf(_target.ReturnType));
 }
        }            // wymagame przez system

        public Cut(int length, int width, int price, bool vertical = true, int n = 0, Cut topleft = null, Cut bottomright = null)
        {
            this.length      = length;
            this.width       = width;
            this.price       = price;
            this.vertical    = vertical;
            this.n           = n;
            this.topleft     = topleft;
            this.bottomright = bottomright;
        }
Esempio n. 27
0
 protected virtual Cut LoadInstanceArgument(Cut pc, AdviceArgument parameter)
 {
     return(pc.ThisOrNull());
 }
Esempio n. 28
0
        public void FilterSceneForRenderer(WSceneView view, WWorld world)
        {
            if (m_bOverrideSceneCamera)
            {
                view.OverrideSceneCamera(m_SceneCameraOverride);
            }

            foreach (WScene scene in world.Map.SceneList)
            {
                foreach (var renderable in scene.GetChildrenOfType <IRenderable>())
                {
                    renderable.AddToRenderer(view);
                }
            }

            Staff camera = (Staff)SelectedEvent.Actors.ToList().Find(x => x.StaffType == StaffType.Camera);

            if (camera != null)
            {
                Cut c = camera.FirstCut;

                while (c != null)
                {
                    OpenTK.Vector3 eye_pos    = new OpenTK.Vector3();
                    OpenTK.Vector3 target_pos = new OpenTK.Vector3();

                    Substance eye = c.Properties.Find(x => x.Name.ToLower() == "eye");
                    if (eye != null)
                    {
                        Substance <ObservableCollection <BindingVector3> > eye_vec = eye as Substance <ObservableCollection <BindingVector3> >;
                        eye_pos = eye_vec.Data[0].BackingVector;

                        WLinearColor draw_color = WLinearColor.White;
                        if (EditorSelection.SelectedObjects.Contains(eye_vec.Data[0]))
                        {
                            draw_color = WLinearColor.FromHexString("0xFF4F00FF");
                        }

                        world.DebugDrawBillboard("eye.png", eye_pos, new OpenTK.Vector3(100, 100, 100), draw_color, 0.025f);
                    }

                    Substance target = c.Properties.Find(x => x.Name.ToLower() == "center");
                    if (target != null)
                    {
                        Substance <ObservableCollection <BindingVector3> > target_vec = target as Substance <ObservableCollection <BindingVector3> >;
                        target_pos = target_vec.Data[0].BackingVector;

                        WLinearColor draw_color = WLinearColor.White;
                        if (EditorSelection.SelectedObjects.Contains(target_vec.Data[0]))
                        {
                            draw_color = WLinearColor.FromHexString("0xFF4F00FF");
                        }

                        world.DebugDrawBillboard("target.png", target_pos, new OpenTK.Vector3(100, 100, 100), draw_color, 0.025f);
                    }

                    if (eye != null && target != null)
                    {
                        world.DebugDrawLine(eye_pos, target_pos, WLinearColor.Black, 100000.0f, 0.025f);
                    }

                    c = c.NextCut;
                }
            }
        }
 protected override Cut LoadReturnTypeArgument(Cut pc, AdviceArgument parameter)
 {
     return(pc.TypeOf(_stateMachine.Interfaces.First(i => i.InterfaceType.Name.StartsWith("IEnumerable`1")).InterfaceType));
 }
Esempio n. 30
0
 protected override Cut LoadReturnTypeArgument(Cut pc, AdviceArgument parameter)
 {
     return(pc.TypeOf(_asyncResult ?? StandardTypes.Void));
 }
Esempio n. 31
0
        static void Main(string[] args)
        {
            Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
#if ONLINE_JUDGE
#else
            do
            {
#endif
                int? countN = ReadIntNLine();
#if ONLINE_JUDGE
#else
                if (countN == null)
                    break;
#endif

                int count = countN.Value;
                Cut[] cuts = new Cut[count];

                for (int i = 0; i < count; i++)
                {
                    int[] ar = ReadIntArray();
                    cuts[i] = new Cut(ar[0], ar[1], i);
                }

                List<int> res = Solve(cuts);

                Console.WriteLine(res.Count);
                foreach (int index in res.OrderBy(i => cuts[i].L))
                    Console.WriteLine(cuts[index].L + " " + cuts[index].R);

#if ONLINE_JUDGE
#else
            } while (true);
#endif

#if ONLINE_JUDGE
#else
            Console.WriteLine("Press Enter to exit");
            Console.ReadLine();
#endif
        }
Esempio n. 32
0
 protected override Cut LoadReturnValueArgument(Cut pc, AdviceArgument parameter)
 {
     return(pc.Load(pc.Method.Parameters[0]));
 }
Esempio n. 33
0
 public static bool Intersects(Cut c1, Cut c2)
 {
     return c1.Intersects(c2);
 }
Esempio n. 34
0
 public static void Rule(StatementElement lhs, Cut cut)
 {
     lhs.CodeCompoundTerm = new CodeCompoundTerm(CodeFunctor.CutFunctor);
 }
Esempio n. 35
0
        static List<int>[] MakeGraf(Cut[] cuts, out List<int>[] complementaryGraf)
        {
            List<int>[] graf = new List<int>[cuts.Length];
            complementaryGraf = new List<int>[cuts.Length];

            for (int i = 0; i < cuts.Length; i++)
            {
                graf[i] = new List<int>();
                complementaryGraf[i] = new List<int>();
            }

            for (int i = 0; i < cuts.Length; i++)
                for (int j = i + 1; j < cuts.Length; j++)
                    if (Cut.Intersects(cuts[i], cuts[j]))
                    {
                        // i < j
                        graf[i].Add(j);
                        graf[j].Add(i);
                    }
                    else
                        // i < j
                        complementaryGraf[i].Add(j);
            //complementaryGraf[j].Add(i);
            return graf;
        }
        protected override Cut LoadTargetArgument(Cut pc, AdviceArgument parameter)
        {
            var targetMethod = CreateRef(GetOrCreateUnwrapper(), pc.Method);

            return(pc.ThisOrNull().Call(CreateFuncCtorRef(pc), args => args.Delegate(targetMethod)));
        }
Esempio n. 37
0
 public void AssignNull(Cut c)
 {
     c = null;
 }
Esempio n. 38
0
        public MainPage()
        {
            this.InitializeComponent();

            sourcesize = Window.Current.CoreWindow.Bounds;

            GlobalNodeHandler.standardtextFormat = new CanvasTextFormat();

            MyFontPicker = new List <FontClass>();
            MyFontPicker.Add(new FontClass()
            {
                MyFontFamily = new FontFamily("Arial"), FontFamilyValue = "Arial"
            });
            MyFontPicker.Add(new FontClass()
            {
                MyFontFamily = new FontFamily("Times New Roman"), FontFamilyValue = "Times New Roman"
            });
            MyFontPicker.Add(new FontClass()
            {
                MyFontFamily = new FontFamily("Verdana"), FontFamilyValue = "Verdana"
            });
            MyFontPicker.Add(new FontClass()
            {
                MyFontFamily = new FontFamily("Calibri"), FontFamilyValue = "Calibri"
            });
            MyFontPicker.Add(new FontClass()
            {
                MyFontFamily = new FontFamily("Rockwell"), FontFamilyValue = "Rockwell"
            });
            MyFontPicker.Add(new FontClass()
            {
                MyFontFamily = new FontFamily("Twentieth Century"), FontFamilyValue = "Twentieth Century"
            });
            MyFontPicker.Add(new FontClass()
            {
                MyFontFamily = new FontFamily("Helvetica"), FontFamilyValue = "Helvetica"
            });
            MyFontPicker.Add(new FontClass()
            {
                MyFontFamily = new FontFamily("Trajan"), FontFamilyValue = "Trajan"
            });
            MyFontPicker.Add(new FontClass()
            {
                MyFontFamily = new FontFamily("Optima Std"), FontFamilyValue = "Optima Std"
            });
            MyFontPicker.Add(new FontClass()
            {
                MyFontFamily = new FontFamily("Franklin Gothic"), FontFamilyValue = "Franklin Gothic"
            });
            MyFontPicker.Add(new FontClass()
            {
                MyFontFamily = new FontFamily("Futura"), FontFamilyValue = "Futura"
            });
            MyFontPicker.Add(new FontClass()
            {
                MyFontFamily = new FontFamily("Bickham Script"), FontFamilyValue = "Bickham Script"
            });
            MyFontPicker.Add(new FontClass()
            {
                MyFontFamily = new FontFamily("Gill Sans"), FontFamilyValue = "Gill Sans"
            });
            MyFontPicker.Add(new FontClass()
            {
                MyFontFamily = new FontFamily("Sans Serif"), FontFamilyValue = "Sans Serif"
            });
            MyFontPicker.Add(new FontClass()
            {
                MyFontFamily = new FontFamily("Gotham"), FontFamilyValue = "Gotham"
            });
            FontStyleBox.ItemsSource = MyFontPicker;


            MyFontSizePicker = new List <int>();
            for (int i = 6; i < 45; i++)
            {
                MyFontSizePicker.Add(i);
            }
            FontSizeBox.ItemsSource = MyFontSizePicker;

            GlobalNodeHandler.standardtextFormat.FontSize   = 18;
            GlobalNodeHandler.standardtextFormat.FontStyle  = FontStyle.Normal;
            GlobalNodeHandler.standardtextFormat.FontFamily = new FontFamily("Arial").Source;
            FontSizeBox.SelectedItem   = 18;
            FontStyleBox.SelectedIndex = 0;

            GlobalNodeHandler.pick1 = new ColorPicker(5, 5, new Rect(1920 - 200, 50, 200, 260));

            AttributePanel.Margin = new Thickness(0, 260, refwidth - sourcesize.Width, 0);
            UseModePanel.Margin   = new Thickness(0, 0, refwidth - sourcesize.Width, 0);

            //AttributePanel.Margin = new Thickness(0, 260, refwidth - sourcesize.Width, 0);
            GlobalNodeHandler.pick1.boundingbox.X = refwidth - (refwidth - sourcesize.Width) - GlobalNodeHandler.pick1.boundingbox.Width;
            repaint(this, new EventArgs());

            /*var picker = new Windows.Storage.Pickers.FileOpenPicker();
             * picker.ViewMode = Windows.Storage.Pickers.PickerViewMode.Thumbnail;
             * picker.SuggestedStartLocation =
             *  Windows.Storage.Pickers.PickerLocationId.PicturesLibrary;
             * picker.FileTypeFilter.Add(".jpg");
             * picker.FileTypeFilter.Add(".jpeg");
             * picker.FileTypeFilter.Add(".png");
             *
             * Windows.Storage.StorageFile file = await picker.PickSingleFileAsync();
             * if (file != null)
             * {
             *  // Application now has read/write access to the picked file
             *  this.textBlock.Text = "Picked photo: " + file.Name;
             * }
             * else
             * {
             *  this.textBlock.Text = "Operation cancelled.";
             * }*/

            GlobalNodeHandler.masterNode = new MindNode(GlobalNodeHandler.id, 0, 0, 0, 0, false);
            GlobalNodeHandler.id++;
            GlobalNodeHandler.masterNode.text = "masterNode";

            GlobalNodeHandler.viewNode = GlobalNodeHandler.masterNode;

            Application.Current.DebugSettings.EnableFrameRateCounter = false;

            activetext.KeyDown   += new KeyEventHandler(activeTextfield_KeyDown);
            activetext.Visibility = Visibility.Collapsed;

            DispatcherTimer timer1 = new DispatcherTimer();

            timer1.Interval = new TimeSpan(1000 / 8);
            timer1.Start();
            timer1.Tick += this.timer1_Tick;


            mouse            = new MouseHandler(activetext);
            mouse.repainted += this.repaint;

            keymanager            = new KeyHandler(activetext);
            keymanager.repainted += this.repaint;

            btnMngr = new ButtonManager();

            viewPane.PointerPressed  += this.viewPane_MouseDown;
            viewPane.PointerReleased += this.viewPane_MouseUp;

            AddNode.AddHandler(PointerPressedEvent, new PointerEventHandler(AddNode_PointerPressed), true);
            ConnectNodes.AddHandler(PointerPressedEvent, new PointerEventHandler(ConnectNodes_PointerPressed), true);
            DeConnectNodes.AddHandler(PointerPressedEvent, new PointerEventHandler(DeConnectNodes_PointerPressed), true);
            TransformNode.AddHandler(PointerPressedEvent, new PointerEventHandler(TransformNode_PointerPressed), true);
            MoveNodes.AddHandler(PointerPressedEvent, new PointerEventHandler(MoveNodes_PointerPressed), true);
            DeleteNode.AddHandler(PointerPressedEvent, new PointerEventHandler(DeleteNode_PointerPressed), true);
            SelectNodes.AddHandler(PointerPressedEvent, new PointerEventHandler(SelectNodes_PointerPressed), true);
            UnDo.AddHandler(PointerPressedEvent, new PointerEventHandler(UnDo_PointerPressed), true);
            ReDo.AddHandler(PointerPressedEvent, new PointerEventHandler(ReDo_PointerPressed), true);
            Copy.AddHandler(PointerPressedEvent, new PointerEventHandler(Copy_PointerPressed), true);
            Cut.AddHandler(PointerPressedEvent, new PointerEventHandler(Cut_PointerPressed), true);
            Paste.AddHandler(PointerPressedEvent, new PointerEventHandler(Paste_PointerPressed), true);
            PlaceLabel.AddHandler(PointerPressedEvent, new PointerEventHandler(PlaceLabel_PointerPressed), true);
            JumpInto.AddHandler(PointerPressedEvent, new PointerEventHandler(JumpInto_PointerPressed), true);
            JumpOutof.AddHandler(PointerPressedEvent, new PointerEventHandler(JumpOutof_PointerPressed), true);
            ColorNode.AddHandler(PointerPressedEvent, new PointerEventHandler(ColorNode_PointerPressed), true);

            UNDOMENU.AddHandler(PointerPressedEvent, new PointerEventHandler(UnDo_PointerPressed), true);
            REDOMENU.AddHandler(PointerPressedEvent, new PointerEventHandler(ReDo_PointerPressed), true);
            CUTMENU.AddHandler(PointerPressedEvent, new PointerEventHandler(Cut_PointerPressed), true);
            COPYMENU.AddHandler(PointerPressedEvent, new PointerEventHandler(Copy_PointerPressed), true);
            PASTEMENU.AddHandler(PointerPressedEvent, new PointerEventHandler(Paste_PointerPressed), true);
            TRANSFORMMENU.AddHandler(PointerPressedEvent, new PointerEventHandler(TransformNode_PointerPressed), true);
            EDITMENU.AddHandler(PointerPressedEvent, new PointerEventHandler(PlaceLabel_PointerPressed), true);
            JUMPINMENU.AddHandler(PointerPressedEvent, new PointerEventHandler(JumpInto_PointerPressed), true);
            JUMPOUTMENU.AddHandler(PointerPressedEvent, new PointerEventHandler(JumpOutof_PointerPressed), true);
            CHANGECOLORMENU.AddHandler(PointerPressedEvent, new PointerEventHandler(ColorNode_PointerPressed), true);

            //FileButtonFlyout.AddHandler(PointerPressedEvent, new PointerEventHandler(FileButton_PointerPressed), true);
            this.NEW.AddHandler(PointerPressedEvent, new PointerEventHandler(NEW_PointerPressed), true);
            this.OPEN.AddHandler(PointerPressedEvent, new PointerEventHandler(OPEN_PointerPressed), true);
            this.SAVE.AddHandler(PointerPressedEvent, new PointerEventHandler(SAVE_PointerPressed), true);
            this.SAVEAS.AddHandler(PointerPressedEvent, new PointerEventHandler(SAVEAS_PointerPressed), true);
            this.EXPORT.AddHandler(PointerPressedEvent, new PointerEventHandler(EXPORT_PointerPressed), true);
            this.CLOSE.AddHandler(PointerPressedEvent, new PointerEventHandler(CLOSE_PointerPressed), true);
            this.EXIT.AddHandler(PointerPressedEvent, new PointerEventHandler(EXIT_PointerPressed), true);

            Application.Current.Suspending += AppSuspending;

            STYLESBAR.AddHandler(PointerPressedEvent, new PointerEventHandler(STYLESBAR_PointerPressed), true);
            ZOOMIN.AddHandler(PointerPressedEvent, new PointerEventHandler(ZOOMIN_PointerPressed), true);
            ZOOMOUT.AddHandler(PointerPressedEvent, new PointerEventHandler(ZOOMOUT_PointerPressed), true);

            ABOUT.AddHandler(PointerPressedEvent, new PointerEventHandler(ABOUT_PointerPressed), true);
            DOCU.AddHandler(PointerPressedEvent, new PointerEventHandler(DOCU_PointerPressed), true);

            BoldText.AddHandler(PointerPressedEvent, new PointerEventHandler(UpdateFontStyle), true);
            ItalicText.AddHandler(PointerPressedEvent, new PointerEventHandler(UpdateFontStyle), true);
            UnderlineText.AddHandler(PointerPressedEvent, new PointerEventHandler(UpdateFontStyle), true);

            AboutButton.AddHandler(PointerPressedEvent, new PointerEventHandler(AboutButton_PointerPressed), true);


            viewPane.PointerMoved        += viewPane_UpdateMousePos;
            viewPane.PointerWheelChanged += OnMouseScroll;

            timer1.Tick += mouse.timer1_Tick;

            OpenAutoSave();

            repaint(this, new EventArgs());

            /*Random r = new Random();
             *
             * for (int x = 0; x < 100; x++) {
             *  for (int y = 0; y < 100; y++)
             *  {
             *      //mouse.CreateNewNode((int)(r.NextDouble() * 1000), (int)(r.NextDouble() * 1000), true);
             *
             *      GlobalNodeHandler.CreateNewNode((int)(y * 50), (int)(x * 30), true);
             *
             *      mouse.activetext.Text = "n:";
             *      keymanager.EnterTextBox();
             *      repaint(this,new EventArgs());
             *  }
             * }*/

            GlobalNodeHandler.TabletSelected = true;
            this.Focus(FocusState.Keyboard);
        }