Пример #1
0
        public WindowControl()
        {

            try
            {
                global.log("-----------------------STARTUP-----------------------");
            }
            catch { }


            InitializeComponent();

            #region Software Components
            AddHandler(Keyboard.KeyDownEvent, (KeyEventHandler)HandleShortcuts);
            Loaded += new RoutedEventHandler(OnWindowLoad);
            AboutUsFlyoutContent.Content = new SecurePasswordFlyout();

            #endregion

            #region Load resources
            

            //Ensure Error Log exists
            if (!FileIO.exists("log.txt"))
            {
                try
                {
                    File.Create(System.IO.Path.Combine(global.datapath, "log.txt"));
                    global.log("[MainWindow]<Created log.txt>");
                }
                catch (Exception error) { global.log(error.Message, (int)global.loghandle.logerror); }
            }
            
            //Ensure Prefrences exist
            if (!FileIO.exists("pref.xml"))
            {
                try
                {
                    //Generate the xml file and save it
                    FileIO.write(@"pref.xml", Preference.Serializer(global.pref));
                    global.log("[MainWindow]<Created pref.xml>");
                }
                catch (Exception error) { global.log(error.Message, (int)global.loghandle.logerror); }
            }

            //Ensure Layouts exist
            if (!FileIO.exists("layout.xml"))
            {
                try
                {
                    //Generate the xml file and save it
                    FileIO.write(@"layout.xml", Layout.Serializer(global.layout));
                    global.log("[MainWindow]<Created layout.xml>");
                }
                catch (Exception error) { global.log(error.Message, (int)global.loghandle.logerror); }
            }

            //Load the prefrences
            try
            {
                string xml_as_string = FileIO.read("pref.xml", "Load the prefrences");
                global.pref = Preference.DeSerializer(xml_as_string);

                //To update the Prefrence xml to the latest version we save it again
                FileIO.write(@"pref.xml", Preference.Serializer(global.pref));
            }
            catch (Exception e)
            {
                global.log(e.ToString(), (int)global.loghandle.logerrorandreport);
            }

            //Load the Design
            try
            {
                string xml_as_string = FileIO.read("layout.xml", "Load the Design");
                global.layout = Layout.DeSerializer(xml_as_string);

                //To update the Prefrence xml to the latest version we save it again
                FileIO.write(@"layout.xml", Layout.Serializer(global.layout));
            }
            catch (Exception e)
            {
                global.log(e.ToString(), (int)global.loghandle.logerrorandreport);
            }


            //Create dummy image
            if(!FileIO.exists(@"banner.png"))
            {
                var image = Properties.Resources.stmc;
                image.Save(System.IO.Path.Combine(global.datapath + @"banner.png"));
            }
            #endregion

            Height = 500;
            Width = 750;

            windowstate = (int)windowtypes.startup;
            _Startup = new Jan.Windows.Startup();
            _DisplayWindow = new Jan.Windows.DisplayWindow();
            _Modify = new Windows.Modify();

            WindowContent.Content = _Startup;
        }
Пример #2
0
 void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
     switch (connectionId)
     {
     case 1:
     this.userControl = ((Jan.Windows.Modify)(target));
     return;
     case 2:
     this.modify = ((System.Windows.Controls.Grid)(target));
     return;
     case 3:
     this.RootTreeView = ((System.Windows.Controls.TreeView)(target));
     
     #line 27 "..\..\..\Windows\Modify.xaml"
     this.RootTreeView.SelectedItemChanged += new System.Windows.RoutedPropertyChangedEventHandler<object>(this.RootTreeView_SelectedItemChanged);
     
     #line default
     #line hidden
     return;
     case 4:
     this.root = ((System.Windows.Controls.TreeViewItem)(target));
     return;
     case 5:
     this.Pass_root = ((System.Windows.Controls.TreeViewItem)(target));
     return;
     case 6:
     this.Pref_root = ((System.Windows.Controls.TreeViewItem)(target));
     return;
     case 7:
     this.Desi_root = ((System.Windows.Controls.TreeViewItem)(target));
     return;
     case 8:
     this.Map_root = ((System.Windows.Controls.TreeViewItem)(target));
     return;
     case 9:
     this.Map_Building = ((System.Windows.Controls.TreeViewItem)(target));
     return;
     case 10:
     this.Map_path = ((System.Windows.Controls.TreeViewItem)(target));
     return;
     case 11:
     this.navBack = ((System.Windows.Controls.Button)(target));
     
     #line 59 "..\..\..\Windows\Modify.xaml"
     this.navBack.Click += new System.Windows.RoutedEventHandler(this.navBack_Click);
     
     #line default
     #line hidden
     return;
     case 12:
     this.navSave = ((System.Windows.Controls.Button)(target));
     
     #line 76 "..\..\..\Windows\Modify.xaml"
     this.navSave.Click += new System.Windows.RoutedEventHandler(this.navSave_Click);
     
     #line default
     #line hidden
     return;
     case 13:
     this.grid = ((System.Windows.Controls.Grid)(target));
     return;
     case 14:
     this.modifyContentControl = ((System.Windows.Controls.ContentControl)(target));
     return;
     }
     this._contentLoaded = true;
 }