예제 #1
0
        private void Grid_MouseDown(object sender, MouseButtonEventArgs e)
        {
            if (e.LeftButton == MouseButtonState.Pressed && e.ClickCount == 1)
            {
                // 在地图界面上点击固定
                if (check_is == false)
                {
                    // 确认显示点
                    check_is = true;
                    selected = true;
                }
                else
                {
                    check_is = false;
                    selected = false;
                }
            }

            if (e.RightButton == MouseButtonState.Pressed)
            {
                try
                {
                    rukou  = int.Parse(MainWindow.Point_ini.IniReadValue(Key, "rukou"));
                    chukou = int.Parse(MainWindow.Point_ini.IniReadValue(Key, "chukou"));
                    int mode = int.Parse(MainWindow.Point_ini.IniReadValue(Key, "mode"));

                    ArrayList all_warn_list = new ArrayList();

                    foreach (DataList.Data_Struct data_struct in MainWindow.Real_Data_List)
                    {
                        if (data_struct.位置 >= rukou && data_struct.位置 <= chukou)
                        {
                            all_warn_list.Add(data_struct);
                        }
                    }

                    view        = null;
                    show_dialog = true;


                    view = new WarnInfo(all_warn_list, mode, Key);
                    view.ShowDialog();
                    show_dialog = false;
                    view        = null;
                    //return;
                }
                catch { show_dialog = false; return; }
            }
        }
        private void UserControl_MouseDown(object sender, MouseButtonEventArgs e)
        {
            if (e.LeftButton == MouseButtonState.Pressed)
            {
                move_enable = true;
            }

            if (e.LeftButton == MouseButtonState.Pressed && e.ClickCount == 1)
            {
                if (edit_able == false)
                {
                    // 在地图界面上点击固定
                    if (check_is == false)
                    {
                        // 确认显示点
                        check_is = true;
                        selected = true;
                    }
                    else
                    {
                        check_is = false;
                        selected = false;
                    }
                }
            }

            if (e.RightButton == MouseButtonState.Pressed)
            {
                if (edit_able == false)
                {
                    try
                    {
                        rukou  = int.Parse(MainWindow.Point_ini.IniReadValue(Key, "rukou"));
                        chukou = int.Parse(MainWindow.Point_ini.IniReadValue(Key, "chukou"));
                        int mode = 1;  // 报警点的模式
                        try
                        {
                            mode = int.Parse(MainWindow.Point_ini.IniReadValue(Key, "mode"));
                        }
                        catch { }

                        ArrayList all_warn_list = new ArrayList();

                        foreach (DataList.Data_Struct data_struct in MainWindow.Real_Data_List)
                        {
                            if (data_struct.位置 >= rukou && data_struct.位置 <= chukou)
                            {
                                all_warn_list.Add(data_struct);
                            }
                        }

                        view        = null;
                        show_dialog = true;


                        view = new WarnInfo(all_warn_list, mode, Key);
                        if (mode == 2)
                        {
                            view.Top    = 100;
                            view.Left   = 100;
                            view.Width  = 1000;
                            view.Height = 600;
                        }

                        Set_View();
                        view.ShowDialog();
                        show_dialog = false;
                        if (mode == 2)
                        {
                            view = null;
                        }
                    }
                    catch { show_dialog = false; return; }
                    return;
                }
                // 右键
                MessageBoxResult resut = MessageBox.Show("是否删除此点", "删除", MessageBoxButton.OKCancel);
                if (resut == MessageBoxResult.OK)
                {
                    // 删除此点
                    try
                    {
                        Map_Set.all_dizhuang_list.Remove(this);
                        MainWindow.Point_ini.IniWriteValue(label_center.Content.ToString(), "enable", "false");
                        Grid mygrid = (Grid)this.Parent;
                        mygrid.Children.Remove(this);
                    }
                    catch { }
                }
            }
        }