예제 #1
0
        public List <NavObject> GetObjectNames()
        {
            List <NavObject>  ret   = new List <NavObject>();
            List <ObjectType> types = new List <ObjectType>
            {
                ObjectType.Page,
                ObjectType.Report,
                ObjectType.Table,
                ObjectType.Codeunit,
            };

            foreach (KeyValuePair <string, string> temp in data)
            {
                string[] t = temp.Key.Split('_');

                try {
                    int        id  = Int32.Parse(t[1]);
                    ObjectType Typ = NavObjects.GetObj(t[0]);
                    if (types.Contains(Typ))
                    {
                        ret.Add(new NavObject(t[0], id, temp.Value.Split(SEPERATOR)[0], temp.Value.Split(SEPERATOR)[1]));
                    }
                }
                catch
                {
                }
            }
            return(ret);
        }
예제 #2
0
        public List <NavObject> GetFav(string group)
        {
            string section = "Fav";

            if (!String.IsNullOrEmpty(group))
            {
                section += "_" + group;
            }

            List <NavObject> ret = new List <NavObject>();

            if (Data.Sections[section] is null)
            {
                return(ret);
            }
            foreach (KeyData key in Data.Sections[section])
            {
                string[] keyVal = key.KeyName.Split('_');
                if (keyVal.Length == 2)
                {
                    int id = int.Parse(keyVal[1]);
                    ret.Add(new NavObject(keyVal[0], id,
                                          handler.GetObjName(id, NavObjects.GetObj(keyVal[0])),
                                          handler.GetVersion(id, NavObjects.GetObj(keyVal[0]))
                                          )
                            );
                }
            }
            return(ret);
        }
예제 #3
0
        public MainWindow()
        {
            InitializeComponent();
            Loghandler = new Log(tb_status);
            handler    = new ObjectHandler(OBJECTFILE);
            ini        = new IniHandler(INIFILE, OBJECTFILE, Loghandler);

            ListView lv = lv_fav.lv_items;

            lv.MouseDoubleClick += new MouseButtonEventHandler(Lv_fav_MouseDoubleClick);

            foreach (String temp in NavObjects.GetObjectNames())
            {
                cb_objektTyp.Items.Add(temp);
            }

            //Pbjekte die gespeichert werden sollen
            toSave.Add(cb_server);              toSave.Add(cb_mandant);
            toSave.Add(cb_objektTyp);           toSave.Add(tx_objId);
            toSave.Add(cbo_config);             toSave.Add(cbo_debug);
            toSave.Add(cbo_schow_startstring);  toSave.Add(cb_profil);
            toSave.Add(cbo_disable_pers);
            toSave.Add(cb_favGroup);

            //Keine Favgruppeneinstellung gefunden
            if (ini.GetSetting("favgroup") == null)
            {
                if (MessageBox.Show(Resource.Fav_Group_Ques,
                                    "Favoriten Gruppen", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
                {
                    ini.SetSettings("favgroup", "true");
                    ini.AddFavGroup("(DEFAULT)");
                    ini.SetSettings("cb_favGroup", "(DEFAULT)");
                }
                else
                {
                    ini.SetSettings("favgroup", "false");
                }
            }

            Load();

            //Kein Pfad zur exe eingerichtet
            if (!ini.CheckExe())
            {
                if (MessageBox.Show("Pfad zur Exe wurde nicht eingerichtet. Möchten sie das jetzt durchführen?",
                                    "Pfad zur EXE", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
                {
                    Mi_set_exe_path_Click(null, null);
                }
                else
                {
                    string tooltip = "Für diese Option muss zuerst die Anwendung ausgewählt werden";
                    cbo_config.IsEnabled           = false;
                    cbo_debug.IsEnabled            = false;
                    b_start_session_list.IsEnabled = false;
                    cb_profil.IsEnabled            = false;
                    b_start_nav.IsEnabled          = false;

                    cb_profil.SelectedItem = "<kein Profil>";
                    cbo_config.IsChecked   = false;
                    cbo_debug.IsChecked    = false;

                    cbo_config.ToolTip           = tooltip;
                    cbo_debug.ToolTip            = tooltip;
                    cb_profil.ToolTip            = tooltip;
                    b_start_session_list.ToolTip = tooltip;
                    b_start_nav.ToolTip          = tooltip;
                }
            }


            //Updater aktualisieren
            string[] args = Environment.GetCommandLineArgs();
            if (args.Length == 2)
            {
                Thread.Sleep(2000);
                try {
                    File.Copy("Updater_new.exe", "Updater.exe", true);
                    File.Delete("Updater_new.exe");
                }
                catch (Exception e)
                {
                    Loghandler.Add("Fehler Updater aktualisieren: " + e.Message);
                }
                Loghandler.Add("Der Updater wurde aktualisiert");
                MessageBox.Show("Update erfolgreich durchgeführt: " + args[1], "Update erfolgreich");
                ini.SetSettings("updateuri", args[1]);
            }

            //Update
            if (ini.GetSetting("upd") == "true")
            {
                UpdateApplicationAsync();
            }
        }
예제 #4
0
        string GetStartParameter(StartTyp st)
        {
            string     Navbase       = "\"dynamicsnav://";
            string     ServerAdress  = ini.GetServerAdress(cb_server.Text);
            string     Mandant       = "/" + cb_mandant.Text;
            ObjectType ob            = NavObjects.GetObj(cb_objektTyp.Text);
            string     Config        = " -configure";
            string     Debug         = " -debug";
            string     DisablePer    = " -disablepersonalization";
            string     Profile       = " -profile:";
            string     sessionlist   = " -protocolhandler";
            string     checkedServer = ObjectHandler.CheckServerString(ServerAdress);
            string     startstring   = "";

            //Serveradresse aktualisieren
            if (checkedServer != ServerAdress)
            {
                ini.AddServer(cb_server.Text, checkedServer);
                ServerAdress = ini.GetServerAdress(cb_server.Text);
            }

            string ObjectStart = "/";

            startstring += Navbase + ServerAdress;

            if (st == StartTyp.Nav)
            {
                switch (ob)
                {
                case ObjectType.Page: ObjectStart += "runpage?page=" + tx_objId.Text; break;

                case ObjectType.Table: ObjectStart += "runtable?table=" + tx_objId.Text; break;

                case ObjectType.Report: ObjectStart += "runreport?report=" + tx_objId.Text; break;

                case ObjectType.Codeunit: ObjectStart += "runcodeunit?codeunit=" + tx_objId.Text; break;
                }

                startstring += Mandant + ObjectStart + "\"";
                if (cb_profil.Text != "<kein Profil>")
                {
                    startstring += Profile + "\"" + cb_profil.Text + "\"";
                }
                if (cbo_config.IsChecked.Value)
                {
                    startstring += Config;
                }
                if (cbo_debug.IsChecked.Value)
                {
                    startstring += Debug;
                }
                if (cbo_disable_pers.IsChecked.Value)
                {
                    startstring += DisablePer;
                }
            }
            else if (st == StartTyp.Session)
            {
                startstring += "//debug\"" + sessionlist;
            }
            return(startstring);
        }
예제 #5
0
 /// <summary>
 /// Nav Objektnamen ermitteln
 /// </summary>
 /// <param name="objID">ID des Objectes</param>
 /// <param name="objName">Der Typ des Objectes</param>
 /// <returns>Objektname</returns>
 public string GetObjName(int objID, string objName)
 {
     return(GetObjName(objID, NavObjects.GetObj(objName)));
 }
예제 #6
0
 public void DeleteFav(ObjectType type, int id)
 {
     DeleteFav(NavObjects.GetName(type), id);
 }
예제 #7
0
 public void AddFav(ObjectType type, int id)
 {
     AddFav(NavObjects.GetName(type), id);
 }